| Safe Haskell | Trustworthy |
|---|
Test.QuickCheck.All
Description
Test all properties in the current module, using Template Haskell.
You need to have a {-# LANGUAGE TemplateHaskell #-} pragma in
your module for any of these to work.
- quickCheckAll :: Q Exp
- verboseCheckAll :: Q Exp
- forAllProperties :: Q Exp
- polyQuickCheck :: Name -> ExpQ
- polyVerboseCheck :: Name -> ExpQ
- monomorphic :: Name -> ExpQ
Testing all properties in a module
Test all properties in the current module.
The name of the property must begin with prop_.
Polymorphic properties will be defaulted to Integer.
Returns True if all tests succeeded, False otherwise.
Using quickCheckAll interactively doesn't work.
Instead, add a definition to your module along the lines of
runTests = $quickCheckAll
and then execute runTests.
verboseCheckAll :: Q ExpSource
Test all properties in the current module.
This is just a convenience function that combines quickCheckAll and verbose.
forAllProperties :: Q ExpSource
Test all properties in the current module, using a custom
quickCheck function. The same caveats as with quickCheckAll
apply.
$ has type forAllProperties(.
An example invocation is Property -> IO Result) -> IO Bool$,
which does the same thing as forAllProperties quickCheckResult$.
quickCheckAll
Testing polymorphic properties
polyQuickCheck :: Name -> ExpQSource
Test a polymorphic property, defaulting all type variables to Integer.
Invoke as $(, where polyQuickCheck 'prop)prop is a property.
Note that just evaluating in GHCi will seem to
work, but will silently default all type variables to quickCheck prop()!
$( means the same as
polyQuickCheck 'prop).
If you want to supply custom arguments to quickCheck $(monomorphic 'prop)polyQuickCheck,
you will have to combine quickCheckWith and monomorphic yourself.
polyVerboseCheck :: Name -> ExpQSource
Test a polymorphic property, defaulting all type variables to Integer.
This is just a convenience function that combines verboseCheck and monomorphic.
monomorphic :: Name -> ExpQSource
Monomorphise an arbitrary property by defaulting all type variables to Integer.
For example, if f has type
then Ord a => [a] -> [a]$( has type monomorphic 'f)[.
Integer] -> [Integer]