Copyright | (c) 2015-2024 Rudy Matela |
---|---|
License | 3-Clause BSD (see the file LICENSE) |
Maintainer | Rudy Matela <rudy@matela.com.br> |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
This module is part of LeanCheck, a simple enumerative property-based testing library.
QuickCheck-like interface to Test.LeanCheck
Documentation
check :: Testable a => a -> IO () Source #
Checks a property printing results on stdout
> check $ \xs -> sort (sort xs) == sort (xs::[Int]) +++ OK, passed 200 tests.
> check $ \xs ys -> xs `union` ys == ys `union` (xs::[Int]) *** Failed! Falsifiable (after 4 tests): [] [0,0]
checkFor :: Testable a => Int -> a -> IO () Source #
Check a property for a given number of tests
printing results on stdout
> checkFor 1000 $ \xs -> sort (sort xs) == sort (xs::[Int]) +++ OK, passed 1000 tests.
Test exhaustion is reported when the configured number of tests is larger than the number of available test values:
> checkFor 3 $ \p -> p == not (not p) +++ OK, passed 2 tests (exhausted).
checkResult :: Testable a => a -> IO Bool Source #
Check a property
printing results on stdout
and
returning True
on success.
> p <- checkResult $ \xs -> sort (sort xs) == sort (xs::[Int]) +++ OK, passed 200 tests. > q <- checkResult $ \xs ys -> xs `union` ys == ys `union` (xs::[Int]) *** Failed! Falsifiable (after 4 tests): [] [0,0] > p && q False
There is no option to silence this function:
for silence, you should use holds
.