QuickCheck-2.9.2: Automatic testing of Haskell programs

Safe HaskellSafe
LanguageHaskell98

Test.QuickCheck.Test

Contents

Description

The main test loop.

Synopsis

Running tests

data Args #

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

  • 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

Instances

Read Args # 

Methods

readsPrec :: Int -> ReadS Args

readList :: ReadS [Args]

readPrec :: ReadPrec Args

readListPrec :: ReadPrec [Args]

Show Args # 

Methods

showsPrec :: Int -> Args -> ShowS

show :: Args -> String

showList :: [Args] -> ShowS

data Result #

Result represents the test result

Constructors

Success

A successful test run

Fields

  • numTests :: Int

    Number of tests performed

  • labels :: [(String, Int)]

    Labels and frequencies found during all successful tests

  • output :: String

    Printed output

GaveUp

Given up

Fields

  • numTests :: Int

    Number of tests performed

  • labels :: [(String, Int)]

    Labels and frequencies found during all successful tests

  • output :: String

    Printed output

Failure

A failed test run

Fields

  • numTests :: Int

    Number of tests performed

  • numShrinks :: Int

    Number of successful shrinking steps performed

  • numShrinkTries :: Int

    Number of unsuccessful shrinking steps performed

  • numShrinkFinal :: Int

    Number of unsuccessful shrinking steps performed since last successful shrink

  • usedSeed :: QCGen

    What seed was used

  • usedSize :: Int

    What was the test size

  • reason :: String

    Why did the property fail

  • theException :: Maybe AnException

    The exception the property threw, if any

  • labels :: [(String, Int)]

    Labels and frequencies found during all successful tests

  • output :: String

    Printed output

NoExpectedFailure

A property that should have failed did not

Fields

  • numTests :: Int

    Number of tests performed

  • labels :: [(String, Int)]

    Labels and frequencies found during all successful tests

  • output :: String

    Printed output

InsufficientCoverage

The tests passed but a use of cover had insufficient coverage

Fields

  • numTests :: Int

    Number of tests performed

  • labels :: [(String, Int)]

    Labels and frequencies found during all successful tests

  • output :: String

    Printed output

Instances

Show Result # 

Methods

showsPrec :: Int -> Result -> ShowS

show :: Result -> String

showList :: [Result] -> ShowS

isSuccess :: Result -> Bool #

Check if the test run result was a success

stdArgs :: Args #

The default test arguments

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

Tests a property and prints the results to stdout.

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

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

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

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

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

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

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

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 () #

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 #

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 #

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 #

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

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

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

summary :: State -> [(String, Int)] #

success :: State -> IO () #

labelPercentage :: String -> State -> Int #

foundFailure :: State -> Result -> [Rose Result] -> IO (Int, Int, Int) #

localMin :: State -> Result -> Result -> [Rose Result] -> IO (Int, Int, Int) #

localMin' :: State -> Result -> [Rose Result] -> IO (Int, Int, Int) #

localMinFound :: State -> Result -> IO (Int, Int, Int) #