rudymatela / leancheck

enumerative property-based testing for Haskell
https://hackage.haskell.org/package/leancheck
Other
52 stars 8 forks source link

Make the check* family of functions exit as soon as a counterexample is found #5

Closed rudymatela closed 6 years ago

rudymatela commented 6 years ago

Look:

$ ghci
> :set +s
> checkFor 100 (/= 0)
*** Failed! Falsifiable (after 1 tests):
0
(0.01 secs, 186,296 bytes)
> checkFor 10000000 (/= 0)
*** Failed! Falsifiable (after 1 tests):
0
(3.34 secs, 8,968,395,808 bytes)

The above two calls for checkFor should have the same runtime but they have not --- as soon as a counterexample is found checkFor should print it and exit (currently it is running tests after it has found the fault!). Somewhere in the implementation I am using sequence on the wrong place.

I discovered this when working on #4.

rudymatela commented 6 years ago

Done. See 24ad7955c44bfdfeece853aafc5d4892c8cadfa8.