| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Test.Consensus.Committee.WFALS.Model.Utils
Contents
Description
Utility functions for the WFALS model tests.
Synopsis
- genStake ∷ Gen (Stake 'Ledger 'Global)
- genUniqueVoterIds ∷ Int → Gen [VoterId]
- genStakeDistr ∷ Int → Gen (StakeDistr 'Ledger 'Global)
- forAllValidStakeDistrAndNumSeats ∷ (StakeDistr 'Ledger 'Global → NumSeats 'Global → Property) → Property
- forAllPossiblyInvalidStakeDistrAndNumSeats ∷ (StakeDistr 'Ledger 'Global → NumSeats 'Global → Property) → Property
- tabulateTargetNumSeats ∷ NumSeats 'Global → Property → Property
- tabulateStakeDistrSize ∷ StakeDistr 'Ledger 'Global → Property → Property
- tabulatePersistentToNonPersistentRatio ∷ NumSeats 'Global → NumSeats 'Global → Property → Property
Generators
genUniqueVoterIds ∷ Int → Gen [VoterId] Source #
Generate a non-empty list of unique voter IDs of a given size.
genStakeDistr ∷ Int → Gen (StakeDistr 'Ledger 'Global) Source #
Generate a non-empty random stake distribution of a given size
NOTE: the size is shifted up by one to ensure non-emptiness.
Property helpers
forAllValidStakeDistrAndNumSeats ∷ (StakeDistr 'Ledger 'Global → NumSeats 'Global → Property) → Property Source #
Helper to generate stake distributions along with a number of seats that lies within the acceptable range [1, #{nodes with positive stake}]
forAllPossiblyInvalidStakeDistrAndNumSeats ∷ (StakeDistr 'Ledger 'Global → NumSeats 'Global → Property) → Property Source #
Helper to generate stake distributions along with a number of seats that could possibly be invalid in different ways, e.g., too many expected seats or an empty stake distribution.
tabulateTargetNumSeats ∷ NumSeats 'Global → Property → Property Source #
Tabulate the target number of seats
tabulateStakeDistrSize ∷ StakeDistr 'Ledger 'Global → Property → Property Source #
Tabulate the size of a stake distribution