Community
Modules 18

Test.QuickCheck.Features

features :: [String] -> Set String -> Set String

labelledExamples :: Testable prop => prop -> IO ()

Given a property, which must use label, collect, classify or cover to associate labels with test cases, find an example test case for each possible label. The example test cases are minimised using shrinking.

For example, suppose we test delete x xs and record the number of times that x occurs in xs:

prop_delete :: Int -> [Int] -> Property
prop_delete x xs =
  classify (count x xs == 0) "count x xs == 0" $
  classify (count x xs == 1) "count x xs == 1" $
  classify (count x xs >= 2) "count x xs >= 2" $
  counterexample (show (delete x xs)) $
  count x (delete x xs) == max 0 (count x xs-1)
  where count x xs = length (filter (== x) xs)

labelledExamples generates three example test cases, one for each label:


labelledExamplesWith :: Testable prop => Args -> prop -> IO ()

A variant of labelledExamples that takes test arguments.

labelledExamplesResult :: Testable prop => prop -> IO Result

A variant of labelledExamples that returns a result.

labelledExamplesWithResult :: Testable prop => Args -> prop -> IO Result

A variant of labelledExamples that takes test arguments and returns a result.

Build record and source files

Community contribution. The service has not verified this documentation. The generator reported 30 diagnostics.

Target: Linux on x86-64. Some inferred types and resolved links are not available.

Generator: aihc-haddock-aa6debbd-web-3

Metadata snapshot: f17ab6aeb2a7b6daf9fba7614097e138beeef85fa92c3fb7fdfed9ed0e49728c

Open the dependency plan · Download the documentation model

Import a package

Enter a package name and an exact version from Hackage. The site contains imported versions only.