QuickCheck 2.4.1.1 → 2.4.2
raw patch · 4 files changed
+20/−6 lines, 4 filesdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
+ Test.QuickCheck.All: polyVerboseCheck :: Name -> ExpQ
+ Test.QuickCheck.All: verboseCheckAll :: Q Exp
- Test.QuickCheck: class Arbitrary a
+ Test.QuickCheck: class Arbitrary a where arbitrary = error "no default generator" shrink _ = []
- Test.QuickCheck: ranges :: Integral a => a -> a -> Str
+ Test.QuickCheck: ranges :: (Show a, Integral a) => a -> a -> Str
- Test.QuickCheck.Arbitrary: class Arbitrary a
+ Test.QuickCheck.Arbitrary: class Arbitrary a where arbitrary = error "no default generator" shrink _ = []
- Test.QuickCheck.Text: ranges :: Integral a => a -> a -> Str
+ Test.QuickCheck.Text: ranges :: (Show a, Integral a) => a -> a -> Str
Files
- QuickCheck.cabal +4/−4
- Test/QuickCheck/All.hs +12/−0
- Test/QuickCheck/Test.hs +3/−1
- Test/QuickCheck/Text.hs +1/−1
QuickCheck.cabal view
@@ -1,5 +1,5 @@ Name: QuickCheck-Version: 2.4.1.1+Version: 2.4.2 Cabal-Version: >= 1.6 Build-type: Simple License: BSD3@@ -29,12 +29,12 @@ source-repository head type: darcs- location: http://code.haskell.org/QuickCheck/+ location: http://code.haskell.org/QuickCheck/devel source-repository this type: darcs- location: http://code.haskell.org/QuickCheck- tag: 2.4.1.1+ location: http://code.haskell.org/QuickCheck/stable+ tag: 2.4.2 flag base3 Description: Choose the new smaller, split-up base package.
Test/QuickCheck/All.hs view
@@ -5,9 +5,11 @@ module Test.QuickCheck.All( -- ** Testing all properties in a module. quickCheckAll,+ verboseCheckAll, forAllProperties, -- ** Testing polymorphic properties. polyQuickCheck,+ polyVerboseCheck, mono) where import Language.Haskell.TH@@ -25,6 +27,11 @@ polyQuickCheck :: Name -> ExpQ polyQuickCheck x = [| quickCheck $(mono x) |] +-- | Test a polymorphic property, defaulting all type variables to 'Integer'.+-- This is just a convenience function that combines 'polyQuickCheck' and 'verbose'.+polyVerboseCheck :: Name -> ExpQ+polyVerboseCheck x = [| verboseCheck $(mono x) |]+ type Error = forall a. String -> a -- | Monomorphise an arbitrary name by defaulting all type variables to 'Integer'.@@ -97,6 +104,11 @@ -- and then execute @runTests@. quickCheckAll :: Q Exp quickCheckAll = [| $(forAllProperties) quickCheckResult |]++-- | Test all properties in the current module.+-- This is just a convenience function that combines 'quickCheckAll' and 'verbose'.+verboseCheckAll :: Q Exp+verboseCheckAll = [| $(forAllProperties) verboseCheckResult |] runQuickCheckAll :: [(String, Property)] -> (Property -> IO Result) -> IO Bool runQuickCheckAll ps qc =
Test/QuickCheck/Test.hs view
@@ -110,7 +110,7 @@ , maxDiscardedTests = maxDiscard a , computeSize = case replay a of Nothing -> computeSize'- Just (_,s) -> \_ _ -> s+ Just (_,s) -> computeSize' `at0` s , numSuccessTests = 0 , numDiscardedTests = 0 , collected = []@@ -128,6 +128,8 @@ | otherwise = (n `mod` maxSize a) * maxSize a `div` (maxSuccess a `mod` maxSize a) + d `div` 10 n `roundTo` m = (n `div` m) * m+ at0 f s 0 0 = s+ at0 f s n d = f n d -- | Tests a property and prints the results and all test cases generated to 'stdout'. -- This is just a convenience function that means the same as 'quickCheck' '.' 'verbose'.
Test/QuickCheck/Text.hs view
@@ -40,7 +40,7 @@ instance Show Str where show (MkStr s) = s -ranges :: Integral a => a -> a -> Str+ranges :: (Show a, Integral a) => a -> a -> Str ranges k n = MkStr (show n' ++ " -- " ++ show (n'+k-1)) where n' = k * (n `div` k)