How QuickCheck Validates All Properties for Each Sample

... instead of generating 100 new random samples for each property?

My testsuite contains the TemplateHaskell hack described here [1] to test all functions with the name prop_ *. Running a 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’s like going through 100 random samples for each property.

Problem: creating samples is quite expensive, checking for no properties. Therefore, I would like to be able to pass each random pattern for each of the prop_ * functions instead of creating new (#properties * 100) many samples.

Is there something similar? In fact, I think I will need a replacement for splicing

$(forAllProperties)

at

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] haskell    QuickCheck

+4
1

,

fooobar.com/questions/1646950/...

Test.Tasty.QuickCheck

testProperty testGroup,

Test.Tasty.QuickCheck

0

All Articles