a package:QuickCheck
Modifies a property so that it will be tested repeatedly. Opposite of
once.
Apply a binary function to random arguments.
Apply a ternary function to random arguments.
Apply a function of arity 4 to random arguments.
Extracts the value of a function.
Fn is the pattern equivalent of this function.
prop :: Fun String Integer -> Bool
prop f = applyFun f "banana" == applyFun f "monkey"
|| applyFun f "banana" == applyFun f "elephant"
Extracts the value of a binary function.
Fn2 is the pattern equivalent of this function.
prop_zipWith :: Fun (Int, Bool) Char -> [Int] -> [Bool] -> Bool
prop_zipWith f xs ys = zipWith (applyFun2 f) xs ys == [ applyFun2 f x y | (x, y) <- zip xs ys]
Extracts the value of a ternary function.
Fn3 is the pattern
equivalent of this function.
A generator for values of the given type.
It is worth spending time thinking about what sort of test data you
want - good generators are often the difference between finding bugs
and not finding them. You can use
sample,
label and
classify to check the quality of your test data.
There is no generic
arbitrary implementation included because
we don't know how to make a high-quality one. If you want one,
consider using the
testing-feat or
generic-random
packages.
The
QuickCheck manual goes into detail on how to write good
generators. Make sure to look at it, especially if your type is
recursive!
Generates a random ASCII character (0-127).
Generates an element of a bounded enumeration.
Generates an integral number. The number is chosen uniformly from the
entire range of the type. You may want to use
arbitrarySizedBoundedIntegral instead.
Generates an element of a bounded type. The element is chosen from the
entire range of the type.
Generates a printable Unicode character.
Generates an integral number from a bounded domain. The number is
chosen from the entire range of the type, but small numbers are
generated more often than big numbers. Inspired by demands from Phil
Wadler.
Uniformly generates a fractional number. The number can be positive or
negative and its maximum absolute value depends on the size parameter.
Generates an integral number. The number can be positive or negative
and its maximum absolute value depends on the size parameter.
Generates a natural number. The number's maximum value depends on the
size parameter.
Generates any Unicode character (but not a surrogate)
Allows embedding non-monadic properties into monadic ones.