distributed-process-tests-0.4.11: Tests and test support tools for distributed-process.

Copyright(c) Tim Watson Jeff Epstein 2013
LicenseBSD3 (see the file LICENSE)
MaintainerTim Watson
Stabilityexperimental
Portabilitynon-portable (requires concurrency)
Safe HaskellNone
LanguageHaskell98

Control.Distributed.Process.Tests.Internal.Utils

Description

This module provides basic building blocks for testing Cloud Haskell programs.

Synopsis

Documentation

type TestResult a = MVar a #

A mutable cell containing a test result.

data Ping #

A simple Ping signal

Constructors

Ping 

Instances

Eq Ping # 

Methods

(==) :: Ping -> Ping -> Bool #

(/=) :: Ping -> Ping -> Bool #

Show Ping # 

Methods

showsPrec :: Int -> Ping -> ShowS #

show :: Ping -> String #

showList :: [Ping] -> ShowS #

Generic Ping # 

Associated Types

type Rep Ping :: * -> * #

Methods

from :: Ping -> Rep Ping x #

to :: Rep Ping x -> Ping #

Binary Ping # 

Methods

put :: Ping -> Put #

get :: Get Ping #

putList :: [Ping] -> Put #

type Rep Ping # 
type Rep Ping = D1 * (MetaData "Ping" "Control.Distributed.Process.Tests.Internal.Utils" "distributed-process-tests-0.4.11-EjWzN1MP5co42z3YTosJfr" False) (C1 * (MetaCons "Ping" PrefixI False) (U1 *))

shouldBe :: a -> Matcher a -> Process () #

shouldMatch :: a -> Matcher a -> Process () #

shouldContain :: (Show a, Eq a) => [a] -> a -> Process () #

shouldNotContain :: (Show a, Eq a) => [a] -> a -> Process () #

expectThat :: a -> Matcher a -> Process () #

synchronisedAssertion :: Eq a => String -> LocalNode -> a -> (TestResult a -> Process ()) -> MVar () -> Assertion #

data TestProcessControl #

Control signals used to manage test processes

Instances

Generic TestProcessControl # 
Binary TestProcessControl # 
type Rep TestProcessControl # 
type Rep TestProcessControl = D1 * (MetaData "TestProcessControl" "Control.Distributed.Process.Tests.Internal.Utils" "distributed-process-tests-0.4.11-EjWzN1MP5co42z3YTosJfr" False) ((:+:) * (C1 * (MetaCons "Stop" PrefixI False) (U1 *)) ((:+:) * (C1 * (MetaCons "Go" PrefixI False) (U1 *)) (C1 * (MetaCons "Report" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * ProcessId)))))

startTestProcess :: Process () -> Process ProcessId #

Starts a test process on the local node.

runTestProcess :: Process () -> Process () #

Runs a test process around the supplied proc, which is executed whenever the outer process loop receives a Go signal.

testProcessGo :: ProcessId -> Process () #

Tell a test process to continue executing

testProcessStop :: ProcessId -> Process () #

Tell a test process to stop (i.e., terminate)

testProcessReport :: ProcessId -> Process () #

Tell a test process to send a report (message) back to the calling process

delayedAssertion :: Eq a => String -> LocalNode -> a -> (TestResult a -> Process ()) -> Assertion #

Run the supplied testProc using an MVar to collect and assert against its result. Uses the supplied note if the assertion fails.

assertComplete :: Eq a => String -> MVar a -> a -> IO () #

Takes the value of mv (using takeMVar) and asserts that it matches a

data Logger #

newLogger :: IO Logger #

Create a new Logger. Logger uses a TQueue to receive and process messages on a worker thread.

putLogMsg :: Logger -> String -> Process () #

Send a message to the Logger

stopLogger :: Logger -> IO () #

Stop the worker thread for the given Logger

noop :: Process () #

Does exactly what it says on the tin, doing so in the Process monad.

stash :: TestResult a -> a -> Process () #