| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Test.Util.Peras.Common
Description
Common test utilities for Peras tests.
Synopsis
- genPerasParams ∷ Gen (PerasParams blk)
- genRoundNo ∷ Gen PerasRoundNo
- genSeatIndex ∷ Gen PerasSeatIndex
- genPoolId ∷ Gen PoolId
- genLedgerStake ∷ Gen LedgerStake
- newtype ListWithUniqueIds a = ListWithUniqueIds [a]
- newtype NonEmptyListWithUniqueIds a = NonEmptyListWithUniqueIds (NonEmpty a)
- genListWithUniqueIds ∷ Ord idTy ⇒ (a → idTy) → Gen a → Gen (ListWithUniqueIds a)
- genNonEmptyListWithUniqueIds ∷ Ord idTy ⇒ (a → idTy) → Gen a → Gen (NonEmptyListWithUniqueIds a)
- nonEmptyListOf ∷ Gen a → Gen (NonEmpty a)
- genRelativeTime ∷ Gen RelativeTime
- genWithArrivalTime ∷ Gen a → Gen (WithArrivalTime a)
- genPointTestBlock ∷ Gen (Point TestBlock)
- mockSystemTime ∷ ∀ (m ∷ Type → Type). Applicative m ⇒ SystemTime m
- mkBucket ∷ Int → Int → String → String
- divisorClosestToTarget ∷ Integral a ⇒ a → Double → a
- divisorClosestToQuotient ∷ Integral a ⇒ a → a → a
Documentation
genPerasParams ∷ Gen (PerasParams blk) Source #
newtype ListWithUniqueIds a Source #
Constructors
| ListWithUniqueIds [a] |
Instances
| Eq a ⇒ Eq (ListWithUniqueIds a) Source # | |
Defined in Test.Util.Peras.Common Methods (==) ∷ ListWithUniqueIds a → ListWithUniqueIds a → Bool # (/=) ∷ ListWithUniqueIds a → ListWithUniqueIds a → Bool # | |
| Ord a ⇒ Ord (ListWithUniqueIds a) Source # | |
Defined in Test.Util.Peras.Common Methods compare ∷ ListWithUniqueIds a → ListWithUniqueIds a → Ordering # (<) ∷ ListWithUniqueIds a → ListWithUniqueIds a → Bool # (<=) ∷ ListWithUniqueIds a → ListWithUniqueIds a → Bool # (>) ∷ ListWithUniqueIds a → ListWithUniqueIds a → Bool # (>=) ∷ ListWithUniqueIds a → ListWithUniqueIds a → Bool # max ∷ ListWithUniqueIds a → ListWithUniqueIds a → ListWithUniqueIds a # min ∷ ListWithUniqueIds a → ListWithUniqueIds a → ListWithUniqueIds a # | |
| Show a ⇒ Show (ListWithUniqueIds a) Source # | |
Defined in Test.Util.Peras.Common Methods showsPrec ∷ Int → ListWithUniqueIds a → ShowS # show ∷ ListWithUniqueIds a → String # showList ∷ [ListWithUniqueIds a] → ShowS # | |
newtype NonEmptyListWithUniqueIds a Source #
Constructors
| NonEmptyListWithUniqueIds (NonEmpty a) |
Instances
genListWithUniqueIds ∷ Ord idTy ⇒ (a → idTy) → Gen a → Gen (ListWithUniqueIds a) Source #
genNonEmptyListWithUniqueIds ∷ Ord idTy ⇒ (a → idTy) → Gen a → Gen (NonEmptyListWithUniqueIds a) Source #
genWithArrivalTime ∷ Gen a → Gen (WithArrivalTime a) Source #
mockSystemTime ∷ ∀ (m ∷ Type → Type). Applicative m ⇒ SystemTime m Source #
A static SystemTime returning a constant time. The canonical mock system
time lives in mockSystemTime, but it is a field of
LogicalClock which requires a ResourceRegistry and a background tick
thread — too heavyweight for simple property tests that don't need time
progression.
divisorClosestToTarget ∷ Integral a ⇒ a → Double → a Source #
Find the whole divisor of num that is the closest to target.
divisorClosestToQuotient ∷ Integral a ⇒ a → a → a Source #
Find the whole divisor of a that is the closest to 'a/b'.
If there are multiple divisors with the same distance, the smallest one is returned.
>>>divisorClosestToQuotient 10 32>>>divisorClosestToQuotient 10 52>>>divisorClosestToQuotient 6 101