- arbitrary(+Type, -Value) is det[multifile]
- Generate a random Value of Type. If you define your own types, add
clauses to this multifile predicate to support them in quickcheck.
When defining your own types, it can be helpful to call arbitrary/2
recursively or to use library(random).
The following types from library(error) have built in support.
any
atom
atomic
between(L,U)
boolean
chars
code - printable ASCII for now
codes
encoding
float
integer
list
list(T)
negative_integer
- `nonneg alias natural`
number
oneof(L)
positive_integer
rational
string
text
- shrink(+Type, +Value, -Smaller) is nondet[multifile]
- True if Smaller is a "smaller" version of Value according to the
semantics of Type. This predicate is called after
quickcheck finds a Value for which a property fails. By recursively
shrinking values, we can obtain a minimal, failing example.
When defining shrink/3 for your own types, be sure to fail if Value
cannot be shrunk any smaller. It's acceptable to produce additional
shrunken values on backtracking. It's often best to bisect your
type's values (rather than iterating all possible, smaller values) if
bisecting makes for your type.
- composite(+Type, +Arbitrary:BaseType, -Value) is det[multifile]
- Generate a random Value of Type from a given Arbitrary.
- quickcheck(+Property:atom) is semidet
- True if Property holds for many random values. Property should be a
Name/Arity term. Details about test results are displayed
on the
user_error stream.
Undocumented predicates
The following predicates are exported, but not or incorrectly documented.
- arbitrary_type(Arg1)