- type Property = Gen Prop
- class Testable prop where
- newtype Prop = MkProp {}
- data Rose a = MkRose a [Rose a]
- join :: Rose (Rose a) -> Rose a
- protectRose :: Rose (IO Result) -> IO (Rose (IO Result))
- data Callback
- data Result = MkResult {}
- result :: Result
- failed :: Result -> Result
- protectResult :: IO Result -> IO Result
- succeeded :: Result
- rejected :: Result
- liftBool :: Bool -> Property
- liftResult :: Result -> Property
- liftIOResult :: IO Result -> Property
- liftRoseIOResult :: Rose (IO Result) -> Property
- mapResult :: Testable prop => (Result -> Result) -> prop -> Property
- mapIOResult :: Testable prop => (IO Result -> IO Result) -> prop -> Property
- mapRoseIOResult :: Testable prop => (Rose (IO Result) -> Rose (IO Result)) -> prop -> Property
- mapProp :: Testable prop => (Prop -> Prop) -> prop -> Property
- mapSize :: Testable prop => (Int -> Int) -> prop -> Property
- shrinking :: Testable prop => (a -> [a]) -> a -> (a -> prop) -> Property
- noShrinking :: Testable prop => prop -> Property
- callback :: Testable prop => Callback -> prop -> Property
- whenFail :: Testable prop => IO () -> prop -> Property
- whenFail' :: Testable prop => IO () -> prop -> Property
- expectFailure :: Testable prop => prop -> Property
- label :: Testable prop => String -> prop -> Property
- collect :: (Show a, Testable prop) => a -> prop -> Property
- classify :: Testable prop => Bool -> String -> prop -> Property
- cover :: Testable prop => Bool -> Int -> String -> prop -> Property
- (==>) :: Testable prop => Bool -> prop -> Property
- within :: Testable prop => Int -> prop -> Property
- forAll :: (Show a, Testable prop) => Gen a -> (a -> prop) -> Property
- forAllShrink :: (Show a, Testable prop) => Gen a -> (a -> [a]) -> (a -> prop) -> Property
- (.&.) :: (Testable prop1, Testable prop2) => prop1 -> prop2 -> Property
Property and Testable types
class Testable prop whereSource
The class of things which can be tested, i.e. turned into a property.
Type Prop
type Rose
Result type
Different kinds of callbacks
The result of a single test.
MkResult | |
|
Lifting and mapping functions
liftResult :: Result -> PropertySource
liftIOResult :: IO Result -> PropertySource
mapRoseIOResult :: Testable prop => (Rose (IO Result) -> Rose (IO Result)) -> prop -> PropertySource
Property combinators
mapSize :: Testable prop => (Int -> Int) -> prop -> PropertySource
Changes the maximum test case size for a property.
:: Testable prop | |
=> (a -> [a]) |
|
-> a | The original argument |
-> (a -> prop) | |
-> Property |
Shrinks the argument to property if it fails. Shrinking is done automatically for most types. This is only needed weh you want to override the default behavior.
noShrinking :: Testable prop => prop -> PropertySource
Disables shrinking for a property altogether.
whenFail :: Testable prop => IO () -> prop -> PropertySource
Performs an IO
action after the last failure of a property.
whenFail' :: Testable prop => IO () -> prop -> PropertySource
Performs an IO
action every time a property fails. Thus,
if shrinking is done, this can be used to keep track of the
failures along the way.
expectFailure :: Testable prop => prop -> PropertySource
Modifies a property so that it is expected to fail for some test cases.
label :: Testable prop => String -> prop -> PropertySource
Attaches a label to a property. This is used for reporting test case distribution.
collect :: (Show a, Testable prop) => a -> prop -> PropertySource
Labels a property with a value:
collect x = label (show x)
:: Testable prop | |
=> Bool |
|
-> String | Label. |
-> prop | |
-> Property |
Conditionally labels test case.
:: Testable prop | |
=> Bool |
|
-> Int | The required percentage (0-100) of test cases. |
-> String | Label for the test case class. |
-> prop | |
-> Property |
Checks that at least the given proportion of the test cases belong to the given class.
(==>) :: Testable prop => Bool -> prop -> PropertySource
Implication for properties: The resulting property holds if
the first argument is False
, or if the given property holds.
within :: Testable prop => Int -> prop -> PropertySource
Considers a property failed if it does not complete within the given number of microseconds.
forAll :: (Show a, Testable prop) => Gen a -> (a -> prop) -> PropertySource
Explicit universal quantification: uses an explicitly given test case generator.