QuickCheck 2.5.1 dropped the maxDiscard field #7

Closed
wants to merge 1 commit into
from

Projects

None yet

3 participants

@peti
Contributor
peti commented Nov 21, 2012

Work around this change to support current versions of the QuickCheck library.

@peti peti src/Test/HUnit/Tools.hs: QuickCheck 2.5.1 dropped the maxDiscard field
Work around this change to support current versions of the QuickCheck library.
b364505
@peti peti referenced this pull request Nov 21, 2012
Merged

cabal dep changes #5

@peti
Contributor
peti commented Dec 5, 2012

How about this change, which adds support for current versions of QuickCheck? The patch is not clean, obviously, but it works fine.

@magthe
magthe commented Feb 28, 2013

This could be a "better" fix (more in line with what was there before):

Index: archhaskell-habs/haskell-testpack/src/testpack-2.1.2/src/Test/HUnit/Tools.hs
===================================================================
--- archhaskell-habs.orig/haskell-testpack/src/testpack-2.1.2/src/Test/HUnit/Tools.hs
+++ archhaskell-habs/haskell-testpack/src/testpack-2.1.2/src/Test/HUnit/Tools.hs
@@ -128,7 +128,7 @@ Often used like this:
 >        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, maxDiscardRatio = 20000})

 {- | Run verbose tests.  Example:

@@ -174,7 +174,7 @@ localquickCheckWithResult args p =
               Just (rnd,_) -> return rnd
      test MkState{ terminal          = tm
                  , maxSuccessTests   = maxSuccess args
-                 , maxDiscardedTests = maxDiscard args
+                 , maxDiscardedTests = maxDiscardRatio args
                  , computeSize       = case replay args of
                                          Nothing    -> \n d -> (n * maxSize args)
                                                          `div` maxSuccess args
@cjwatson
cjwatson commented Apr 6, 2013

@magthe: That's not right, because maxDiscard and maxDiscardRatio don't have the same meaning. I looked at using maxDiscardRatio properly instead, but it ends up artificially dividing and multiplying by maxSuccess for not much gain. Hardcoding it as the original pull request does seems just as good really.

@peti
Contributor
peti commented Apr 6, 2013

We build and use testpack with my patch applied in NixOS for 5+ months, and it works just fine. Since this project appears to be more or less unmaintained, would anyone object if I upload a new version to Hackage that contains my patch and to lift the restriction on old versions of QuickCheck?

@magthe
magthe commented Apr 13, 2013

@cjwatson: fair enough, I just assumed the change in name was a correction, rather than a change in semantics :) In any case, as peti points out, the project is pretty much unmaintained and very little used, so for my purposes (which is packaging for ArchHaskell) there is no point in keeping the package at all.

@peti
Contributor
peti commented Apr 14, 2013

I've wanted to keep testpack in Nixos because it was required to build git-annex, but I just noticed that git-annex no longer depends on this library, we don't need it any more either.

@peti
Contributor
peti commented Oct 23, 2014

Dropped in favor of #9.

@peti peti closed this Oct 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment