| License | BSD-style |
|---|---|
| Maintainer | Foundation maintainers |
| Safe Haskell | None |
| Language | Haskell2010 |
Foundation.Check
Contents
Description
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
How to generate an arbitrary value for a
Instances
| Arbitrary Bool | |
| Arbitrary Char | |
| Arbitrary Double | |
| Arbitrary Float | |
| Arbitrary Int | |
| Arbitrary Int8 | |
| Arbitrary Int16 | |
| Arbitrary Int32 | |
| Arbitrary Int64 | |
| Arbitrary Integer | |
| Arbitrary Word | |
| Arbitrary Word8 | |
| Arbitrary Word16 | |
| Arbitrary Word32 | |
| Arbitrary Word64 | |
| Arbitrary Natural | |
| Arbitrary String | |
| Arbitrary a => Arbitrary (Maybe a) | |
| Arbitrary (CountOf ty) | |
| (Arbitrary l, Arbitrary r) => Arbitrary (Either l r) | |
| (Arbitrary a, Arbitrary b) => Arbitrary (a, b) | |
| (Arbitrary a, Arbitrary b, Arbitrary c) => Arbitrary (a, b, c) | |
| (Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d) => Arbitrary (a, b, c, d) | |
| (Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d, Arbitrary e) => Arbitrary (a, b, c, d, e) | |
| (Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d, Arbitrary e, Arbitrary f) => Arbitrary (a, b, c, d, e, f) |
data Test where
different type of tests supported
Property
class IsProperty p where
Instances
| IsProperty Bool | |
| IsProperty Property | |
| IsProperty PropertyCheck | |
| (Show a, Arbitrary a, IsProperty prop) => IsProperty (a -> prop) | |
| IsProperty (String, Bool) |
(===) :: (Show a, Eq a, Typeable a) => a -> a -> PropertyCheck infix 4
A property that check for equality of its 2 members.
Arguments
| :: (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
A conjuctive property composed of 2 properties that need to pass
propertyFail :: String -> PropertyCheck
forAll :: (Show a, IsProperty prop) => Gen a -> (a -> prop) -> Property
Running a generator for a specific type under a property
Check Plan
validate :: IsProperty prop => String -> prop -> Check ()