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

Test.Util.Orphans.Arbitrary

Synopsis

Documentation

newtype SmallDiffTime Source #

Wrapper around NominalDiffTime with custom Arbitrary instance

The default Arbitrary instance for NominalDiffTime isn't very useful:

  • It tends to pick huge values
  • It tends not to pick integer values
  • It does not shrink

Our custom instance

  • Picks values between 0 and (1000 * 20 * 10) seconds:
  • Maximum segment length: 1000
  • Maximum slot length: 20 seconds
  • Maximum number of segments: 10
  • With a 0.1 second precision
  • Shrinks

Instances

Instances details
Show SmallDiffTime Source # 
Instance details

Defined in Test.Util.Orphans.Arbitrary

Arbitrary SmallDiffTime Source # 
Instance details

Defined in Test.Util.Orphans.Arbitrary

genLimitedEpochSize ∷ Gen EpochSize Source #

The tests for CumulEpochSizes requires that the sum of a list of these values does not overflow.

An epoch size must be > 0.

genLimitedSlotNo ∷ Gen SlotNo Source #

The functions slotAtTime and timeUntilNextSlot suffer from arithmetic overflow for very large values, so generate values that avoid overflow when used in these two functions. The largest value generated is still sufficently large to allow for 5e12 years worth of slots at a slot interval of 20 seconds.

genSmallSlotNo ∷ Gen SlotNo Source #

Generate a small SlotNo for the state machine tests. The runtime of the StateMachine prop_sequential tests is proportional the the upper bound.

Orphan instances

Arbitrary NominalDiffTime Source #

Picks time span between 0 seconds and (roughly) 50 years

Instance details

Arbitrary ClockSkew Source # 
Instance details

Methods

arbitrary ∷ Gen ClockSkew

shrinkClockSkew → [ClockSkew]

Arbitrary Bound Source # 
Instance details

Methods

arbitrary ∷ Gen Bound

shrinkBound → [Bound]

Arbitrary ChunkSlot Source # 
Instance details

Methods

arbitrary ∷ Gen ChunkSlot

shrinkChunkSlot → [ChunkSlot]

Arbitrary NumCoreNodes Source # 
Instance details

Arbitrary ChunkSize Source #

Picks a ChunkSize between 1 and 100, and randomly choose to enable EBBs

Instance details

Methods

arbitrary ∷ Gen ChunkSize

shrinkChunkSize → [ChunkSize]

Arbitrary ChunkNo Source #

This picks an EpochNo between 0 and 10000

We don't pick larger values because we're not interested in testing overflow due to huge epoch numbers and even huger slot numbers.

Instance details

Methods

arbitrary ∷ Gen ChunkNo

shrinkChunkNo → [ChunkNo]

Arbitrary RelativeSlot Source # 
Instance details

Arbitrary QueryVersion Source # 
Instance details

Arbitrary SystemStart Source # 
Instance details

Arbitrary SlotLength Source #

Length between 0.001 and 20 seconds, millisecond granularity

Instance details

Arbitrary BlockNo Source # 
Instance details

Methods

arbitrary ∷ Gen BlockNo

shrinkBlockNo → [BlockNo]

Arbitrary UTCTime Source #

Picks moment between dawnOfTime and (roughly) 50 years later

Uses instance for NominalDiffTime

Instance details

Methods

arbitrary ∷ Gen UTCTime

shrinkUTCTime → [UTCTime]

(IsNonEmpty xs, SListI xs, All (Compose Arbitrary WrapChainDepState) xs) ⇒ Arbitrary (HardForkChainDepState xs) Source # 
Instance details

(All SingleEraBlock (x ': xs), IsNonEmpty xs) ⇒ Arbitrary (MismatchEraInfo (x ': xs)) Source # 
Instance details

Methods

arbitrary ∷ Gen (MismatchEraInfo (x ': xs))

shrinkMismatchEraInfo (x ': xs) → [MismatchEraInfo (x ': xs)]

Arbitrary (ApplyTxErr blk) ⇒ Arbitrary (WrapApplyTxErr blk) Source #

Forwarding

Instance details

Methods

arbitrary ∷ Gen (WrapApplyTxErr blk)

shrinkWrapApplyTxErr blk → [WrapApplyTxErr blk]

Arbitrary (HeaderHash blk) ⇒ Arbitrary (WrapHeaderHash blk) Source #

Forwarding

Instance details

Methods

arbitrary ∷ Gen (WrapHeaderHash blk)

shrinkWrapHeaderHash blk → [WrapHeaderHash blk]

Arbitrary (TipInfo blk) ⇒ Arbitrary (WrapTipInfo blk) Source #

Forwarding

Instance details

Methods

arbitrary ∷ Gen (WrapTipInfo blk)

shrinkWrapTipInfo blk → [WrapTipInfo blk]

Arbitrary (ChainDepState (BlockProtocol blk)) ⇒ Arbitrary (WrapChainDepState blk) Source #

Forwarding

Instance details

(IsNonEmpty xs, SListI xs, All (Compose Arbitrary LedgerState) xs) ⇒ Arbitrary (LedgerState (HardForkBlock xs)) Source # 
Instance details

SingleEraBlock blk ⇒ Arbitrary (SingleEraInfo blk) Source # 
Instance details

Methods

arbitrary ∷ Gen (SingleEraInfo blk)

shrinkSingleEraInfo blk → [SingleEraInfo blk]

SingleEraBlock blk ⇒ Arbitrary (LedgerEraInfo blk) Source # 
Instance details

Methods

arbitrary ∷ Gen (LedgerEraInfo blk)

shrinkLedgerEraInfo blk → [LedgerEraInfo blk]

Arbitrary a ⇒ Arbitrary (I a) Source #

Forwarding

Instance details

Methods

arbitrary ∷ Gen (I a)

shrinkI a → [I a]

Arbitrary a ⇒ Arbitrary (WithOrigin a) Source # 
Instance details

Methods

arbitrary ∷ Gen (WithOrigin a)

shrinkWithOrigin a → [WithOrigin a]

Arbitrary (f blk) ⇒ Arbitrary (Current f blk) Source # 
Instance details

Methods

arbitrary ∷ Gen (Current f blk)

shrinkCurrent f blk → [Current f blk]

Arbitrary (SomeSecond BlockQuery blk) ⇒ Arbitrary (SomeSecond Query blk) Source # 
Instance details

Methods

arbitrary ∷ Gen (SomeSecond Query blk)

shrinkSomeSecond Query blk → [SomeSecond Query blk]

(All (Compose Arbitrary f) xs, IsNonEmpty xs) ⇒ Arbitrary (NS f xs) Source # 
Instance details

Methods

arbitrary ∷ Gen (NS f xs)

shrinkNS f xs → [NS f xs]

Arbitrary (K Past blk) Source # 
Instance details

Methods

arbitrary ∷ Gen (K Past blk)

shrinkK Past blk → [K Past blk]

(IsNonEmpty xs, All (Compose Arbitrary f) (x ': xs), All (Compose Arbitrary g) (x ': xs)) ⇒ Arbitrary (Mismatch f g (x ': xs)) Source # 
Instance details

Methods

arbitrary ∷ Gen (Mismatch f g (x ': xs))

shrinkMismatch f g (x ': xs) → [Mismatch f g (x ': xs)]

(IsNonEmpty xs, All (Compose Arbitrary f) xs, All (Compose Arbitrary g) xs) ⇒ Arbitrary (Telescope g f xs) Source # 
Instance details

Methods

arbitrary ∷ Gen (Telescope g f xs)

shrinkTelescope g f xs → [Telescope g f xs]