smallcheck-0.6.2: A property-based testing library

MaintainerRoman Cheplyaka <roma@ro-che.info>
Safe HaskellSafe-Inferred

Test.SmallCheck.Drivers

Description

Functions to run SmallCheck tests.

Synopsis

Documentation

smallCheck :: Testable a => Depth -> a -> IO ()Source

Run series of tests using depth bounds 0..d, stopping if any test fails, and print a summary report or a counter-example.

smallCheckI :: Testable a => a -> IO ()Source

Interactive variant, asking the user whether testing should continue/go deeper after a failure/completed iteration.

Example session:

haskell> smallCheckI prop_append1
Depth 0:
  Completed 1 test(s) without failure.
  Deeper? y
Depth 1:
  Failed test no. 5. Test values follow.
  [True]
  [True]
  Continue? n
  Deeper? n
haskell>

depthCheck :: Testable a => Depth -> a -> IO ()Source

Same as smallCheck, but test for values of depth d only

smallCheckPure :: Testable a => Depth -> a -> Either [String] (Integer, Integer)Source

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.