quickcheck-state-machine-0.7.3: Test monadic programs using state machine based models
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.StateMachine.Lockstep.Simple

Synopsis

Test type-level parameters

type family MockState t :: Type Source #

Mock state

The t argument (here and elsewhere) is a type-level tag that combines all aspects of the test; it does not need any term-level constructors

data MyTest
type instance MockState MyTest = ..

data family Cmd t :: Type -> Type Source #

Commands

In Cmd t h, h is the type of the handle

Cmd t (RealHandle t)  -- for the system under test
Cmd t (MockHandle t)  -- for the mock

data family Resp t :: Type -> Type Source #

Responses

In Resp t h, h is the type of the handle

Resp t (RealHandle t)  -- for the system under test
Resp t (MockHandle t)  -- for the mock

data family RealHandle t :: Type Source #

The type of the real handle in the system under test

The key difference between the " simple " lockstep infrastructure and the n-ary lockstep infrastructure is that the former only supports a single real handle, whereas the latter supports an arbitrary list of them.

data family MockHandle t :: Type Source #

The type of the mock handle

NOTE: In the n-ary infrastructure, MockHandle is a type family of two arguments, because we have a mock handle for each real handle. Here, however, we only have a single real handle, so the " corresponding " real handle is implicitly RealHandle t.

type family Test (f :: Type -> Type) :: Type where ... Source #

Equations

Test (Cmd t) = t 
Test (Resp t) = t 

type family Tag t :: Type Source #

Tags

Tags are used when labelling execution runs in prop_sequential, as well as when looking for minimal examples with a given label (showLabelledExamples).

Test term-level parameters

data StateMachineTest t Source #

State machine test

This captures the design patterns sketched in https://well-typed.com/blog/2019/01/qsm-in-depth/ for the case where there is exactly one real handle. See Test.StateMachine.Lockstep.NAry for the generalization to n handles.

data Event t r Source #

Constructors

Event 

Fields

Handle instantiation

newtype At f r Source #

Constructors

At 

Fields

type (:@) f r = At f r Source #

Model state

data Model t r Source #

Constructors

Model 

Running the tests

prop_sequential Source #

Arguments

:: StateMachineTest t 
-> Maybe Int

(Optional) minimum number of commands

-> Property 

prop_parallel Source #

Arguments

:: StateMachineTest t 
-> Maybe Int

(Optional) minimum number of commands

-> Property 

Translate to n-ary model model