chell-quickcheck 0.2.5.1 → 0.2.5.2
raw patch · 3 files changed
+99/−65 lines, 3 filesdep ~QuickCheckdep ~chellnew-uploaderPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: QuickCheck, chell
API changes (from Hackage documentation)
Files
- Test/Chell/QuickCheck.hs +73/−51
- changelog.md +7/−0
- chell-quickcheck.cabal +19/−14
Test/Chell/QuickCheck.hs view
@@ -1,8 +1,8 @@ {-# LANGUAGE CPP #-} module Test.Chell.QuickCheck- ( property- ) where+ ( property+ ) where import Data.Monoid (mempty) import System.Random (mkStdGen)@@ -31,77 +31,98 @@ -- @ property :: QuickCheck.Testable prop => String -> prop -> Chell.Test #if MIN_VERSION_QuickCheck(2,6,0)-property name prop = Chell.test name $ \opts ->- Text.withNullTerminal $ \term -> do+property name prop = Chell.test name $ \opts -> Text.withNullTerminal $ \term ->+ do #else-property name prop = Chell.test name $ \opts -> do- term <- Text.newNullTerminal+property name prop = Chell.test name $ \opts ->+ do+ term <- Text.newNullTerminal #endif- - let seed = Chell.testOptionSeed opts- - let args = QuickCheck.stdArgs- let state = State.MkState- { State.terminal = term- , State.maxSuccessTests = QuickCheck.maxSuccess args++ let+ seed = Chell.testOptionSeed opts++ args = QuickCheck.stdArgs++ state = State.MkState+ { State.terminal = term+ , State.maxSuccessTests = QuickCheck.maxSuccess args #if MIN_VERSION_QuickCheck(2,10,1)- , State.maxDiscardedRatio = QuickCheck.maxDiscardRatio args+ , State.maxDiscardedRatio = QuickCheck.maxDiscardRatio args #else- , State.maxDiscardedTests = maxDiscardedTests args prop+ , State.maxDiscardedTests = maxDiscardedTests args prop #endif - , State.computeSize = computeSize (QuickCheck.maxSize args) (QuickCheck.maxSuccess args)- , State.numSuccessTests = 0- , State.numDiscardedTests = 0- , State.collected = []- , State.expectedFailure = False+ , State.computeSize = computeSize (QuickCheck.maxSize args) (QuickCheck.maxSuccess args)+ , State.numSuccessTests = 0+ , State.numDiscardedTests = 0+#if MIN_VERSION_QuickCheck(2,12,0)+ , State.classes = mempty+ , State.tables = mempty+ , State.requiredCoverage = mempty+ , State.expected = True+ , State.coverageConfidence = Nothing+#else+ , State.collected = []+ , State.expectedFailure = False+#endif #if MIN_VERSION_QuickCheck(2,7,0)- , State.randomSeed = QCRandom.mkQCGen seed+ , State.randomSeed = QCRandom.mkQCGen seed #else- , State.randomSeed = mkStdGen seed+ , State.randomSeed = mkStdGen seed #endif- , State.numSuccessShrinks = 0- , State.numTryShrinks = 0+ , State.numSuccessShrinks = 0+ , State.numTryShrinks = 0 #if MIN_VERSION_QuickCheck(2,5,0)- , State.numTotTryShrinks = 0+ , State.numTotTryShrinks = 0 #endif #if MIN_VERSION_QuickCheck(2,5,1)- , State.numRecentlyDiscardedTests = 0+ , State.numRecentlyDiscardedTests = 0 #endif #if MIN_VERSION_QuickCheck(2,8,0)- , State.labels = mempty+ , State.labels = mempty #endif #if MIN_VERSION_QuickCheck(2,10,0)- , State.numTotMaxShrinks = QuickCheck.maxShrinks args+ , State.numTotMaxShrinks = QuickCheck.maxShrinks args #endif- }- + }++#if MIN_VERSION_QuickCheck(2,12,0)+ result <- Test.test state (QuickCheck.property prop)+#else #if MIN_VERSION_QuickCheck(2,7,0)- let genProp = unProperty (QuickCheck.property prop)+ let+ genProp = unProperty (QuickCheck.property prop) #else- let genProp = QuickCheck.property prop+ let+ genProp = QuickCheck.property prop #endif- result <- Test.test state (Gen.unGen genProp)- let output = Test.output result- let notes = [("seed", show seed)]- let failure = Chell.failure { Chell.failureMessage = output }- return $ case result of- Test.Success{} -> Chell.TestPassed notes- Test.Failure{} -> Chell.TestFailed notes [failure]- Test.GaveUp{} -> Chell.TestAborted notes output- Test.NoExpectedFailure{} -> Chell.TestFailed notes [failure]+ result <- Test.test state (Gen.unGen genProp)+#endif+ let+ output = Test.output result+ notes = [("seed", show seed)]+ failure = Chell.failure { Chell.failureMessage = output } + return $+ case result of+ Test.Success{} -> Chell.TestPassed notes+ Test.Failure{} -> Chell.TestFailed notes [failure]+ Test.GaveUp{} -> Chell.TestAborted notes output+ Test.NoExpectedFailure{} -> Chell.TestFailed notes [failure]+ -- copied from quickcheck-2.4.1.1/src/Test/QuickCheck/Test.hs computeSize :: Int -> Int -> Int -> Int -> Int computeSize maxSize maxSuccess n d- -- e.g. with maxSuccess = 250, maxSize = 100, goes like this:- -- 0, 1, 2, ..., 99, 0, 1, 2, ..., 99, 0, 2, 4, ..., 98.- | n `roundTo` maxSize + maxSize <= maxSuccess ||- n >= maxSuccess ||- maxSuccess `mod` maxSize == 0 = n `mod` maxSize + d `div` 10- | otherwise =- (n `mod` maxSize) * maxSize `div` (maxSuccess `mod` maxSize) + d `div` 10+ -- e.g. with maxSuccess = 250, maxSize = 100, goes like this:+ -- 0, 1, 2, ..., 99, 0, 1, 2, ..., 99, 0, 2, 4, ..., 98.+ | n `roundTo` maxSize + maxSize <= maxSuccess ||+ n >= maxSuccess ||+ maxSuccess `mod` maxSize == 0 =+ n `mod` maxSize + d `div` 10+ | otherwise =+ (n `mod` maxSize) * maxSize `div` (maxSuccess `mod` maxSize) + d `div` 10 roundTo :: Int -> Int -> Int roundTo n m = (n `div` m) * m@@ -110,9 +131,10 @@ #if MIN_VERSION_QuickCheck(2,9,0) maxDiscardedTests args _ = QuickCheck.maxDiscardRatio args #elif MIN_VERSION_QuickCheck(2,5,0)-maxDiscardedTests args p = if QuickCheck.exhaustive p- then QuickCheck.maxDiscardRatio args- else QuickCheck.maxDiscardRatio args * QuickCheck.maxSuccess args+maxDiscardedTests args p =+ if QuickCheck.exhaustive p+ then QuickCheck.maxDiscardRatio args+ else QuickCheck.maxDiscardRatio args * QuickCheck.maxSuccess args #else maxDiscardedTests args _ = QuickCheck.maxDiscard args #endif
+ changelog.md view
@@ -0,0 +1,7 @@+# Release history for `chell-quickcheck`++0.2.5.2 - 2019 Feb 16++ * Add support for `QuickCheck` 2.12++0.2.5.1 - 2017 Dec 12
chell-quickcheck.cabal view
@@ -1,33 +1,38 @@ name: chell-quickcheck-version: 0.2.5.1+version: 0.2.5.2++synopsis: QuickCheck support for the Chell testing library+category: Testing+ license: MIT license-file: license.txt author: John Millikin <john@john-millikin.com>-maintainer: John Millikin <john@john-millikin.com>+maintainer: Chris Martin, Julie Moronuki build-type: Simple cabal-version: >= 1.6-category: Testing-bug-reports: mailto:jmillikin@gmail.com-homepage: https://john-millikin.com/software/chell/ -synopsis: QuickCheck support for the Chell testing library+homepage: https://github.com/typeclasses/chell+bug-reports: https://github.com/typeclasses/chell/issues -source-repository head- type: git- location: https://john-millikin.com/code/chell/+description:+ QuickCheck support for the <https://hackage.haskell.org/package/chell Chell> testing library. -source-repository this+tested-with: GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.3++extra-source-files:+ changelog.md++source-repository head type: git- location: https://john-millikin.com/code/chell/- tag: chell-quickcheck_0.2.5.1+ location: https://github.com/typeclasses/chell.git library ghc-options: -Wall build-depends: base >= 4.0 && < 5.0- , chell >= 0.3 && < 0.5- , QuickCheck >= 2.3 && < 2.11+ , chell >= 0.3 && < 0.6+ , QuickCheck >= 2.3 && < 2.13 , random exposed-modules: