QuickCheck-2.10: Automatic testing of Haskell programs

Safe HaskellSafe
LanguageHaskell98

Test.QuickCheck.Test

Contents

Description

The main test loop.

Synopsis

Running tests

data Args Source #

Args specifies arguments to the QuickCheck driver

Constructors

Args 

Fields

  • replay :: Maybe (QCGen, Int)

    Should we replay a previous test? Note: saving a seed from one version of QuickCheck and replaying it in another is not supported. If you want to store a test case permanently you should save the test case itself.

  • maxSuccess :: Int

    Maximum number of successful tests before succeeding. Testing stops at the first failure. If all tests are passing and you want to run more tests, increase this number.

  • maxDiscardRatio :: Int

    Maximum number of discarded tests per successful test before giving up

  • maxSize :: Int

    Size to use for the biggest test cases

  • chatty :: Bool

    Whether to print anything

  • maxShrinks :: Int

    Maximum number of shrinks to before giving up. Setting this to zero turns shrinking off.

data Result Source #

Result represents the test result

Constructors

Success

A successful test run

Fields

GaveUp

Given up

Fields

Failure

A failed test run

Fields

NoExpectedFailure

A property that should have failed did not

Fields

InsufficientCoverage

The tests passed but a use of cover had insufficient coverage

Fields

Instances

isSuccess :: Result -> Bool Source #

Check if the test run result was a success

stdArgs :: Args Source #

The default test arguments

quickCheck :: Testable prop => prop -> IO () Source #

Tests a property and prints the results to stdout.

By default up to 100 tests are performed, which may not be enough to find all bugs. To run more tests, use withMaxSuccess.

quickCheckWith :: Testable prop => Args -> prop -> IO () Source #

Tests a property, using test arguments, and prints the results to stdout.

quickCheckResult :: Testable prop => prop -> IO Result Source #

Tests a property, produces a test result, and prints the results to stdout.

quickCheckWithResult :: Testable prop => Args -> prop -> IO Result Source #

Tests a property, using test arguments, produces a test result, and prints the results to stdout.

verboseCheck :: Testable prop => prop -> IO () Source #

Tests a property and prints the results and all test cases generated to stdout. This is just a convenience function that means the same as quickCheck . verbose.

verboseCheckWith :: Testable prop => Args -> prop -> IO () Source #

Tests a property, using test arguments, and prints the results and all test cases generated to stdout. This is just a convenience function that combines quickCheckWith and verbose.

verboseCheckResult :: Testable prop => prop -> IO Result Source #

Tests a property, produces a test result, and prints the results and all test cases generated to stdout. This is just a convenience function that combines quickCheckResult and verbose.

verboseCheckWithResult :: Testable prop => Args -> prop -> IO Result Source #

Tests a property, using test arguments, produces a test result, and prints the results and all test cases generated to stdout. This is just a convenience function that combines quickCheckWithResult and verbose.

test :: State -> (QCGen -> Int -> Prop) -> IO Result Source #