quickcheck-state-machine-0.1.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.Internal.Sequential

Description

This module contains helpers for generating, shrinking, and checking sequential programs.

Synopsis

Documentation

generateProgram Source #

Arguments

:: Generator model act 
-> Precondition model act 
-> Transition model act 
-> Int

Name supply for symbolic variables.

-> StateT (model Symbolic) Gen (Program act) 

Generate programs whose actions all respect their pre-conditions.

filterInvalid Source #

Arguments

:: HFoldable act 
=> Precondition model act 
-> Transition model act 
-> Program act 
-> State (model Symbolic, Set Var) (Program act)

Where Set Var is the scope.

Filter out invalid actions from a program. An action is invalid if either its pre-condition doesn't hold, or it uses references that are not in scope.

getUsedVars :: HFoldable act => act Symbolic a -> Set Var Source #

Returns the set of references an action uses.

liftShrinkInternal :: Shrinker act -> Internal act -> [Internal act] Source #

Given a shrinker of typed actions we can lift it to a shrinker of internal actions.

shrinkProgram Source #

Arguments

:: HFoldable act 
=> Shrinker act 
-> Precondition model act 
-> Transition model act 
-> model Symbolic 
-> Program act

Program to shrink.

-> [Program act] 

Shrink a program in a pre-condition and scope respecting way.

checkProgram Source #

Arguments

:: Monad m 
=> HFunctor act 
=> Precondition model act 
-> Transition model act 
-> Postcondition model act 
-> model Symbolic

The model with symbolic references is used to check pre-conditions against.

-> model Concrete

While the one with concrete referenes is used for checking post-conditions.

-> Semantics act m 
-> Program act 
-> PropertyM (StateT Environment m) () 

For each action in a program, check that if the pre-condition holds for the action, then so does the post-condition.