| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Test.Consensus.Committee.Utils
Description
Utility functions for the voting committee tests.
Synopsis
- mkPoolId ∷ String → PoolId
- unfairWFATiebreaker ∷ WFATiebreaker
- genEpochNonce ∷ Gen Nonce
- genPositiveStake ∷ Gen LedgerStake
- genPools ∷ Int → Gen (privateKey, publicKey) → Gen (Map PoolId (privateKey, publicKey, LedgerStake))
- eqWithShowCmp ∷ (a → String) → (a → a → Bool) → a → a → Property
- onError ∷ Either err a → (err → a) → a
- mkBucket ∷ Integer → Integer → String
- tabulateNumPools ∷ Map PoolId (privateKey, publicKey, LedgerStake) → Property → Property
- tabulatePoolStake ∷ LedgerStake → Property → Property
General utilities
mkPoolId ∷ String → PoolId Source #
Create a pool ID from an arbitrary string of any length.
NOTE: we are assuming that this function preserves uniqueness.
unfairWFATiebreaker ∷ WFATiebreaker Source #
An unfair tie-breaker that compares pool IDs lexicographically.
QuickCheck generators
genEpochNonce ∷ Gen Nonce Source #
Generate a random nonce for testing purposes.
genPositiveStake ∷ Gen LedgerStake Source #
Generate a positive stake value using a geometric distribution.
Arguments
| ∷ Int | Maximum number of pools to generate |
| → Gen (privateKey, publicKey) | Keypair generator |
| → Gen (Map PoolId (privateKey, publicKey, LedgerStake)) |
Generate a non-empty map of pools with crypto keys and varying stakes.
NOTE: the generator ensures at least one pool has positive stake.
Property helpers
Arguments
| ∷ (a → String) | Custom show function |
| → (a → a → Bool) | Custom equality function |
| → a | First value |
| → a | Second value |
| → Property |
Check equality using a custom comparison and show function.
Create a bucketized label for tabulation.
Tabulation helpers
tabulateNumPools ∷ Map PoolId (privateKey, publicKey, LedgerStake) → Property → Property Source #
Tabulate the number of pools in a test run.
tabulatePoolStake ∷ LedgerStake → Property → Property Source #
Tabulate whether a pool has positive or zero stake.