Safe Haskell | None |
---|---|
Language | GHC2021 |
Skeletest.Prop
Synopsis
- setDiscardLimit :: Int -> Property
- setShrinkLimit :: Int -> Property
- setShrinkRetries :: Int -> Property
- setConfidence :: Int -> Property
- setVerifiedTermination :: Property
- setTestLimit :: Int -> Property
- classify :: HasCallStack => String -> Bool -> Property
- cover :: HasCallStack => Double -> String -> Bool -> Property
- label :: HasCallStack => String -> Property
- collect :: (Show a, HasCallStack) => a -> Property
Settings
setDiscardLimit :: Int -> Property Source #
setShrinkLimit :: Int -> Property Source #
setShrinkRetries :: Int -> Property Source #
setConfidence :: Int -> Property Source #
setTestLimit :: Int -> Property Source #
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