ouroboros-consensus-test-0.1.0.0: Tests of the consensus layer
Safe HaskellNone
LanguageHaskell2010

Test.Util.LogicalClock

Description

Logical time (in terms of abstract " ticks ")

Intended for qualified import

import Test.Util.LogicalClock (LogicalClock)
import qualified Test.Util.LogicalClock as LogicalClock
Synopsis

API

data LogicalClock m Source #

Logical clock (in terms of ticks rather than actual UTCTime)

Constructors

LogicalClock 

Fields

newtype NumTicks Source #

Number of ticks the test will run for

Constructors

NumTicks Word64 

newtype Tick Source #

Logical time unit

Constructors

Tick 

Fields

Instances

Instances details
Enum Tick Source # 
Instance details

Defined in Test.Util.LogicalClock

Eq Tick Source # 
Instance details

Defined in Test.Util.LogicalClock

Methods

(==)TickTickBool Source #

(/=)TickTickBool Source #

Num Tick Source # 
Instance details

Defined in Test.Util.LogicalClock

Methods

(+)TickTickTick Source #

(-)TickTickTick Source #

(*)TickTickTick Source #

negateTickTick Source #

absTickTick Source #

signumTickTick Source #

fromIntegerIntegerTick Source #

Ord Tick Source # 
Instance details

Defined in Test.Util.LogicalClock

Methods

compareTickTickOrdering Source #

(<)TickTickBool Source #

(<=)TickTickBool Source #

(>)TickTickBool Source #

(>=)TickTickBool Source #

maxTickTickTick Source #

minTickTickTick Source #

Show Tick Source # 
Instance details

Defined in Test.Util.LogicalClock

Methods

showsPrecIntTickShowS Source #

showTickString Source #

showList ∷ [Tick] → ShowS Source #

Random Tick Source # 
Instance details

Defined in Test.Util.LogicalClock

Methods

randomR ∷ RandomGen g ⇒ (Tick, Tick) → g → (Tick, g)

random ∷ RandomGen g ⇒ g → (Tick, g)

randomRs ∷ RandomGen g ⇒ (Tick, Tick) → g → [Tick]

randoms ∷ RandomGen g ⇒ g → [Tick]

Construction

sufficientTimeForHasCallStack ⇒ [Tick] → NumTicks Source #

Set NumTicks such that we will have seen all of the specified Ticks

Scheduling actions

blockUntilTickMonadSTM m ⇒ LogicalClock m → Tick → m Bool Source #

Block until the specified tick

Returns False if the current tick is later than the requested one, or True if they were equal.

onTick ∷ (IOLike m, HasCallStack) ⇒ ResourceRegistry m → LogicalClock m → StringTick → m () → m () Source #

Execute action once at the specified tick

tickWatcherLogicalClock m → (Tick → m ()) → Watcher m Tick Tick Source #

Execute action on every clock tick