packages feed

smallcheck 0.6.1 → 0.6.2

raw patch · 4 files changed

+27/−3 lines, 4 files

Files

CHANGES.md view
@@ -1,6 +1,11 @@ Changes ======= +Version 0.6.2+-----------+* Derive Typeable Property instance+* Add smallCheckPure+ Version 0.6.1 ----------- 
Test/SmallCheck/Drivers.hs view
@@ -8,7 +8,7 @@ -- Functions to run SmallCheck tests. -------------------------------------------------------------------- module Test.SmallCheck.Drivers (-  smallCheck, smallCheckI, depthCheck+  smallCheck, smallCheckI, depthCheck, smallCheckPure   ) where  import System.IO (stdout, hFlush)@@ -89,3 +89,19 @@              hFlush stdout )   where   n' = show n++-- | A pure analog of 'smallCheck'.+--+-- If a counterexample is found, it is returned.+--+-- Otherwise, a tuple of two numbers is returned, where the first number is the+-- number of all test cases, and the second number is the number of test cases+-- that did not satisfy the precondition.+smallCheckPure :: Testable a => Depth -> a -> Either [String] (Integer, Integer)+smallCheckPure d a = (foldr step Right $ concatMap (test a) [0..d]) (0,0)+  where+    step testRes rest (n, x) = n `seq` x `seq`+      case result testRes of+        Fail -> Left $ arguments testRes+        Pass ->          rest (n+1, x)+        Inappropriate -> rest (n+1, x+1)
Test/SmallCheck/Property.hs view
@@ -7,6 +7,7 @@ -- -- Properties and tools to construct them. --------------------------------------------------------------------+{-# LANGUAGE DeriveDataTypeable #-} module Test.SmallCheck.Property (   -- * Basic definitions   TestCase(..),@@ -29,6 +30,7 @@   ) where  import Test.SmallCheck.Series+import Data.Typeable  data TestResult     = Pass@@ -40,6 +42,7 @@  -- | Wrapper type for 'Testable's newtype Property = Property (Depth -> [TestCase])+  deriving Typeable  -- | Wrap a 'Testable' into a 'Property' property :: Testable a => a -> Property
smallcheck.cabal view
@@ -1,5 +1,5 @@ Name:          smallcheck-Version:       0.6.1+Version:       0.6.2 Cabal-Version: >= 1.6 License:       BSD3 License-File:  LICENSE@@ -39,7 +39,7 @@ Source-repository this   type:     git   location: git://github.com/feuerbach/smallcheck.git-  tag:      v0.6.1+  tag:      v0.6.2  Library