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

Safe HaskellNone



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



data Axiom Source


axiom :: Name -> AxiomSource

Axiom constructor. Takes a Name, i.e.

axiom 'q1


map axiom ['q1, 'q2, 'q3]


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.

(=!=) :: a -> a -> AxiomResult aSource

Combine the results of the left- and right-hand sides of an axiom. A simple example is

q1 :: AxiomResult Bool
q1 = isEmpty empty =!= True

while an axiom with variables would be written as a function like this:

q2 :: Int -> IntQueue -> AxiomResult Bool
q2 x q = isEmpty (enqueue x q) =!= False

(===>) :: Bool -> AxiomResult a -> AxiomResult aSource

Adds a condition to an axiom. If the Bool argument is False, the axiom won't be evaluated. The test will neither count as a failed test, nor as a successful test. It translates to the QuickCheck operator ==>.

Example usage:

q4 :: Int -> IntQueue -> AxiomResult Int
q4 x q = not (isEmpty q) ===> front (enqueue x q) =!= front q