Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ouroboros.Network.Testing.Utils
Synopsis
- newtype Delay = Delay {}
- genDelayWithPrecision ∷ Integer → Gen DiffTime
- newtype SmallDelay = SmallDelay {}
- arbitrarySubset ∷ Ord a ⇒ Set a → Gen (Set a)
- shrinkVector ∷ (a → [a]) → [a] → [[a]]
- prop_shrink_valid ∷ (Arbitrary a, Show a) ⇒ (a → Bool) → Fixed a → Property
- prop_shrink_nonequal ∷ (Arbitrary a, Eq a) ⇒ Fixed a → Property
- data WithName name event = WithName {}
- data WithTime event = WithTime {}
- tracerWithName ∷ name → Tracer m (WithName name a) → Tracer m a
- tracerWithTime ∷ MonadMonotonicTime m ⇒ Tracer m (WithTime a) → Tracer m a
- tracerWithTimeName ∷ MonadMonotonicTime m ⇒ name → Tracer m (WithTime (WithName name a)) → Tracer m a
- swapTimeWithName ∷ WithTime (WithName name b) → WithName name (WithTime b)
- swapNameWithTime ∷ WithName name (WithTime b) → WithTime (WithName name b)
- splitWithNameTrace ∷ Ord name ⇒ Trace r (WithName name b) → Trace r [WithName name b]
- debugTracer ∷ (Show a, Applicative m) ⇒ Tracer m a
- sayTracer ∷ (Show a, MonadSay m) ⇒ Tracer m a
- nightlyTest ∷ TestTree → TestTree
- ignoreTest ∷ TestTree → TestTree
- renderRanges ∷ Int → Int → String
Arbitrary Delays
genDelayWithPrecision ∷ Integer → Gen DiffTime Source #
newtype SmallDelay Source #
Constructors
SmallDelay | |
Fields |
Instances
Eq SmallDelay Source # | |
Defined in Ouroboros.Network.Testing.Utils | |
Num SmallDelay Source # | |
Defined in Ouroboros.Network.Testing.Utils Methods (+) ∷ SmallDelay → SmallDelay → SmallDelay Source # (-) ∷ SmallDelay → SmallDelay → SmallDelay Source # (*) ∷ SmallDelay → SmallDelay → SmallDelay Source # negate ∷ SmallDelay → SmallDelay Source # abs ∷ SmallDelay → SmallDelay Source # | |
Ord SmallDelay Source # | |
Defined in Ouroboros.Network.Testing.Utils Methods compare ∷ SmallDelay → SmallDelay → Ordering Source # (<) ∷ SmallDelay → SmallDelay → Bool Source # (<=) ∷ SmallDelay → SmallDelay → Bool Source # (>) ∷ SmallDelay → SmallDelay → Bool Source # (>=) ∷ SmallDelay → SmallDelay → Bool Source # max ∷ SmallDelay → SmallDelay → SmallDelay Source # min ∷ SmallDelay → SmallDelay → SmallDelay Source # | |
Show SmallDelay Source # | |
Defined in Ouroboros.Network.Testing.Utils | |
Arbitrary SmallDelay Source # | |
Defined in Ouroboros.Network.Testing.Utils |
QuickCheck Utils
arbitrarySubset ∷ Ord 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
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 #
splitWithNameTrace ∷ Ord 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 #
Tasty Utils
nightlyTest ∷ TestTree → TestTree Source #
ignoreTest ∷ TestTree → TestTree #