summaryrefslogtreecommitdiff
blob: 7fdb372be8a5c6d8d5495ab3d63da91c3a10495b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--- testpack-2.1.2-orig/src/Test/HUnit/Tools.hs	2012-02-29 09:20:32.000000000 +1100
+++ testpack-2.1.2/src/Test/HUnit/Tools.hs	2012-07-09 09:03:53.104931180 +1000
@@ -128,7 +128,13 @@
 >        q "Integer -> Int (safe bounds)" prop_integer_to_int_pass]
 -}
 qc2hu :: QC.Testable a => Int -> String -> a -> HU.Test
-qc2hu maxTest = qccheck (stdArgs {maxSuccess = maxTest, maxDiscard = 20000})
+qc2hu maxTest = qccheck (stdArgs {maxSuccess = maxTest,
+#if MIN_VERSION_QuickCheck(2,5,0)
+                                  maxDiscardRatio = if maxTest /= 0 then 20000 `div` maxTest else 10
+#else
+                                  maxDiscard = 20000
+#endif
+                                 })
 
 {- | Run verbose tests.  Example:
 
@@ -174,7 +180,12 @@
               Just (rnd,_) -> return rnd
      test MkState{ terminal          = tm
                  , maxSuccessTests   = maxSuccess args
-                 , maxDiscardedTests = maxDiscard args
+                 , maxDiscardedTests =
+#if MIN_VERSION_QuickCheck(2,5,0)
+                                       maxDiscardRatio args * maxSuccess args
+#else
+                                       maxDiscard args
+#endif
                  , computeSize       = case replay args of
                                          Nothing    -> \n d -> (n * maxSize args)
                                                          `div` maxSuccess args