[Haskell-cafe] quickCheck problem
Rogan Creswick
creswick at gmail.com
Wed Oct 7 18:39:32 UTC 2015
On Wed, Oct 7, 2015 at 11:33 AM, Ozgur Akgun <ozgurakgun at gmail.com> wrote:
> This is not true, ==> still does generate and test.
I could have phrased that better. Sure, it generates values, but it
will never provide them to your test, so your logic is simpler.
> Prelude> import Test.QuickCheck
> Prelude Test.QuickCheck> let f x = x == 13 ==> mod x 2 == 1
> Prelude Test.QuickCheck> quickCheck f
> *** Gave up! Passed only 6 tests.
That's unlikely to be a problem given the test inputs in the original
question, but yes, it is certainly an issue to know about.
Roelof -
The issue Ozgur is demonstrating is that the ==> operator will just
discard test inputs that were generated but which did not satisfy the
predicate (here that x == 13). QuickCheck will eventually stop trying
to generate inputs (you can tune this), and produce something like the
above result.
--Rogan
>
> Also try verboseCheck to see what values are generated.
>
> Ozgur
>
More information about the Haskell-Cafe
mailing list