ouroboros-network-testing-0.6.1.0: Common modules used for testing in ouroboros-network and ouroboros-consensus
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ouroboros.Network.Testing.Utils

Synopsis

Arbitrary Delays

newtype Delay Source #

Constructors

Delay 

Fields

Instances

Instances details
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

Num Delay Source # 
Instance details

Defined in Ouroboros.Network.Testing.Utils

Methods

(+)DelayDelayDelay #

(-)DelayDelayDelay #

(*)DelayDelayDelay #

negateDelayDelay #

absDelayDelay #

signumDelayDelay #

fromIntegerIntegerDelay #

Show Delay Source # 
Instance details

Defined in Ouroboros.Network.Testing.Utils

Methods

showsPrecIntDelayShowS #

showDelayString #

showList ∷ [Delay] → ShowS #

Eq Delay Source # 
Instance details

Defined in Ouroboros.Network.Testing.Utils

Methods

(==)DelayDelayBool #

(/=)DelayDelayBool #

Ord Delay Source # 
Instance details

Defined in Ouroboros.Network.Testing.Utils

Methods

compareDelayDelayOrdering #

(<)DelayDelayBool #

(<=)DelayDelayBool #

(>)DelayDelayBool #

(>=)DelayDelayBool #

maxDelayDelayDelay #

minDelayDelayDelay #

Set properties

isSubsetProperty ∷ (Ord a, Show a) ⇒ StringSet a → Set a → Property Source #

disjointSetsProperty ∷ (Ord a, Show a) ⇒ StringSet a → Set a → Property Source #

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.

newtype ShrinkCarefully a Source #

Constructors

ShrinkCarefully a 

Instances

Instances details
(Eq a, Arbitrary a) ⇒ Arbitrary (ShrinkCarefully a) Source # 
Instance details

Defined in Ouroboros.Network.Testing.Utils

Show a ⇒ Show (ShrinkCarefully a) Source # 
Instance details

Defined in Ouroboros.Network.Testing.Utils

Eq a ⇒ Eq (ShrinkCarefully a) Source # 
Instance details

Defined in Ouroboros.Network.Testing.Utils

prop_shrink_valid ∷ (Arbitrary a, Show a, Testable prop) ⇒ (a → prop) → ShrinkCarefully a → Property Source #

Check that each shrink satisfies some invariant or validity condition.

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 #

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

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

Defined in Ouroboros.Network.Testing.Utils

Methods

showsPrecIntWithName name event → ShowS #

showWithName name event → String #

showList ∷ [WithName name event] → ShowS #

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 #

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

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

Defined in Ouroboros.Network.Testing.Utils

Methods

showsPrecIntWithTime event → ShowS #

showWithTime event → String #

showList ∷ [WithTime event] → ShowS #

tracerWithName ∷ name → Tracer m (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

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

Tasty Utils

ignoreTestTestTreeTestTree Source #

Prevents the tests from running and reports them as succeeding.

This may be be desireable as an alternative to commenting out the tests. This way, they are still typechecked (preventing bitrot), and the test report lists them, which serves as a reminder that there are ignored tests.

Note that any setup/teardown actions executed by withResource are still executed. You can bypass this manually as in the following example:

askOption $ \(MyFlag b) -> if b
                           then withResource mytest
                           else ignoreTest . mytest $ return junkvalue

Auxiliary functions

renderRangesIntIntString Source #

Use in tabulate to help summarise data into buckets.