The function verboseCheck
from QuickCheck 1 seems to be absent in QuickCheck 2 (or at least, I can't find it). Is there any other way to show which values are used during testing?
If you want to use QuickCheck in a command such as stack ghci or stack ghc , you can add it as a --package option e.g. to run a REPL to play around with QuickCheck you can use stack ghci --package QuickCheck and then write import Test. QuickCheck .
QuickCheck is a software library, specifically a combinator library, originally written in the programming language Haskell, designed to assist in software testing by generating test cases for test suites – an approach known as property testing.
Haskell is a statically-typed functional programming language: Haskell type declarations are identified and checked during compilation, guaranteeing that program semantics are known by the designers before execution or possibly even before the implementation.
The sample
function is also useful:
Prelude Test.QuickCheck
ghci> sample (arbitrary :: Gen String)
""
")\223"
"(\227\&5F"
"\DC1"
"\136'\140\180\FS"
"K\DC2\NUL\CAN\253Q"
"\DC4\f\184&.\DC3\159\&1I\160j\147"
....
This way, it's easy to play with your Arbitrary instances, and make sure they generate what you think they generate.
Yes, this seems to be a functionality regression with respect to QuickCheck 1.
You can work around it by annotating your properties with a Debug.Trace.trace statement, however. Something like:
import Debug.Trace
prop_eq xs = traceShow xs $
xs == reverse (reverse xs)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With