Copyright | (c) 2016 Michael Walker |
---|---|
License | MIT |
Maintainer | Michael Walker <mike@barrucadu.co.uk> |
Stability | stable |
Portability | CPP, FlexibleInstances, GADTs, ImpredicativeTypes, RankNTypes, TypeSynonymInstances |
Safe Haskell | None |
Language | Haskell2010 |
This module allows using Deja Fu predicates with Tasty to test the behaviour of concurrent systems.
- testAuto :: (Eq a, Show a) => (forall t. ConcST t a) -> TestTree
- testDejafu :: Show a => (forall t. ConcST t a) -> TestName -> Predicate a -> TestTree
- testDejafus :: Show a => (forall t. ConcST t a) -> [(TestName, Predicate a)] -> TestTree
- testAutoWay :: (Eq a, Show a) => Way -> MemType -> (forall t. ConcST t a) -> TestTree
- testDejafuWay :: Show a => Way -> MemType -> (forall t. ConcST t a) -> TestName -> Predicate a -> TestTree
- testDejafusWay :: Show a => Way -> MemType -> (forall t. ConcST t a) -> [(TestName, Predicate a)] -> TestTree
- testAutoIO :: (Eq a, Show a) => ConcIO a -> TestTree
- testDejafuIO :: Show a => ConcIO a -> TestName -> Predicate a -> TestTree
- testDejafusIO :: Show a => ConcIO a -> [(TestName, Predicate a)] -> TestTree
- testAutoWayIO :: (Eq a, Show a) => Way -> MemType -> ConcIO a -> TestTree
- testDejafuWayIO :: Show a => Way -> MemType -> ConcIO a -> TestName -> Predicate a -> TestTree
- testDejafusWayIO :: Show a => Way -> MemType -> ConcIO a -> [(TestName, Predicate a)] -> TestTree
- data Way :: * where
- Systematically :: Way
- Randomly :: Way
- data Bounds :: * = Bounds {}
- data MemType :: *
Unit testing
This is supported by the IsTest
instances for ConcST
and
ConcIO
. These instances try all executions, reporting as
failures the cases which return a Just
string.
instance Typeable t => IsTest (ConcST t (Maybe String))
instance IsTest (ConcIO (Maybe String))
instance IsOption Bounds
instance IsOption MemType
Property testing
Automatically test a computation. In particular, look for deadlocks, uncaught exceptions, and multiple return values.
This uses the Conc
monad for testing, which is an instance of
MonadConc
. If you need to test something which also uses
MonadIO
, use testAutoIO
.
Since: 0.2.0.0
:: Show a | |
=> (forall t. ConcST t a) | The computation to test |
-> TestName | The name of the test. |
-> Predicate a | The predicate to check |
-> TestTree |
Check that a predicate holds.
Since: 0.2.0.0
:: Show a | |
=> (forall t. ConcST t a) | The computation to test |
-> [(TestName, Predicate a)] | The list of predicates (with names) to check |
-> TestTree |
Variant of testDejafu
which takes a collection of predicates to
test. This will share work between the predicates, rather than
running the concurrent computation many times for each predicate.
Since: 0.2.0.0
:: (Eq a, Show a) | |
=> Way | How to execute the concurrent program. |
-> MemType | The memory model to use for non-synchronised |
-> (forall t. ConcST t a) | The computation to test |
-> TestTree |
Variant of testAuto
which tests a computation under a given
execution way and memory model.
Since: 0.5.0.0
:: Show a | |
=> Way | How to execute the concurrent program. |
-> MemType | The memory model to use for non-synchronised |
-> (forall t. ConcST t a) | The computation to test |
-> TestName | The name of the test. |
-> Predicate a | The predicate to check |
-> TestTree |
Variant of testDejafu
which takes a way to execute the program
and a memory model.
Since: 0.5.0.0
:: Show a | |
=> Way | How to execute the concurrent program. |
-> MemType | The memory model to use for non-synchronised |
-> (forall t. ConcST t a) | The computation to test |
-> [(TestName, Predicate a)] | The list of predicates (with names) to check |
-> TestTree |
Variant of testDejafus
which takes a way to execute the program
and a memory model.
Since: 0.5.0.0
IO
testDejafuIO :: Show a => ConcIO a -> TestName -> Predicate a -> TestTree Source #
Variant of testDejafu
for computations which do IO
.
Since: 0.2.0.0
testDejafusIO :: Show a => ConcIO a -> [(TestName, Predicate a)] -> TestTree Source #
Variant of testDejafus
for computations which do IO
.
Since: 0.2.0.0
testAutoWayIO :: (Eq a, Show a) => Way -> MemType -> ConcIO a -> TestTree Source #
Variant of testAutoWay
for computations which do IO
.
Since: 0.5.0.0
testDejafuWayIO :: Show a => Way -> MemType -> ConcIO a -> TestName -> Predicate a -> TestTree Source #
Variant of testDejafuWay
for computations which do IO
.
Since: 0.5.0.0
testDejafusWayIO :: Show a => Way -> MemType -> ConcIO a -> [(TestName, Predicate a)] -> TestTree Source #
Variant of dejafusWay
for computations which do IO
.
Since: 0.5.0.0
Re-exports
How to explore the possible executions of a concurrent program:
- Systematically explore all executions within the bounds; or
- Explore a fixed number of random executions, with the given PRNG.
Since: 0.6.0.0
Systematically :: Way | |
Randomly :: Way |
Since: 0.2.0.0
The memory model to use for non-synchronised CRef
operations.
Since: 0.4.0.0
SequentialConsistency | The most intuitive model: a program behaves as a simple
interleaving of the actions in different threads. When a |
TotalStoreOrder | Each thread has a write buffer. A thread sees its writes immediately, but other threads will only see writes when they are committed, which may happen later. Writes are committed in the same order that they are created. |
PartialStoreOrder | Each |