QuickCheck 1.1.0.0 → 1.2.0.0
raw patch · 4 files changed
+40/−4 lines, 4 filesnew-uploaderPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- QuickCheck.cabal +2/−2
- Test/QuickCheck.hs +7/−2
- Test/QuickCheck/Batch.hs +23/−0
- prologue.txt +8/−0
QuickCheck.cabal view
@@ -1,5 +1,5 @@ name: QuickCheck-version: 1.1.0.0+version: 1.2.0.0 license: BSD3 license-file: LICENSE author: Koen Classen and John Hughes@@ -33,7 +33,7 @@ Test.QuickCheck.Utils, Test.QuickCheck if flag(split-base)- build-depends: base >= 3, random+ build-depends: base >= 3 && < 4, random else build-depends: base < 3 extensions: CPP
Test/QuickCheck.hs view
@@ -96,9 +96,14 @@ promote f = Gen (\n r -> \a -> let Gen m = f a in m n r) variant :: Int -> Gen a -> Gen a-variant v (Gen m) = Gen (\n r -> m n (rands r !! (v+1)))+variant v (Gen m) = Gen (\n r -> m n (rands r v)) where- rands r0 = r1 : rands r2 where (r1, r2) = split r0+ rands r0 0 = r0+ rands r0 n = let (r1,r2) = split r0+ (n',s) = n `quotRem` 2+ in case s of+ 0 -> rands r1 n'+ _ -> rands r2 n' generate :: Int -> StdGen -> Gen a -> a generate n rnd (Gen m) = m size rnd'
Test/QuickCheck/Batch.hs view
@@ -77,6 +77,10 @@ - -} +#if defined(__NHC__) && __NHC__ > 120+#define BASE4 1+#endif+ module Test.QuickCheck.Batch ( run -- :: Testable a => a -> TestOptions -> IO TestResult , runTests -- :: String -> TestOptions -> @@ -95,7 +99,11 @@ import Control.Concurrent #endif import Control.Exception hiding (catch, evaluate)+#if BASE4+import qualified Control.Exception as Exception+#else import qualified Control.Exception as Exception (catch, evaluate)+#endif import Test.QuickCheck import System.IO.Unsafe @@ -116,7 +124,11 @@ data TestResult = TestOk String Int [[String]] | TestExausted String Int [[String]] | TestFailed [String] Int+#if BASE4+ | TestAborted SomeException+#else | TestAborted Exception+#endif tests :: Config -> Gen Result -> StdGen -> Int -> Int -> [[String]] -> IO TestResult@@ -163,7 +175,13 @@ takeMVar ready throwTo me NonTermination return ())+#if BASE4+ (\ e -> case e of+ Exception.ThreadKilled -> return ()+ _ -> throw e))+#else (\ _ -> return ()))+#endif -- Tell the watcher we are starting... putMVar ready () -- This is cheating, because possibly some of the internal message@@ -242,5 +260,10 @@ isBottom a = unsafePerformIO (do a' <- try (Exception.evaluate a) case a' of+#if BASE4+ Left e -> let _ = e :: SomeException -- XXX Euch, want pattern sigs+ in return True+#else Left _ -> return True+#endif Right _ -> return False)
+ prologue.txt view
@@ -0,0 +1,8 @@+A library for testing Haskell programs automatically. The programmer provides a+specification of the program, in the form of properties which functions should+satisfy, and QuickCheck then tests that the properties hold in a large number of+randomly generated cases. Specifications are expressed in Haskell, using+combinators defined in the QuickCheck library. QuickCheck provides combinators+to define properties, observe the distribution of test data, and define test+data generators. For more information, please see:+<http://www.math.chalmers.se/~rjmh/QuickCheck/>.