quickcheck-state-machine-0.0.0: Test monadic programs using state machine based models

Copyright(C) 2017 ATS Advanced Telematic Systems GmbH
LicenseBSD-style (see the file LICENSE)
MaintainerStevan Andjelkovic <stevan@advancedtelematic.com>
Stabilityprovisional
Portabilitynon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Test.StateMachine

Contents

Description

The main module for state machine based testing.

Synopsis

Sequential property helper

sequentialProperty Source #

Arguments

:: CommandConstraint ix cmd 
=> Monad m 
=> Show (model ConstIntRef) 
=> StateMachineModel model cmd

Model

-> Gen (Untyped cmd (RefPlaceholder ix))

Generator

-> (forall resp refs'. Shrinker (cmd refs' resp))

Shrinker

-> (forall resp. cmd refs resp -> m (Response_ refs resp))

Semantics

-> (m Property -> Property) 
-> Property 

This function builds a property that tests if your model is agrees with your semantics when running commands sequentially.

sequentialProperty' Source #

Arguments

:: CommandConstraint ix cmd 
=> Show (model ConstIntRef) 
=> Monad m 
=> StateMachineModel model cmd

Model

-> StateT s Gen (Untyped cmd (RefPlaceholder ix))

Generator

-> s

Generator state

-> (forall resp refs'. Shrinker (cmd refs' resp))

Shrinker

-> (forall resp. model ConstIntRef -> MayResponse_ ConstIntRef resp -> cmd refs resp -> m (Response_ refs resp))

Semantics

-> (m Property -> Property) 
-> Property 

Same as above, except it provides more flexibility.

Parallel property helper

parallelProperty Source #

Arguments

:: CommandConstraint ix cmd 
=> StateMachineModel model cmd

Model

-> Gen (Untyped cmd (RefPlaceholder ix))

Generator

-> (forall resp refs'. Shrinker (cmd refs' resp))

Shrinker

-> (forall resp. cmd refs resp -> IO (Response_ refs resp))

Semantics

-> Property 

This function builds a property that tests your semantics for race conditions, by runnings commands in parallel and then trying to linearise the resulting history.

Note: Make sure that your model passes the sequential property first.

parallelProperty' Source #

Arguments

:: CommandConstraint ix cmd 
=> StateMachineModel model cmd

Model

-> StateT genState Gen (Untyped cmd (RefPlaceholder ix))

Generator

-> genState 
-> (forall resp refs'. Shrinker (cmd refs' resp))

Shrinker

-> (forall resp. cmd refs resp -> IO (Response_ refs resp))

Semantics

-> IO ()

Cleanup

-> Property