genvalidity-hspec-1.0.0.3: Standard spec's for GenValidity instances

Safe Haskell | Safe-Inferred
Language | Haskell2010

Test.Validity.GenValidity

Description

Tests for GenValidity instances

You will need `TypeApplications` to use these.

Synopsis

- genValidSpec :: forall a. (Typeable a, Show a, GenValid a) => Spec
- genValidGeneratesValid :: forall a. (Show a, GenValid a) => Property
- genGeneratesValid :: (Show a, Validity a) => Gen a -> Property
- genGeneratesInvalid :: (Show a, Validity a) => Gen a -> Property

# Documentation

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

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 Source #

The given generator generates only valid data points

genGeneratesInvalid :: (Show a, Validity a) => Gen a -> Property Source #

The given generator generates only invalid data points