| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.GenValidity.Hspec
Description
These are standard tests that you should add to your hspec test suite
if you implemented GenValidity instances for your own data types.
Use them like this:
mySpec :: Spec
mySpec = do
genspec (proxy :: MyType)
genspec (proxy :: MyOtherType)HSpec will take care of the rest.
- module Data.GenValidity
- proxy :: a
- genspec :: (Show a, Eq a, Data a, GenValidity a, Arbitrary a) => a -> Spec
- arbitrarySpec :: (Typeable a, Show a, Eq a, Data a, GenValidity a, Arbitrary a) => a -> Spec
- validitySpec :: (Typeable a, Show a, Eq a, Data a, GenValidity a, Arbitrary a) => a -> Spec
Documentation
module Data.GenValidity
genspec :: (Show a, Eq a, Data a, GenValidity a, Arbitrary a) => a -> Spec Source #
A combination of arbitrarySpec and validitySpec
Example usage:
genspec (proxy :: MyData)
arbitrarySpec :: (Typeable a, Show a, Eq a, Data a, GenValidity a, Arbitrary a) => a -> Spec Source #
A Spec that specifies that arbitrary only generates data that
satisfy isValid and that shrink only produces data that satisfy
isValid.
Example usage:
arbitrarySpec (proxy :: MyData)
validitySpec :: (Typeable a, Show a, Eq a, Data a, GenValidity a, Arbitrary a) => a -> Spec Source #
A Spec that specifies that genValid only generates valid data and that
genInvalid only generates invalid data.
In general it is a good idea to add this spec to your test suite if you
write a custom implementation of genValid or genInvalid.
Example usage:
validitySpec (proxy :: MyData)