Safe Haskell | None |
---|---|
Language | Haskell2010 |
Tests for GenValidity instances
You will need TypeApplications
to use these.
Synopsis
- genValiditySpec :: forall a. (Typeable a, Show a, GenValid a, GenInvalid a) => Spec
- genValidSpec :: forall a. (Typeable a, Show a, GenValid a) => Spec
- genInvalidSpec :: forall a. (Typeable a, Show a, GenInvalid a) => Spec
- genValidGeneratesValid :: forall a. (Show a, GenValid a) => Property
- genGeneratesValid :: (Show a, Validity a) => Gen a -> Property
- genInvalidGeneratesInvalid :: forall a. (Show a, GenInvalid a) => Property
- genGeneratesInvalid :: (Show a, Validity a) => Gen a -> Property
Documentation
genValiditySpec :: forall a. (Typeable a, Show a, GenValid a, GenInvalid a) => Spec Source #
A spec for properties of GenValid
and GenInvalid
instances.
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
.
It is not a good idea to use this function if invalid values are broken in such a way that Show
or even isValid
is broken.
In that case you probably want genValidSpec
.
Example usage:
genValiditySpec @Int
genValidSpec :: forall a. (Typeable a, Show a, GenValid a) => Spec Source #
A Spec
that specifies that genValid
only generates valid data.
In general it is a good idea to add this spec to your test suite if you
write a custom implementation of genValid
.
Example usage:
genValidSpec @Int
genInvalidSpec :: forall a. (Typeable a, Show a, GenInvalid a) => Spec Source #
genValidGeneratesValid :: forall a. (Show a, GenValid a) => Property Source #
genValid
only generates valid data
genValidGeneratesValid @()
genValidGeneratesValid @Bool
genValidGeneratesValid @Ordering
genValidGeneratesValid @Char
genValidGeneratesValid @Int
genValidGeneratesValid @Float
genValidGeneratesValid @Double
genValidGeneratesValid @Integer
genValidGeneratesValid @(Maybe Int)
genValidGeneratesValid @[Int]
genGeneratesValid :: (Show a, Validity a) => Gen a -> Property #
The given generator generates only valid data points
genInvalidGeneratesInvalid :: forall a. (Show a, GenInvalid a) => Property Source #
genValid
only generates invalid data
genInvalidGeneratesInvalid @Rational
genInvalidGeneratesInvalid @Rational
genInvalidGeneratesInvalid @(Maybe Rational)
genInvalidGeneratesInvalid @[Rational]