QuickCheck 2.1.0.3 → 2.1.1
raw patch · 5 files changed
+59/−5 lines, 5 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
+ Test.QuickCheck.Arbitrary: instance (RealFloat a, Arbitrary a) => Arbitrary (Complex a)
+ Test.QuickCheck.Arbitrary: instance (RealFloat a, CoArbitrary a) => CoArbitrary (Complex a)
Files
- QuickCheck.cabal +10/−3
- README +26/−0
- Test/QuickCheck/Arbitrary.hs +11/−0
- Test/QuickCheck/Exception.hs +11/−1
- Test/QuickCheck/Test.hs +1/−1
QuickCheck.cabal view
@@ -1,13 +1,14 @@ Name: QuickCheck-Version: 2.1.0.3+Version: 2.1.1 Cabal-Version: >= 1.2 Build-type: Simple License: BSD3 License-file: LICENSE+Extra-source-files: README Copyright: Koen Claessen <koen@chalmers.se> Author: Koen Claessen <koen@chalmers.se> Maintainer: QuickCheck developers <quickcheck@projects.haskell.org>-Homepage: http://www.cs.chalmers.se/~koen+Homepage: http://www.cse.chalmers.se/~koen Category: Testing Synopsis: Automatic testing of Haskell programs Description:@@ -30,6 +31,9 @@ flag extensibleExceptions Description: Choose the even newer, even smaller, split-up base package. +flag ghciInterruptedException+ Description: Use the ghc package to get access to GhcException(Interrupted).+ library Build-depends: mtl if flag(extensibleExceptions)@@ -40,7 +44,10 @@ else Build-depends: base < 3 if impl(ghc >= 6.7)- Build-depends: ghc+ if flag(ghciInterruptedException)+ Build-depends: base < 4.3, ghc+ else+ Build-depends: base >= 4.3 if impl(ghc >= 6.9) Build-depends: extensible-exceptions Exposed-Modules:
+ README view
@@ -0,0 +1,26 @@+This is QuickCheck 2.1.1, a library for random testing of program properties.++=== Installation ===++Installation is done with Cabal:++$ cabal install++or, if you're missing the cabal command,++$ runghc Setup.lhs configure+$ runghc Setup.lhs build+$ runghc Setup.lhs install++=== Bugs ===++Please report bugs to the QuickCheck mailing list at+quickcheck@projects.haskell.org.++=== Documentation ===++$ runghc Setup.lhs haddock++generates API documentation in dist/doc/html/index.html++
Test/QuickCheck/Arbitrary.hs view
@@ -56,6 +56,9 @@ , denominator ) +import Data.Complex+ ( Complex((:+)) )+ import System.Random ( Random )@@ -155,6 +158,11 @@ arbitrary = arbitrarySizedFractional shrink = shrinkRealFrac +instance (RealFloat a, Arbitrary a) => Arbitrary (Complex a) where+ arbitrary = liftM2 (:+) arbitrary arbitrary+ shrink (x :+ y) = [ x' :+ y | x' <- shrink x ] +++ [ x :+ y' | y' <- shrink y ]+ instance (Arbitrary a, Arbitrary b) => Arbitrary (a,b) where@@ -367,6 +375,9 @@ instance (Integral a, CoArbitrary a) => CoArbitrary (Ratio a) where coarbitrary r = coarbitrary (numerator r,denominator r)++instance (RealFloat a, CoArbitrary a) => CoArbitrary (Complex a) where+ coarbitrary (x :+ y) = coarbitrary x >< coarbitrary y instance (CoArbitrary a, CoArbitrary b) => CoArbitrary (a,b)
Test/QuickCheck/Exception.hs view
@@ -7,7 +7,13 @@ #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 607 #define GHC_INTERRUPT++#if defined(MIN_VERSION_base)+#if !(MIN_VERSION_base(4,3,0))+#define GHCI_INTERRUPTED_EXCEPTION #endif+#endif+#endif #if defined OLD_EXCEPTIONS import Control.Exception(evaluate, try, Exception(..))@@ -20,7 +26,9 @@ #endif #if defined(GHC_INTERRUPT)+#if defined(GHCI_INTERRUPTED_EXCEPTION) import Panic(GhcException(Interrupted))+#endif import Data.Typeable #if defined(OLD_EXCEPTIONS) import Data.Dynamic@@ -51,9 +59,11 @@ #if defined(OLD_EXCEPTIONS) isInterrupt (DynException e) = fromDynamic e == Just Interrupted isInterrupt _ = False-#else+#elif defined(GHCI_INTERRUPTED_EXCEPTION) isInterrupt (SomeException e) = cast e == Just Interrupted || cast e == Just UserInterrupt+#else+isInterrupt (SomeException e) = cast e == Just UserInterrupt #endif #else /* !defined(GHC_INTERRUPT) */
Test/QuickCheck/Test.hs view
@@ -282,8 +282,8 @@ do localMin st{ numTryShrinks = 0, isShrinking = True } res ts localMin :: State -> P.Result -> [Rose (IO P.Result)] -> IO ()-localMin st res [] = localMinFound st res localMin st res _ | P.interrupted res = localMinFound st res+localMin st res [] = localMinFound st res localMin st res (t : ts) = do -- CALLBACK before_test