Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Number of QuickCheck test cases is inconsistent #113

Closed
UnkindPartition opened this issue Sep 2, 2016 · 5 comments
Closed

Number of QuickCheck test cases is inconsistent #113

UnkindPartition opened this issue Sep 2, 2016 · 5 comments

Comments

@UnkindPartition
Copy link

@jtdaugherty reports that somewhere between QuickCheck 2.8.2 and 2.9.1 a bug (or a silent and undocumented in the Changelog change in semantics) was introduced: UnkindPartition/tasty#147

Could you look into it?

@phadej
Copy link
Contributor

phadej commented Sep 2, 2016

that's related to

Remove "exhaustive" from Testable typeclass;
      instead, combinators which are nonexhaustive (such as forAll)
      call "again", which should be more robust

With

-    , testProperty "merged marking" $ property $ do
+    , testProperty "merged marking" $ property $ again $ do

I get

  merged marking:     OK (0.01s)
    +++ OK, passed 100 tests.

I'm not sure whether

 instance Testable prop => Testable (Gen prop) where
-  property mp = MkProperty $ do p <- mp; unProperty (property p)
+  property mp = MkProperty $ do p <- mp; unProperty (again p)

is the right solution on the QuickCheck side

EDIT It's run once as text-markup the Testable is Gen Bool, and Testable Bool is tested once, which propagates to Gen Bool, but obviously is incorrect. I guess, it's safe to make that change.

ping @nick8325

@nick8325
Copy link
Owner

Thanks @phadej for the patch.

QuickCheck has a mechanism where the user can ask a property to be tested only once (useful e.g. when you just want to check that an IO Bool evaluates to true). In 2.9 I simplified the way this mechanism is implemented, with the side effect that a property will only be repeatedly tested if it uses forAll or similar. Unfortunately this was a bit too aggressive - @phadej's patch makes it so that the property will also be repeatedly tested if it uses the Gen monad.

@jtdaugherty
Copy link

Thanks! Can you mention here when this is released to Hackage?

@nick8325
Copy link
Owner

Should be fixed in 2.9.2 which is out now.

@jtdaugherty
Copy link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants