A claim is a function that maps a subject to a verdict.
The result of applying a claim to a subject.
A claim about a subject will either be accepted or rejected.
Claim that the subject is equal to the provided value.
The first argument to this function converts a value of some type to a string, which
is used to produce readable messages if the claim is rejected. Instead of providing
this string-generating function each time, I suggest adding a helper function that just uses the
Debug.toString function like so:
equals : a -> Claim a
equals =
Spec.Claim.isEqual Debug.toStringThen just use your equals function whenever you need to claim that a subject is equal to some value.
Claim that the subject is True
Claim that the subject is False
Claim that the subject is a list where the following claims are satisfied:
For example:
[ 1, 2, 3 ]
|> Spec.Claim.isListWhere
[ Spec.Claim.isEqualTo Debug.toString 1
, Spec.Claim.isEqualTo Debug.toString 27
, Spec.Claim.isEqualTo Debug.toString 3
]would result in a rejected claim, since 2 is not equal to 27.
Claim that the subject is a list such that:
Claim that the subject is a list with the given length.
Claim that the subject is the Just case of the Maybe type.
Combine multiple claims into one.
If any of the claims is rejected, then the combined claim is rejected.
Represents a function from a subject to a verdict.