License | BSD-style |
---|---|
Maintainer | Foundation maintainers |
Safe Haskell | None |
Language | Haskell2010 |
An implementation of a test framework and property expression & testing
- data Gen a
- class Arbitrary a where
- oneof :: NonEmpty [Gen a] -> Gen a
- elements :: NonEmpty [a] -> Gen a
- frequency :: NonEmpty [(Word, Gen a)] -> Gen a
- between :: (Word, Word) -> Gen Word
- data Test where
- testName :: Test -> String
- data PropertyCheck
- data Property = Prop {}
- class IsProperty p where
- (===) :: (Show a, Eq a, Typeable a) => a -> a -> PropertyCheck
- propertyCompare :: (Show a, Typeable a) => String -> (a -> a -> Bool) -> a -> a -> PropertyCheck
- propertyAnd :: PropertyCheck -> PropertyCheck -> PropertyCheck
- propertyFail :: String -> PropertyCheck
- forAll :: (Show a, IsProperty prop) => Gen a -> (a -> prop) -> Property
- data Check a
- validate :: IsProperty prop => String -> prop -> Check ()
- pick :: String -> IO a -> Check a
- iterateProperty :: CountOf TestResult -> GenParams -> (Word64 -> GenRng) -> Property -> IO (PropertyResult, CountOf TestResult)
Documentation
class Arbitrary a where Source #
How to generate an arbitrary value for a
different type of tests supported
Property
data PropertyCheck Source #
The type of check this test did for a property
class IsProperty p where Source #
IsProperty Bool Source # | |
IsProperty Property Source # | |
IsProperty PropertyCheck Source # | |
(Show a, Arbitrary a, IsProperty prop) => IsProperty (a -> prop) Source # | |
IsProperty (String, Bool) Source # | |
(===) :: (Show a, Eq a, Typeable a) => a -> a -> PropertyCheck infix 4 Source #
A property that check for equality of its 2 members.
:: (Show a, Typeable a) | |
=> String | name of the function used for comparaison, e.g. (<) |
-> (a -> a -> Bool) | function used for value comparaison |
-> a | value left of the operator |
-> a | value right of the operator |
-> PropertyCheck |
propertyAnd :: PropertyCheck -> PropertyCheck -> PropertyCheck Source #
A conjuctive property composed of 2 properties that need to pass
propertyFail :: String -> PropertyCheck Source #
forAll :: (Show a, IsProperty prop) => Gen a -> (a -> prop) -> Property Source #
Running a generator for a specific type under a property