ouroboros-network-testing-0.1.0.0: Common modules used for testing in ouroboros-network and ouroboros-consensus
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Testing.Utils

Synopsis

Arbitrary Delays

newtype Delay Source #

Constructors

Delay 

Fields

Instances

Instances details
Eq Delay Source # 
Instance details

Defined in Ouroboros.Network.Testing.Utils

Methods

(==)DelayDelayBool Source #

(/=)DelayDelayBool Source #

Num Delay Source # 
Instance details

Defined in Ouroboros.Network.Testing.Utils

Ord Delay Source # 
Instance details

Defined in Ouroboros.Network.Testing.Utils

Methods

compareDelayDelayOrdering Source #

(<)DelayDelayBool Source #

(<=)DelayDelayBool Source #

(>)DelayDelayBool Source #

(>=)DelayDelayBool Source #

maxDelayDelayDelay Source #

minDelayDelayDelay Source #

Show Delay Source # 
Instance details

Defined in Ouroboros.Network.Testing.Utils

Arbitrary Delay Source #

This needs to be small, as we are using real time limits in block-fetch examples.

Instance details

Defined in Ouroboros.Network.Testing.Utils

Methods

arbitrary ∷ Gen Delay

shrinkDelay → [Delay]

newtype SmallDelay Source #

Constructors

SmallDelay 

Instances

Instances details
Eq SmallDelay Source # 
Instance details

Defined in Ouroboros.Network.Testing.Utils

Num SmallDelay Source # 
Instance details

Defined in Ouroboros.Network.Testing.Utils

Ord SmallDelay Source # 
Instance details

Defined in Ouroboros.Network.Testing.Utils

Show SmallDelay Source # 
Instance details

Defined in Ouroboros.Network.Testing.Utils

Arbitrary SmallDelay Source # 
Instance details

Defined in Ouroboros.Network.Testing.Utils

QuickCheck Utils

arbitrarySubsetOrd a ⇒ Set a → Gen (Set a) Source #

Pick a subset of a set, using a 50:50 chance for each set element.

shrinkVector ∷ (a → [a]) → [a] → [[a]] Source #

Like shrinkList but only shrink the elems, don't drop elements.

Useful when you want a custom strategy for dropping elements.

prop_shrink_valid ∷ (Arbitrary a, Show a) ⇒ (a → Bool) → Fixed a → Property Source #

Check that each shrink satisfies some invariant or validity condition.

prop_shrink_nonequal ∷ (Arbitrary a, Eq a) ⇒ Fixed a → Property Source #

The shrink function needs to give a valid value that is smaller than the original, otherwise the shrinking procedure is not well-founded and can cycle.

This property does not check size, as that would need significant extra infrastructure to define an appropriate measure. Instead this property simply checks each shrink is not the same as the original. This catches simple 1-cycles, but not bigger cycles. These are fortunately the most common case, so it is still a useful property in practice.

Tracing Utils

data WithName name event Source #

Constructors

WithName 

Fields

Instances

Instances details
Functor (WithName name) Source # 
Instance details

Defined in Ouroboros.Network.Testing.Utils

Methods

fmap ∷ (a → b) → WithName name a → WithName name b Source #

(<$) ∷ a → WithName name b → WithName name a Source #

(Show name, Show event) ⇒ Show (WithName name event) Source # 
Instance details

Defined in Ouroboros.Network.Testing.Utils

Methods

showsPrecIntWithName name event → ShowS Source #

showWithName name event → String Source #

showList ∷ [WithName name event] → ShowS Source #

data WithTime event Source #

Constructors

WithTime 

Fields

Instances

Instances details
Functor WithTime Source # 
Instance details

Defined in Ouroboros.Network.Testing.Utils

Methods

fmap ∷ (a → b) → WithTime a → WithTime b Source #

(<$) ∷ a → WithTime b → WithTime a Source #

Show event ⇒ Show (WithTime event) Source # 
Instance details

Defined in Ouroboros.Network.Testing.Utils

Methods

showsPrecIntWithTime event → ShowS Source #

showWithTime event → String Source #

showList ∷ [WithTime event] → ShowS Source #

tracerWithName ∷ name → Tracer m (WithName name a) → Tracer m a Source #

tracerWithTime ∷ MonadMonotonicTime m ⇒ Tracer m (WithTime a) → Tracer m a Source #

tracerWithTimeName ∷ MonadMonotonicTime m ⇒ name → Tracer m (WithTime (WithName name a)) → Tracer m a Source #

splitWithNameTraceOrd name ⇒ Trace r (WithName name b) → Trace r [WithName name b] Source #

Split Trace events into separate traces indexed by a given name.

Tracers

debugTracer ∷ (Show a, Applicative m) ⇒ Tracer m a Source #

sayTracer ∷ (Show a, MonadSay m) ⇒ Tracer m a Source #

Tasty Utils

nightlyTest ∷ TestTree → TestTree Source #

ignoreTest ∷ TestTree → TestTree #

Auxiliary functions

renderRangesIntIntString Source #

Use in tabulate to help summarise data into buckets.