| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Test.Consensus.Genesis.Setup
Synopsis
- module Test.Consensus.Genesis.Setup.GenChains
- newtype AdjustTestCount = AdjustTestCount (Int → Int)
- newtype AdjustMaxSize = AdjustMaxSize (Int → Int)
- data ConformanceTest blk = ConformanceTest {
- ctGenerator ∷ Gen (GenesisTestFull blk)
- ctSchedulerConfig ∷ SchedulerConfig
- ctShrinker ∷ GenesisTestFull blk → StateView blk → [GenesisTestFull blk]
- ctProperty ∷ GenesisTestFull blk → StateView blk → Property
- ctAdjustTestCount ∷ AdjustTestCount
- ctAdjustMaxSize ∷ AdjustMaxSize
- ctDescription ∷ String
- castHeaderHash ∷ ChainHash (Header blk) → ChainHash blk
- honestImmutableTip ∷ GetHeader blk ⇒ GenesisTestFull blk → StateView blk → Bool
- mkConformanceTest ∷ Testable prop ⇒ String → AdjustTestCount → AdjustMaxSize → Gen (GenesisTestFull blk) → SchedulerConfig → (GenesisTestFull blk → StateView blk → [GenesisTestFull blk]) → (GenesisTestFull blk → StateView blk → prop) → ConformanceTest blk
- runConformanceTest ∷ (Condense (StateView blk), CondenseList (NodeState blk), ShowProxy blk, ShowProxy (Header blk), ConfigSupportsNode blk, LedgerSupportsProtocol blk, LedgerSupportsPeras blk, SerialiseDiskConstraints blk, BlockSupportsDiffusionPipelining blk, InspectLedger blk, HasHardForkHistory blk, ConvertRawHash blk, CanUpgradeLedgerTables (LedgerState blk), HasPointScheduleTestParams blk, Eq (Header blk), Eq blk, Terse blk, Condense (NodeState blk)) ⇒ ConformanceTest blk → TestTree
- selectedHonestChain ∷ GetHeader blk ⇒ GenesisTestFull blk → StateView blk → Bool
Documentation
newtype AdjustTestCount Source #
A ConformanceTest field type for the adjustment of required number of test runs.
Constructors
| AdjustTestCount (Int → Int) |
newtype AdjustMaxSize Source #
A ConformanceTest field type for maximum test case size adjustment.
Constructors
| AdjustMaxSize (Int → Int) |
data ConformanceTest blk Source #
Contains all necessary data to run a GenesisTest.
It is defined to reify the testing infrastructure for
the conformance testgen executable.
Constructors
| ConformanceTest | |
Fields
| |
castHeaderHash ∷ ChainHash (Header blk) → ChainHash blk Source #
The svSelectedChain produces an 'AnchoredFragment (Header blk)';
this function casts this type's hash to its instance, so that it can be used
for lookups on a BlockTree.
honestImmutableTip ∷ GetHeader blk ⇒ GenesisTestFull blk → StateView blk → Bool Source #
Check if the immutable tip of the selected chain of a GenesisTest is honest.
In this setting, the immutable tip corresponds to the selected chain anchor
(see getCurrentChain) and
the honest chain is represented by the test BlockTree trunk.
Arguments
| ∷ Testable prop | |
| ⇒ String | Test description. |
| → AdjustTestCount | Adjustment of the default number of required test runs. |
| → AdjustMaxSize | Adjustment of the default maximum test size. |
| → Gen (GenesisTestFull blk) | Test generator. |
| → SchedulerConfig | Peer simulator scheduler configuration. |
| → (GenesisTestFull blk → StateView blk → [GenesisTestFull blk]) | Result inspecting shrinker. |
| → (GenesisTestFull blk → StateView blk → prop) | Property on test result. |
| → ConformanceTest blk |
runConformanceTest ∷ (Condense (StateView blk), CondenseList (NodeState blk), ShowProxy blk, ShowProxy (Header blk), ConfigSupportsNode blk, LedgerSupportsProtocol blk, LedgerSupportsPeras blk, SerialiseDiskConstraints blk, BlockSupportsDiffusionPipelining blk, InspectLedger blk, HasHardForkHistory blk, ConvertRawHash blk, CanUpgradeLedgerTables (LedgerState blk), HasPointScheduleTestParams blk, Eq (Header blk), Eq blk, Terse blk, Condense (NodeState blk)) ⇒ ConformanceTest blk → TestTree Source #
All-in-one helper that generates a GenesisTest and a 'Peers
PeerSchedule' from a ConformanceTest, runs them with runGenesisTest,
and checks whether the given property holds on the resulting StateView.
selectedHonestChain ∷ GetHeader blk ⇒ GenesisTestFull blk → StateView blk → Bool Source #
Check if the tip of the selected chain of a GenesisTest is honest.
In this setting, the honest chain corresponds to the test BlockTree trunk.