...instead of generating 100 new random samples for each property?
My testsuite contains the TemplateHaskell hack explained here [1] to test all functions named prop_*. Running the test program prints
=== prop_foo from tests/lala.lhs:20 ===
+++ OK, passed 100 tests.
=== prop_bar from tests/lala.lhs:28 ===
+++ OK, passed 100 tests.
and it looks like going through 100 random samples for each of the properties.
Problemis: Generating the samples is quite expensive, checking the properties is not. So I'd like to have a means to pass each random sample to each of the prop_* functions instead of creating new (#properties * 100) many samples.
Is there anything like that built in? Actually, I think I'd need a replacement for the splice
$(forAllProperties)
in
main :: IO ()
main
= do args <- parseArgs <$> getArgs
s <- $(forAllProperties) $ quickCheckWithResult args
s ? return () $ exitFailure
where
parseArgs as
= null as ? stdArgs $ stdArgs{ maxSuccess = read $ head as }
[1] Simple haskell unit testing, and QuickCheck exit status on failures, and cabal integration