The Batch
module of QuickCheck was removed with version 2 (1.2.0.1 still has it). Because of this, I'm always feeling like mapM_
-ing multiple tests together is kind of hacky. Am I overlooking the successor feature in QuickCheck 2? Is there a canonical way of grouping independent tests together?
There's the 'go big or go home' option of grouping together all tests in the current module via Test.QuickCheck.All
. It requires Template Haskell, and all properties must begin with prop_
. Ex:
{-# LANGUAGE TemplateHaskell #-}
import Test.QuickCheck.All
prop_one, prop_two :: a -> Bool
prop_one = const True
prop_two = const True
runTests :: IO Bool
runTests = $quickCheckAll
main :: IO ()
main = runTests >>= \passed -> if passed then putStrLn "All tests passed."
else putStrLn "Some tests failed."
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