quickcheck-state-machine-0.4.1: 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.andjelkovic@here.com>
Stabilityprovisional
Portabilitynon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Test.StateMachine.Sequential

Description

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

Synopsis

Documentation

forAllCommands Source #

Arguments

:: Testable prop 
=> (Show (cmd Symbolic), Show (model Symbolic)) 
=> (Generic1 cmd, GConName1 (Rep1 cmd)) 
=> (Foldable cmd, Foldable resp) 
=> StateMachine model cmd m resp 
-> Maybe Int

Minimum number of commands.

-> (Commands cmd -> prop)

Predicate.

-> Property 

generateCommands Source #

Arguments

:: (Foldable resp, Show (model Symbolic)) 
=> (Generic1 cmd, GConName1 (Rep1 cmd)) 
=> StateMachine model cmd m resp 
-> Maybe Int

Minimum number of commands.

-> Gen (Commands cmd) 

generateCommandsState Source #

Arguments

:: Foldable resp 
=> Show (model Symbolic) 
=> (Generic1 cmd, GConName1 (Rep1 cmd)) 
=> StateMachine model cmd m resp 
-> Counter 
-> Maybe Int

Minimum number of commands.

-> StateT (model Symbolic, Maybe (cmd Symbolic)) Gen (Commands cmd) 

measureFrequency Source #

Arguments

:: (Foldable resp, Show (model Symbolic)) 
=> (Generic1 cmd, GConName1 (Rep1 cmd)) 
=> StateMachine model cmd m resp 
-> Maybe Int

Minimum number of commands.

-> Int

Maximum number of commands.

-> IO (Map (String, Maybe String) Int) 

shrinkCommands :: (Foldable cmd, Foldable resp) => StateMachine model cmd m resp -> Commands cmd -> [Commands cmd] Source #

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

liftShrinkCommand :: (cmd Symbolic -> [cmd Symbolic]) -> Command cmd -> [Command cmd] Source #

validCommands :: forall model cmd m resp. (Foldable cmd, Foldable resp) => StateMachine model cmd m resp -> Commands cmd -> State (model Symbolic, Set Var, Counter) (Maybe (Commands cmd)) Source #

filterMaybe :: (a -> Maybe b) -> [a] -> [b] Source #

runCommands :: (Traversable cmd, Foldable resp) => (MonadCatch m, MonadBaseControl IO m) => StateMachine model cmd m resp -> Commands cmd -> PropertyM m (History cmd resp, model Concrete, Reason) Source #

executeCommands Source #

Arguments

:: (Traversable cmd, Foldable resp) 
=> (MonadCatch m, MonadBaseControl IO m) 
=> StateMachine model cmd m resp 
-> TChan (Pid, HistoryEvent cmd resp) 
-> Pid 
-> Bool

Check invariant and post-condition?

-> Commands cmd 
-> StateT (Environment, model Concrete) m Reason 

prettyPrintHistory :: forall model cmd m resp. ToExpr (model Concrete) => (Show (cmd Concrete), Show (resp Concrete)) => StateMachine model cmd m resp -> History cmd resp -> IO () Source #

prettyCommands :: (MonadIO m, ToExpr (model Concrete)) => (Show (cmd Concrete), Show (resp Concrete)) => StateMachine model cmd m resp -> History cmd resp -> Property -> PropertyM m () Source #

commandNames :: forall cmd. (Generic1 cmd, GConName1 (Rep1 cmd)) => Commands cmd -> [(String, Int)] Source #

commandNamesInOrder :: forall cmd. (Generic1 cmd, GConName1 (Rep1 cmd)) => Commands cmd -> [String] Source #

checkCommandNames :: forall cmd. (Generic1 cmd, GConName1 (Rep1 cmd)) => Commands cmd -> Property -> Property Source #

Print distribution of commands and fail if some commands have not been executed.

transitionMatrix :: forall cmd. GConName1 (Rep1 cmd) => Proxy (cmd Symbolic) -> (String -> String -> Int) -> Matrix Int Source #