qc-oi-testgenerator-1.2.0.3: Compile time generation of operation invariance tests for QuickCheck

Safe HaskellNone

Test.OITestGenerator.Op

Description

This file should not be imported directly. Import Test.OITestGenerator instead.

Synopsis

Documentation

type Arg = IntSource

data Op Source

An operation. Contains information about the operation's name, which arguments may be tested (all by default), which generators should be used for each argument (arbitrary by default) and possibly a constraint function.

Instances

op :: Name -> OpSource

Op constructor.

arg :: Int -> ArgSource

Arg constructor. Only for readability.

but :: Op -> Arg -> OpSource

but o i excludes the i-th argument from o when generating tests.

Example:

op 'dequeue `but` arg 1

only :: Op -> Arg -> OpSource

only o i excludes all but the i-th argument from o when generating tests.

Example:

op 'dequeue `only` arg 1

withGens :: HasGens a => a -> [Name] -> aSource

Use to specify custom generators for the given operation or axiom. The i-th element of the list corresponds to the i-th argument. All generators must be specified. Not using a custom generator for specific arguments can be achieved by passing arbitrary.

withConstraint :: Op -> Name -> OpSource

op withConstraint f adds a constraint function f to op. f must take arguments of the same type as op and return a Bool.