QuickCheck-safe-0.1: Safe reimplementation of QuickCheck's core

Safe HaskellSafe
LanguageHaskell2010

Test.QuickCheck.Safe

Contents

Description

This module implements a simplified, pure version of Test.Quickcheck's quickCheck functionality.

Synopsis

Checking properties

quickCheck :: STestable prop => QCGen -> prop -> String Source

Cf. quickCheck. Note that in contrast to QuickCheck's function, this one takes an additional QCGen argument.

>>> putStr $ quickCheck (inventQCGen ()) (\x -> length (x :: [()]) < 10)
*** Failed! Falsifiable (after 18 tests and 3 shrinks):
[(),(),(),(),(),(),(),(),(),(),(),(),(),(),()]

quickCheckResult :: STestable prop => QCGen -> prop -> Result Source

Cf. quickCheckResult. Note that in contrast to QuickCheck's function, this one takes an additional QCGen argument.

quickCheckWith :: STestable prop => Args -> QCGen -> prop -> String Source

Cf. quickCheckWith. Note that in contrast to QuickCheck's function, this one takes an additional QCGen argument.

quickCheckWithResult :: STestable prop => Args -> QCGen -> prop -> Result Source

Cf. quickCheckWithResult. Note that in contrast to QuickCheck's function, this one takes an additional QCGen argument.

Creating and combining properties

class STestable prop Source

Minimal complete definition

sProperty

Instances

STestable Bool 
STestable prop => STestable (Gen prop) 
(Arbitrary a, Show a, STestable prop) => STestable (a -> prop) 

(==>) :: STestable prop => Bool -> prop -> SProperty Source

Implication. Cf. ==>.

(.||.) :: (STestable prop2, STestable prop1) => prop1 -> prop2 -> SProperty Source

Disjunction. Cf. .||..

(.&&.) :: (STestable prop2, STestable prop1) => prop1 -> prop2 -> SProperty Source

Conjunction. Cf. .&&..

(.&.) :: (STestable prop2, STestable prop1) => prop1 -> prop2 -> SProperty Source

Nondeterministic conjunction. Cf. &..

(===) :: (Eq a, Show a) => a -> a -> SProperty Source

Equality test. Cf. ===.

label :: STestable prop => String -> prop -> SProperty Source

Label tests. Cf. label.

shrinking :: STestable prop => (a -> [a]) -> a -> (a -> prop) -> SProperty Source

Shrink counterexamples. Cf. shrinking.

noShrinking :: STestable prop => prop -> SProperty Source

Suppress shrinking of counterexamples. Cf. noShrinking.

mapSize :: STestable prop => (Int -> Int) -> prop -> SProperty Source

Adjust testcase sizes. Cf. mapSize.

forAll :: (Show a, STestable prop) => Gen a -> (a -> prop) -> SProperty Source

Universal quantification. Cf. forAll.

forAllShrink :: (Show a, STestable prop) => Gen a -> (a -> [a]) -> (a -> prop) -> SProperty Source

Universal quantification with shrinking. Cf. forAllShrink.

Miscellaneous

inventQCGen :: a -> QCGen Source

inventQCGen invokes newQCGen via unsafePerformIO. It is useful in connection with the quickCheck family of functions.