From 3daddaf188900130c31131e819297aa64485dfb4 Mon Sep 17 00:00:00 2001 From: anthony cantor Date: Mon, 7 Oct 2013 19:47:16 -0600 Subject: [PATCH] prevent maxDiscardRatio from becoming zero if max_success > max_discard then maxDiscardRatio will become zero and quicktest will immediately report that the test failed because it exhausted all attempts to generate suitable test data. --- quickcheck2/Test/Framework/Providers/QuickCheck2.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickcheck2/Test/Framework/Providers/QuickCheck2.hs b/quickcheck2/Test/Framework/Providers/QuickCheck2.hs index eddc905..bd5cf34 100644 --- a/quickcheck2/Test/Framework/Providers/QuickCheck2.hs +++ b/quickcheck2/Test/Framework/Providers/QuickCheck2.hs @@ -73,7 +73,7 @@ runProperty topts testable = do args = stdArgs { replay = Just (gen, 0) -- NB: the 0 is the saved size. Defaults to 0 if you supply "Nothing" for "replay". , maxSuccess = max_success #if MIN_VERSION_QuickCheck(2,5,0) - , maxDiscardRatio = max_discard `div` max_success + , maxDiscardRatio = (max_discard `div` max_success) + 1 #else , maxDiscard = max_discard #endif