QuickCheckVariant-1.0.0.1: Generator of "valid" and "invalid" data in a type class

Copyright(c) Jorge Santiago Alvarez Cuadros 2015
LicenseGPL-3
Maintainersanjorgek@ciencias.unam.mx
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell98

Test.QuickCheck.Variant

Description

To get random "invalid" and "valid" data

Synopsis

Documentation

class Variant a where Source #

You can define

>>> instance (Variant a) => Arbitrary a where {arbitrary = oneof [valid, invalid]}

Minimal complete definition

valid, invalid

Methods

valid :: Gen a Source #

Get a generator of valid random data type

invalid :: Gen a Source #

Get a generator of invalid random data type

class VarTestable prop where Source #

The class of things wich can be tested with invalid or valid input.

Minimal complete definition

propertyValid, propertyInvalid

Methods

propertyValid :: prop -> Property Source #

Property for valid input

propertyInvalid :: prop -> Property Source #

Property for invalid input

Instances

VarTestable Bool Source #

Same as Testeable

(Arbitrary a, Variant a, Show a, VarTestable prop) => VarTestable (a -> prop) Source #

Instead of variant we use valid or invalid generators

Methods

propertyValid :: (a -> prop) -> Property Source #

propertyInvalid :: (a -> prop) -> Property Source #

mapPropValid :: VarTestable prop => (Prop -> Prop) -> prop -> Property Source #

callbackValid :: VarTestable prop => Callback -> prop -> Property Source #

Adds a callback

counterexampleValid :: VarTestable prop => String -> prop -> Property Source #

Adds the given string to the counterexample if the property fails.

forAllShrinkValid :: (Show a, VarTestable prop) => Gen a -> (a -> [a]) -> (a -> prop) -> Property Source #

Like forAll, but tries to shrink the argument for failing test cases.

mapPropInvalid :: VarTestable prop => (Prop -> Prop) -> prop -> Property Source #

callbackInvalid :: VarTestable prop => Callback -> prop -> Property Source #

Adds a callback

counterexampleInvalid :: VarTestable prop => String -> prop -> Property Source #

Adds the given string to the counterexample if the property fails.

forAllShrinkInvalid :: (Show a, VarTestable prop) => Gen a -> (a -> [a]) -> (a -> prop) -> Property Source #

Like forAll, but tries to shrink the argument for failing test cases.