 | QuickCheck-2.1.0.3: Automatic testing of Haskell programs | Contents | Index |
|
|
|
|
|
|
| Synopsis |
|
|
|
|
| Property and Testable types
|
|
| type Property = Gen Prop |
|
| class Testable prop where |
| The class of things which can be tested, i.e. turned into a property.
| | | Methods | | | Instances | |
|
|
| Type Prop
|
|
| newtype Prop |
| Constructors | | Instances | |
|
|
| type Rose
|
|
| data Rose a |
| Constructors | | Instances | |
|
|
| join :: Rose (Rose a) -> Rose a |
|
| protectRose :: Rose (IO Result) -> IO (Rose (IO Result)) |
|
| Result type
|
|
| data Callback |
| Different kinds of callbacks
| | Constructors | |
|
|
| data Result |
| The result of a single test.
| | Constructors | | MkResult | | | ok :: Maybe Bool | result of the test case; Nothing = discard
| | expect :: Bool | indicates what the expected result of the property is
| | reason :: String | a message indicating what went wrong
| | interrupted :: Bool | indicates if the test case was cancelled by pressing ^C
| | stamp :: [(String, Int)] | the collected values for this test case
| | callbacks :: [Callback] | the callbacks for this test case
|
|
| Instances | |
|
|
| result :: Result |
|
| failed :: Result -> Result |
|
| protectResult :: IO Result -> IO Result |
|
| succeeded :: Result |
|
| rejected :: Result |
|
| Lifting and mapping functions
|
|
| 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 |
|
| Property combinators
|
|
| mapSize :: Testable prop => (Int -> Int) -> prop -> Property |
| Changes the maximum test case size for a property.
|
|
| shrinking |
| :: Testable prop | | | => (a -> [a]) | shrink-like function.
| | -> 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 -> Property |
| Disables shrinking for a property altogether.
|
|
| callback :: Testable prop => Callback -> prop -> Property |
| Adds a callback
|
|
| whenFail :: Testable prop => IO () -> prop -> Property |
| Performs an IO action after the last failure of a property.
|
|
| whenFail' :: Testable prop => IO () -> prop -> Property |
| 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 -> Property |
| Modifies a property so that it is expected to fail for some test cases.
|
|
| label :: Testable prop => String -> prop -> Property |
| Attaches a label to a property. This is used for reporting
test case distribution.
|
|
| collect :: (Show a, Testable prop) => a -> prop -> Property |
Labels a property with a value:
collect x = label (show x)
|
|
| classify |
| :: Testable prop | | | => Bool | True if the test case should be labelled.
| | -> String | Label.
| | -> prop | | | -> Property | | | Conditionally labels test case.
|
|
|
| cover |
| :: Testable prop | | | => Bool | True if the test case belongs to the class.
| | -> 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 -> Property |
| Implication for properties: The resulting property holds if
the first argument is False, or if the given property holds.
|
|
| within :: Testable prop => Int -> prop -> Property |
| Considers a property failed if it does not complete within
the given number of microseconds.
|
|
| forAll :: (Show a, Testable prop) => Gen a -> (a -> prop) -> Property |
| Explicit universal quantification: uses an explicitly given
test case generator.
|
|
| forAllShrink :: (Show a, Testable prop) => Gen a -> (a -> [a]) -> (a -> prop) -> Property |
| Like forAll, but tries to shrink the argument for failing test cases.
|
|
| (.&.) :: (Testable prop1, Testable prop2) => prop1 -> prop2 -> Property |
|
| Produced by Haddock version 2.7.2 |