Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- tests :: TestTree
- newtype TestAddress = TestAddress Int
- data Event
- eventPeer :: Event -> TestAddress
- eventSlot :: Event -> SlotNo
- newtype FixedScript = FixedScript {}
- mkFixedScript :: Script Event -> FixedScript
- mkTimedScript :: FixedScript -> TimedScript Event
- data PeerMetricsTrace = PeerMetricsTrace {}
- simulatePeerMetricScript :: (MonadDelay m, MonadLabelledSTM m) => Tracer m PeerMetricsTrace -> PeerMetricsConfiguration -> FixedScript -> m ()
- interpretScriptDelay :: ScriptDelay -> DiffTime
- prop_insert_peer :: FixedScript -> Property
- prop_metrics_are_bounded :: FixedScript -> Property
- prop_bounded_size :: Positive Int -> FixedScript -> Property
- microbenchmark1GenerateInput :: Bool -> Int -> IO FixedScript
- microbenchmark1ProcessInput :: FixedScript -> IO ()
- microbenchmark1 :: Bool -> Int -> IO ()
- prop_simScript :: FixedScript -> Property
- simulatePeerMetricScriptWithoutDelays :: MonadLabelledSTM m => Tracer m PeerMetricsTrace -> PeerMetricsConfiguration -> FixedScript -> m ()
Documentation
newtype TestAddress Source #
Instances
eventPeer :: Event -> TestAddress Source #
newtype FixedScript Source #
Instances
Arbitrary FixedScript Source # | |
Defined in Test.Ouroboros.Network.PeerSelection.PeerMetric arbitrary :: Gen FixedScript # shrink :: FixedScript -> [FixedScript] # | |
Show FixedScript Source # | |
Defined in Test.Ouroboros.Network.PeerSelection.PeerMetric showsPrec :: Int -> FixedScript -> ShowS # show :: FixedScript -> String # showList :: [FixedScript] -> ShowS # |
mkFixedScript :: Script Event -> FixedScript Source #
Order events by SlotNo
TODO: SizeInBytes
should be a function of SlotNo
data PeerMetricsTrace Source #
Instances
Show PeerMetricsTrace Source # | |
Defined in Test.Ouroboros.Network.PeerSelection.PeerMetric showsPrec :: Int -> PeerMetricsTrace -> ShowS # show :: PeerMetricsTrace -> String # showList :: [PeerMetricsTrace] -> ShowS # |
simulatePeerMetricScript :: (MonadDelay m, MonadLabelledSTM m) => Tracer m PeerMetricsTrace -> PeerMetricsConfiguration -> FixedScript -> m () Source #
prop_insert_peer :: FixedScript -> Property Source #
Check that newly added peer is never in the 20% worst performing peers (if there are at least 5 results).
prop_metrics_are_bounded :: FixedScript -> Property Source #
Check that the results are always positive.
prop_bounded_size :: Positive Int -> FixedScript -> Property Source #
Check that the result are bounded.
The bound is maxEntriesToTrack
times number of peers in the simulation.
This could be lowered by computing number of peers in each
maxEntriesToTrack
slots window.
microbenchmark1GenerateInput :: Bool -> Int -> IO FixedScript Source #
microbenchmark1 n - one test of simple property on a FixedScript of length n: one input, one property, one test.
We split into generating input and running/checking it so we can more accurately measure the latter.
microbenchmark1ProcessInput :: FixedScript -> IO () Source #
prop_simScript :: FixedScript -> Property Source #
one simple property (pmtUpstreamyness >= 0) checked on the trace of a script:
simulatePeerMetricScriptWithoutDelays :: MonadLabelledSTM m => Tracer m PeerMetricsTrace -> PeerMetricsConfiguration -> FixedScript -> m () Source #
similar to simulatePeerMetricScript
: but we don't do in
"real/simulated" time: not calling getMonotonicTime and
threadDelay.