skeletest
Safe HaskellNone
LanguageGHC2021

Skeletest.Prop

Synopsis

Settings

Coverage

classify :: HasCallStack => String -> Bool -> Property Source #

Record the propotion of tests which satisfy a given condition

xs <- forAll $ Gen.list (Range.linear 0 100) $ Gen.int (Range.linear 0 100)
for_ xs $ x -> do
  classify "newborns" $ x == 0
  classify "children" $ x > 0 && x < 13
  classify "teens" $ x > 12 && x < 20

cover :: HasCallStack => Double -> String -> Bool -> Property Source #

Require a certain percentage of the tests to be covered by the classifier.

In the following example, if the condition does not have at least 30% coverage, the test will fail.

match <- forAll Gen.bool
cover 30 "true" $ match
cover 30 "false" $ not match

label :: HasCallStack => String -> Property Source #

Add a label for each test run. It produces a table showing the percentage of test runs that produced each label.

collect :: (Show a, HasCallStack) => a -> Property Source #

Like label, but uses Show to render its argument for display.