Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- tests :: TestTree
- newtype ArbitraryPortNumber = ArbitraryPortNumber {}
- newtype ArbitraryRelayAccessPoint = ArbitraryRelayAccessPoint {}
- newtype ArbitraryLedgerStateJudgement = ArbitraryLedgerStateJudgement {}
- newtype ArbitrarySlotNo = ArbitrarySlotNo {}
- data StakePool = StakePool {}
- newtype LedgerPools = LedgerPools {}
- calculateRelativeStake :: [StakePool] -> [(PoolStake, NonEmpty RelayAccessPoint)]
- genLedgerPoolsFrom :: [RelayAccessPoint] -> Gen LedgerPools
- newtype ArbLedgerPeersKind = ArbLedgerPeersKind LedgerPeersKind
- newtype ArbStakeMapOverSource = ArbStakeMapOverSource {}
- prop_ledgerPeerSnapshot_requests :: ArbStakeMapOverSource -> Property
- prop_pick100 :: Word16 -> NonNegative Int -> ArbLedgerPeersKind -> MockRoots -> DelayAndTimeoutScripts -> ArbitrarySlotNo -> ArbitraryLedgerStateJudgement -> Property
- prop_pick :: LedgerPools -> ArbLedgerPeersKind -> Word16 -> Word16 -> MockRoots -> Script DNSLookupDelay -> ArbitrarySlotNo -> ArbitraryLedgerStateJudgement -> Property
- prop_accumulateBigLedgerStake :: LedgerPools -> Property
- prop_recomputeRelativeStake :: LedgerPools -> Property
- prop_getLedgerPeers :: ArbitrarySlotNo -> ArbitraryLedgerStateJudgement -> LedgerPools -> ArbitrarySlotNo -> Property
- prop_ledgerPeerSnapshotCBORV1 :: ArbitrarySlotNo -> LedgerPools -> Property
- prop_ledgerPeerSnapshotJSONV1 :: ArbitrarySlotNo -> LedgerPools -> Property
- snapshotV1 :: ArbitrarySlotNo -> LedgerPools -> LedgerPeerSnapshot
- data SimResult a
- = SimReturn a [String]
- | SimException SomeException [String]
- | SimDeadLock [String]
- evaluateTrace :: SimTrace a -> IO (SimResult a)
- data WithThreadAndTime a = WithThreadAndTime {
- wtatOccuredAt :: !Time
- wtatWithinThread :: !String
- wtatEvent :: !a
- verboseTracer :: forall a (m :: Type -> Type). (MonadSay m, Show a) => Tracer m a
- threadAndTimeTracer :: forall a (m :: Type -> Type). (MonadAsync m, MonadMonotonicTime m) => Tracer m (WithThreadAndTime a) -> Tracer m a
Documentation
newtype ArbitraryPortNumber Source #
Instances
newtype ArbitraryRelayAccessPoint Source #
Instances
newtype ArbitraryLedgerStateJudgement Source #
Instances
newtype ArbitrarySlotNo Source #
Instances
Arbitrary ArbitrarySlotNo Source # | |
Defined in Test.Ouroboros.Network.LedgerPeers arbitrary :: Gen ArbitrarySlotNo # shrink :: ArbitrarySlotNo -> [ArbitrarySlotNo] # | |
Show ArbitrarySlotNo Source # | |
Defined in Test.Ouroboros.Network.LedgerPeers showsPrec :: Int -> ArbitrarySlotNo -> ShowS # show :: ArbitrarySlotNo -> String # showList :: [ArbitrarySlotNo] -> ShowS # |
newtype LedgerPools Source #
Instances
Arbitrary LedgerPools Source # | |
Defined in Test.Ouroboros.Network.LedgerPeers arbitrary :: Gen LedgerPools # shrink :: LedgerPools -> [LedgerPools] # | |
Show LedgerPools Source # | |
Defined in Test.Ouroboros.Network.LedgerPeers showsPrec :: Int -> LedgerPools -> ShowS # show :: LedgerPools -> String # showList :: [LedgerPools] -> ShowS # |
calculateRelativeStake :: [StakePool] -> [(PoolStake, NonEmpty RelayAccessPoint)] Source #
newtype ArbLedgerPeersKind Source #
Instances
Arbitrary ArbLedgerPeersKind Source # | |
Defined in Test.Ouroboros.Network.LedgerPeers | |
Show ArbLedgerPeersKind Source # | |
Defined in Test.Ouroboros.Network.LedgerPeers showsPrec :: Int -> ArbLedgerPeersKind -> ShowS # show :: ArbLedgerPeersKind -> String # showList :: [ArbLedgerPeersKind] -> ShowS # |
newtype ArbStakeMapOverSource Source #
Instances
Arbitrary ArbStakeMapOverSource Source # | |
Show ArbStakeMapOverSource Source # | |
Defined in Test.Ouroboros.Network.LedgerPeers showsPrec :: Int -> ArbStakeMapOverSource -> ShowS # show :: ArbStakeMapOverSource -> String # showList :: [ArbStakeMapOverSource] -> ShowS # |
prop_ledgerPeerSnapshot_requests :: ArbStakeMapOverSource -> Property Source #
This test checks whether requesting ledger peers works as intended when snapshot data is available. For each request, peers must be returned from the right source - either the ledger or snapshot, depending on whether which source is fresher.
:: Word16 | |
-> NonNegative Int | number of pools with 0 stake |
-> ArbLedgerPeersKind | |
-> MockRoots | |
-> DelayAndTimeoutScripts | |
-> ArbitrarySlotNo | |
-> ArbitraryLedgerStateJudgement | |
-> Property |
A pool with 100% stake should always be picked.
prop_pick :: LedgerPools -> ArbLedgerPeersKind -> Word16 -> Word16 -> MockRoots -> Script DNSLookupDelay -> ArbitrarySlotNo -> ArbitraryLedgerStateJudgement -> Property Source #
Verify that given at least one peer we manage to pick count
peers.
prop_recomputeRelativeStake :: LedgerPools -> Property Source #
This functions checks the following properties: 1. The accumulated relative stake adds up to unity 2. No pool relative stake can be less than 0 3. The relays aren't mangled 4. Running this function multiple times always produces the same result
prop_getLedgerPeers :: ArbitrarySlotNo -> ArbitraryLedgerStateJudgement -> LedgerPools -> ArbitrarySlotNo -> Property Source #
prop_ledgerPeerSnapshotCBORV1 :: ArbitrarySlotNo -> LedgerPools -> Property Source #
Checks validity of LedgerPeerSnapshot CBOR encoding, and whether round trip cycle is the identity function
prop_ledgerPeerSnapshotJSONV1 :: ArbitrarySlotNo -> LedgerPools -> Property Source #
Tests if LedgerPeerSnapshot JSON round trip is the identity function
snapshotV1 :: ArbitrarySlotNo -> LedgerPools -> LedgerPeerSnapshot Source #
helper functions for ledgerpeersnapshot encoding tests
data WithThreadAndTime a Source #
WithThreadAndTime | |
|
Instances
Show a => Show (WithThreadAndTime a) Source # | |
Defined in Test.Ouroboros.Network.LedgerPeers showsPrec :: Int -> WithThreadAndTime a -> ShowS # show :: WithThreadAndTime a -> String # showList :: [WithThreadAndTime a] -> ShowS # |
threadAndTimeTracer :: forall a (m :: Type -> Type). (MonadAsync m, MonadMonotonicTime m) => Tracer m (WithThreadAndTime a) -> Tracer m a Source #