Copyright | (C) 2017 ATS Advanced Telematic Systems GmbH |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Stevan Andjelkovic <stevan@advancedtelematic.com> |
Stability | provisional |
Portability | non-portable (GHC extensions) |
Safe Haskell | None |
Language | Haskell2010 |
The main module for state machine based testing, it contains combinators that help you build sequential and parallel properties.
- data Program act
- forAllProgram :: Show (Untyped act) => HFoldable act => Generator model act -> Shrinker act -> Precondition model act -> Transition model act -> InitialModel model -> (Program act -> Property) -> Property
- runAndCheckProgram :: Monad m => HFunctor act => Precondition model act -> Transition model act -> Postcondition model act -> InitialModel model -> Semantics act m -> (m Property -> Property) -> Program act -> Property
- runAndCheckProgram' :: Monad m => HFunctor act => Precondition model act -> Transition model act -> Postcondition model act -> InitialModel model -> Semantics act m -> IO setup -> (setup -> m Property -> Property) -> (setup -> IO ()) -> Program act -> Property
- data ParallelProgram act
- forAllParallelProgram :: Show (Untyped act) => HFoldable act => Generator model act -> Shrinker act -> Precondition model act -> Transition model act -> InitialModel model -> (ParallelProgram act -> Property) -> Property
- data History act
- runParallelProgram :: Show (Untyped act) => HTraversable act => Semantics act IO -> ParallelProgram act -> (History act -> Property) -> Property
- runParallelProgram' :: Show (Untyped act) => HTraversable act => IO setup -> (setup -> Semantics act IO) -> (setup -> IO ()) -> ParallelProgram act -> (History act -> Property) -> Property
- checkParallelProgram :: HFoldable act => Transition model act -> Postcondition model act -> InitialModel model -> ParallelProgram act -> History act -> Property
- module Test.StateMachine.Types
Sequential property combinators
A (sequential) program is an abstract datatype representing a list of actions.
The idea is that the user shows how to generate, shrink, execute and modelcheck individual actions, and then the below combinators lift those things to whole programs.
:: Show (Untyped act) | |
=> HFoldable act | |
=> Generator model act | |
-> Shrinker act | |
-> Precondition model act | |
-> Transition model act | |
-> InitialModel model | |
-> (Program act -> Property) | Predicate that should hold for all programs. |
-> Property |
This function is like a forAllShrink
for sequential programs.
:: Monad m | |
=> HFunctor act | |
=> Precondition model act | |
-> Transition model act | |
-> Postcondition model act | |
-> InitialModel model | |
-> Semantics act m | |
-> (m Property -> Property) | Runner |
-> Program act | |
-> Property |
Run a sequential program and check if your model agrees with your semantics.
:: Monad m | |
=> HFunctor act | |
=> Precondition model act | |
-> Transition model act | |
-> Postcondition model act | |
-> InitialModel model | |
-> Semantics act m | |
-> IO setup | Setup a resource. |
-> (setup -> m Property -> Property) | |
-> (setup -> IO ()) | Tear down the resource. |
-> Program act | |
-> Property |
Same as above, except with the possibility to setup some resource for the runner to use. The resource could be a database connection for example.
Parallel property combinators
data ParallelProgram act Source #
A parallel program is an abstract datatype that represents three sequences of actions; a sequential prefix and two parallel suffixes. Analogous to the sequential case, the user shows how to generate, shrink, execute and modelcheck individual actions, and then the below combinators lift those things to whole parallel programs.
forAllParallelProgram Source #
:: Show (Untyped act) | |
=> HFoldable act | |
=> Generator model act | |
-> Shrinker act | |
-> Precondition model act | |
-> Transition model act | |
-> InitialModel model | |
-> (ParallelProgram act -> Property) | Predicate that should hold for all parallel programs. |
-> Property |
This function is like a forAllShrink
for parallel programs.
A history is a trace of invocations and responses from running a parallel program.
:: Show (Untyped act) | |
=> HTraversable act | |
=> Semantics act IO | |
-> ParallelProgram act | |
-> (History act -> Property) | Predicate that should hold for the execution history. |
-> Property |
Run a parallel program and collect the history of the execution.
:: Show (Untyped act) | |
=> HTraversable act | |
=> IO setup | Setup a resource. |
-> (setup -> Semantics act IO) | |
-> (setup -> IO ()) | Tear down the resource. |
-> ParallelProgram act | |
-> (History act -> Property) | |
-> Property |
Same as above, but with the possibility of setting up some resource.
:: HFoldable act | |
=> Transition model act | |
-> Postcondition model act | |
-> InitialModel model | |
-> ParallelProgram act | |
-> History act | History to be checked. |
-> Property |
Check if a history from a parallel execution can be linearised.
Types
module Test.StateMachine.Types