ouroboros-network-0.10.1.0: A networking layer for the Ouroboros blockchain protocol
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Ouroboros.Network.PeerSelection.MockEnvironment

Synopsis

Documentation

newtype PeerGraph Source #

The peer graph is the graph of all the peers in the mock p2p network, in traditional adjacency representation.

Constructors

PeerGraph [(PeerAddr, [PeerAddr], PeerInfo)] 

data GovernorMockEnvironment Source #

The data needed to execute the peer selection governor in a test with a mock network environment. It contains the data needed to provide the PeerSelectionActions and PeerSelectionPolicy to run the governor.

The representations are chosen to be easily shrinkable. See the Arbitrary instances.

runGovernorInMockEnvironment :: GovernorMockEnvironment -> SimTrace Void Source #

Run the peerSelectionGovernor in the mock environment dictated by the data in the GovernorMockEnvironment.

The result is an execution trace.

exploreGovernorInMockEnvironment :: Testable test => (ExplorationOptions -> ExplorationOptions) -> GovernorMockEnvironment -> (Maybe (SimTrace Void) -> SimTrace Void -> test) -> Property Source #

selectPeerSelectionTraceEventsUntil :: Time -> SimTrace a -> [(Time, TestTraceEvent)] Source #

newtype Script a #

Constructors

Script (NonEmpty a) 

Instances

Instances details
Foldable Script 
Instance details

Defined in Ouroboros.Network.Testing.Data.Script

Methods

fold :: Monoid m => Script m -> m Source #

foldMap :: Monoid m => (a -> m) -> Script a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Script a -> m Source #

foldr :: (a -> b -> b) -> b -> Script a -> b Source #

foldr' :: (a -> b -> b) -> b -> Script a -> b Source #

foldl :: (b -> a -> b) -> b -> Script a -> b Source #

foldl' :: (b -> a -> b) -> b -> Script a -> b Source #

foldr1 :: (a -> a -> a) -> Script a -> a Source #

foldl1 :: (a -> a -> a) -> Script a -> a Source #

toList :: Script a -> [a] Source #

null :: Script a -> Bool Source #

length :: Script a -> Int Source #

elem :: Eq a => a -> Script a -> Bool Source #

maximum :: Ord a => Script a -> a Source #

minimum :: Ord a => Script a -> a Source #

sum :: Num a => Script a -> a Source #

product :: Num a => Script a -> a Source #

Traversable Script 
Instance details

Defined in Ouroboros.Network.Testing.Data.Script

Methods

traverse :: Applicative f => (a -> f b) -> Script a -> f (Script b) Source #

sequenceA :: Applicative f => Script (f a) -> f (Script a) Source #

mapM :: Monad m => (a -> m b) -> Script a -> m (Script b) Source #

sequence :: Monad m => Script (m a) -> m (Script a) Source #

Functor Script 
Instance details

Defined in Ouroboros.Network.Testing.Data.Script

Methods

fmap :: (a -> b) -> Script a -> Script b Source #

(<$) :: a -> Script b -> Script a Source #

Arbitrary a => Arbitrary (Script a) 
Instance details

Defined in Ouroboros.Network.Testing.Data.Script

Methods

arbitrary :: Gen (Script a)

shrink :: Script a -> [Script a]

Show a => Show (Script a) 
Instance details

Defined in Ouroboros.Network.Testing.Data.Script

Eq a => Eq (Script a) 
Instance details

Defined in Ouroboros.Network.Testing.Data.Script

Methods

(==) :: Script a -> Script a -> Bool Source #

(/=) :: Script a -> Script a -> Bool Source #

type PickScript peeraddr = Script (PickMembers peeraddr) #

arbitraryPickScript :: Gen (Set peeraddr) -> Gen (PickScript peeraddr) #

arbitraryScriptOf :: Int -> Gen a -> Gen (Script a) #

initScript' :: MonadSTM m => Script a -> m (TVar m (Script a)) #

interpretPickScript :: forall (m :: Type -> Type) peeraddr. (MonadSTM m, Ord peeraddr) => TVar m (PickScript peeraddr) -> Set peeraddr -> Int -> STM m (Set peeraddr) #

playTimedScript :: (MonadAsync m, MonadDelay m) => Tracer m a -> TimedScript a -> m (TVar m a) #

prop_shrink_Script :: ShrinkCarefully (Script Int) -> Property #

stepScript :: MonadSTM m => TVar m (Script a) -> m a #

stepScriptSTM' :: forall (m :: Type -> Type) a. MonadSTM m => TVar m (Script a) -> STM m a #

tests :: TestTree Source #