Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- tests :: TestTree
- data VersionNumber
- versionNumberCodec :: CodecCBORTerm (String, Maybe Int) VersionNumber
- versionNumberHandshakeCodec :: forall (m :: Type -> Type). (MonadST m, MonadThrow m) => Codec (Handshake VersionNumber Term) DeserialiseFailure m ByteString
- data VersionData = VersionData {
- dataVersion0 :: Int
- dataVersion1 :: Bool
- dataVersion2 :: Bool
- dataCodecCBORTerm :: VersionNumber -> CodecCBORTerm Text VersionData
- arbitraryVersionData :: VersionNumber -> Gen VersionData
- application :: VersionData -> VersionData -> Bool
- genValidVersion :: VersionNumber -> Gen (Version VersionData Bool)
- genInvalidVersion :: VersionNumber -> Gen (Version VersionData Bool)
- genValidVersions :: Gen (Versions VersionNumber VersionData Bool)
- genVersions :: Gen (Versions VersionNumber VersionData Bool)
- newtype ArbitraryValidVersions = ArbitraryValidVersions {}
- prop_arbitrary_ArbitraryValidVersions :: ArbitraryValidVersions -> Bool
- prop_shrink_ArbitraryValidVersions :: ArbitraryValidVersions -> Bool
- data ArbitraryVersions = ArbitraryVersions (Versions VersionNumber VersionData Bool) (Versions VersionNumber VersionData Bool)
- validVersion :: VersionNumber -> Version VersionData Bool -> Bool
- prop_arbitrary_ArbitraryVersions :: ArbitraryVersions -> Property
- maybeAccept :: Accept a -> Maybe a
- prop_connect :: ArbitraryVersions -> Property
- prop_channel :: (MonadAsync m, MonadCatch m, MonadST m) => m (Channel m ByteString, Channel m ByteString) -> Versions VersionNumber VersionData Bool -> Versions VersionNumber VersionData Bool -> m Property
- prop_channel_ST :: ArbitraryVersions -> Property
- prop_channel_IO :: ArbitraryVersions -> Property
- prop_pipe_IO :: ArbitraryVersions -> Property
- prop_channel_asymmetric :: (MonadAsync m, MonadCatch m, MonadLabelledSTM m, MonadMask m, MonadST m) => m (Channel m ByteString, Channel m ByteString) -> Versions VersionNumber VersionData Bool -> m Property
- prop_channel_asymmetric_ST :: ArbitraryVersions -> Property
- prop_channel_asymmetric_IO :: ArbitraryVersions -> Property
- prop_pipe_asymmetric_IO :: ArbitraryVersions -> Property
- newtype ArbitraryNodeToNodeVersion = ArbitraryNodeToNodeVersion {}
- newtype ArbitraryNodeToNodeVersionData = ArbitraryNodeToNodeVersionData {}
- newtype ArbitraryNodeToNodeVersions = ArbitraryNodeToNodeVersions {}
- newtype ArbitraryNodeToClientVersion = ArbitraryNodeToClientVersion {}
- newtype ArbitraryNodeToClientVersionData = ArbitraryNodeToClientVersionData {}
- newtype ArbitraryNodeToClientVersions = ArbitraryNodeToClientVersions {}
- prop_acceptable_symmetric :: (Acceptable vData, Eq vData) => vData -> vData -> Bool
- prop_acceptable_symmetric_VersionData :: VersionData -> VersionData -> Bool
- prop_acceptable_symmetric_NodeToNode :: ArbitraryNodeToNodeVersionData -> ArbitraryNodeToNodeVersionData -> Bool
- prop_acceptable_symmetric_NodeToClient :: ArbitraryNodeToClientVersionData -> ArbitraryNodeToClientVersionData -> Bool
- prop_query_version_NodeToNode_ST :: ArbitraryNodeToNodeVersions -> ArbitraryNodeToNodeVersions -> Property
- prop_query_version_NodeToNode_IO :: ArbitraryNodeToNodeVersions -> ArbitraryNodeToNodeVersions -> Property
- prop_query_version_NodeToNode_SimNet :: ArbitraryNodeToNodeVersions -> ArbitraryNodeToNodeVersions -> Property
- prop_query_version_NodeToClient_ST :: ArbitraryNodeToClientVersions -> ArbitraryNodeToClientVersions -> Property
- prop_query_version_NodeToClient_IO :: ArbitraryNodeToClientVersions -> ArbitraryNodeToClientVersions -> Property
- prop_query_version_NodeToClient_SimNet :: ArbitraryNodeToClientVersions -> ArbitraryNodeToClientVersions -> Property
- prop_query_version :: (MonadAsync m, MonadCatch m, MonadST m, Eq vData, Acceptable vData, Queryable vData, Show vData, Ord vNumber, Show vNumber) => m (Channel m ByteString, Channel m ByteString) -> Codec (Handshake vNumber Term) DeserialiseFailure m ByteString -> VersionDataCodec Term vNumber vData -> Versions vNumber vData Bool -> Versions vNumber vData Bool -> (vData -> vData) -> m Property
- prop_peerSharing_symmetric :: (MonadAsync m, MonadCatch m, MonadST m) => m (Channel m ByteString, Channel m ByteString) -> Codec (Handshake NodeToNodeVersion Term) DeserialiseFailure m ByteString -> VersionDataCodec Term NodeToNodeVersion ArbitraryNodeToNodeVersionData -> Versions NodeToNodeVersion ArbitraryNodeToNodeVersionData Bool -> Versions NodeToNodeVersion ArbitraryNodeToNodeVersionData Bool -> m Property
- prop_peerSharing_symmetric_NodeToNode_SimNet :: ArbitraryNodeToNodeVersions -> ArbitraryNodeToNodeVersions -> Property
- prop_acceptOrRefuse_symmetric :: forall vNumber vData r. (Acceptable vData, Eq vData, Show vData, Ord vNumber, Show vNumber, Eq r, Show r) => Versions vNumber vData r -> Versions vNumber vData r -> Property
- prop_acceptOrRefuse_symmetric_VersionData :: ArbitraryVersions -> Property
- prop_acceptOrRefuse_symmetric_NodeToNode :: ArbitraryNodeToNodeVersions -> ArbitraryNodeToNodeVersions -> Property
- prop_acceptOrRefuse_symmetric_NodeToClient :: ArbitraryNodeToClientVersions -> ArbitraryNodeToClientVersions -> Property
- prop_channel_simultaneous_open :: (MonadAsync m, MonadCatch m, MonadST m, Acceptable vData, Ord vNumber) => m (Channel m ByteString, Channel m ByteString) -> Codec (Handshake vNumber Term) DeserialiseFailure m ByteString -> VersionDataCodec Term vNumber vData -> Versions vNumber vData Bool -> Versions vNumber vData Bool -> m Property
- prop_channel_simultaneous_open_ST :: ArbitraryVersions -> Property
- prop_channel_simultaneous_open_IO :: ArbitraryVersions -> Property
- prop_channel_simultaneous_open_NodeToNode_ST :: ArbitraryNodeToNodeVersions -> ArbitraryNodeToNodeVersions -> Property
- transformNodeToNodeVersionData :: CodecCBORTerm Text NodeToNodeVersionData -> CodecCBORTerm Text ArbitraryNodeToNodeVersionData
- prop_channel_simultaneous_open_NodeToNode_IO :: ArbitraryNodeToNodeVersions -> ArbitraryNodeToNodeVersions -> Property
- prop_channel_simultaneous_open_NodeToClient_ST :: ArbitraryNodeToClientVersions -> ArbitraryNodeToClientVersions -> Property
- prop_channel_simultaneous_open_NodeToClient_IO :: ArbitraryNodeToClientVersions -> ArbitraryNodeToClientVersions -> Property
- prop_channel_simultaneous_open_sim :: forall vNumber vData m. (Alternative (STM m), MonadAsync m, MonadCatch m, MonadDelay m, MonadFork m, MonadLabelledSTM m, MonadMask m, MonadMonotonicTime m, MonadST m, MonadThrow (STM m), MonadTime m, MonadTimer m, Acceptable vData, Ord vNumber) => Codec (Handshake vNumber Term) DeserialiseFailure m ByteString -> VersionDataCodec Term vNumber vData -> Versions vNumber vData Bool -> Versions vNumber vData Bool -> m Property
- prop_channel_simultaneous_open_SimNet :: ArbitraryVersions -> Property
- prop_channel_simultaneous_open_NodeToNode_SimNet :: ArbitraryNodeToNodeVersions -> ArbitraryNodeToNodeVersions -> Property
- prop_channel_simultaneous_open_NodeToClient_SimNet :: ArbitraryNodeToClientVersions -> ArbitraryNodeToClientVersions -> Property
- newtype ArbitraryRefuseReason = ArbitraryRefuseReason {}
- prop_codec_RefuseReason :: ArbitraryRefuseReason -> Bool
- prop_codec_Handshake :: AnyMessage (Handshake VersionNumber Term) -> Bool
- prop_codec_splits2_Handshake :: AnyMessage (Handshake VersionNumber Term) -> Bool
- prop_codec_splits3_Handshake :: AnyMessage (Handshake VersionNumber Term) -> Bool
- prop_codec_cbor :: AnyMessage (Handshake VersionNumber Term) -> Bool
- prop_codec_valid_cbor :: AnyMessage (Handshake VersionNumber Term) -> Property
Documentation
data VersionNumber Source #
Testing version number
Instances
versionNumberHandshakeCodec :: forall (m :: Type -> Type). (MonadST m, MonadThrow m) => Codec (Handshake VersionNumber Term) DeserialiseFailure m ByteString Source #
data VersionData Source #
VersionData | |
|
Instances
application :: VersionData -> VersionData -> Bool Source #
genValidVersion :: VersionNumber -> Gen (Version VersionData Bool) Source #
Generate a valid ProtocolVersion
VersionNumber
r
genInvalidVersion :: VersionNumber -> Gen (Version VersionData Bool) Source #
Generate an invalid
.ProtocolVersion
VersionNumber
r
genValidVersions :: Gen (Versions VersionNumber VersionData Bool) Source #
Generate valid Versions
.
genVersions :: Gen (Versions VersionNumber VersionData Bool) Source #
Generate possibly invalid Versions
.
newtype ArbitraryValidVersions Source #
Instances
data ArbitraryVersions Source #
Generators for pairs of arbitrary list of versions.
ArbitraryVersions (Versions VersionNumber VersionData Bool) (Versions VersionNumber VersionData Bool) |
Instances
Arbitrary ArbitraryVersions Source # | |
Defined in Ouroboros.Network.Protocol.Handshake.Test | |
Show ArbitraryVersions Source # | |
Defined in Ouroboros.Network.Protocol.Handshake.Test showsPrec :: Int -> ArbitraryVersions -> ShowS # show :: ArbitraryVersions -> String # showList :: [ArbitraryVersions] -> ShowS # |
validVersion :: VersionNumber -> Version VersionData Bool -> Bool Source #
Check if a
is valid.ProtocolVersion
VersionNumber
r
maybeAccept :: Accept a -> Maybe a Source #
prop_connect :: ArbitraryVersions -> Property Source #
Run a handshake protocol, without going via a channel.
prop_channel :: (MonadAsync m, MonadCatch m, MonadST m) => m (Channel m ByteString, Channel m ByteString) -> Versions VersionNumber VersionData Bool -> Versions VersionNumber VersionData Bool -> m Property Source #
Run a simple block-fetch client and server using connected channels.
prop_channel_ST :: ArbitraryVersions -> Property Source #
Run prop_channel
in the simulation monad.
prop_channel_IO :: ArbitraryVersions -> Property Source #
Run prop_channel
in the IO monad.
prop_pipe_IO :: ArbitraryVersions -> Property Source #
Run prop_channel
in the IO monad using local pipes.
prop_channel_asymmetric Source #
:: (MonadAsync m, MonadCatch m, MonadLabelledSTM m, MonadMask m, MonadST m) | |
=> m (Channel m ByteString, Channel m ByteString) | |
-> Versions VersionNumber VersionData Bool | client versions |
-> m Property |
prop_channel_asymmetric_ST :: ArbitraryVersions -> Property Source #
Run prop_channel
in the simulation monad.
prop_channel_asymmetric_IO :: ArbitraryVersions -> Property Source #
Run prop_channel
in the IO monad.
prop_pipe_asymmetric_IO :: ArbitraryVersions -> Property Source #
Run prop_channel
in the IO monad using local pipes.
newtype ArbitraryNodeToNodeVersion Source #
Instances
newtype ArbitraryNodeToNodeVersionData Source #
Instances
Arbitrary ArbitraryNodeToNodeVersionData Source # | |
Show ArbitraryNodeToNodeVersionData Source # | |
Defined in Ouroboros.Network.Protocol.Handshake.Test | |
Eq ArbitraryNodeToNodeVersionData Source # | With the introduction of PeerSharing to |
Acceptable ArbitraryNodeToNodeVersionData Source # | |
Queryable ArbitraryNodeToNodeVersionData Source # | |
newtype ArbitraryNodeToNodeVersions Source #
Instances
newtype ArbitraryNodeToClientVersion Source #
Instances
Arbitrary ArbitraryNodeToClientVersion Source # | |
Show ArbitraryNodeToClientVersion Source # | |
Defined in Ouroboros.Network.Protocol.Handshake.Test showsPrec :: Int -> ArbitraryNodeToClientVersion -> ShowS # show :: ArbitraryNodeToClientVersion -> String # showList :: [ArbitraryNodeToClientVersion] -> ShowS # |
newtype ArbitraryNodeToClientVersionData Source #
newtype ArbitraryNodeToClientVersions Source #
Instances
Arbitrary ArbitraryNodeToClientVersions Source # | |
Show ArbitraryNodeToClientVersions Source # | |
Defined in Ouroboros.Network.Protocol.Handshake.Test showsPrec :: Int -> ArbitraryNodeToClientVersions -> ShowS # show :: ArbitraryNodeToClientVersions -> String # showList :: [ArbitraryNodeToClientVersions] -> ShowS # |
prop_acceptable_symmetric :: (Acceptable vData, Eq vData) => vData -> vData -> Bool Source #
prop_acceptable_symmetric_NodeToNode :: ArbitraryNodeToNodeVersionData -> ArbitraryNodeToNodeVersionData -> Bool Source #
prop_acceptable_symmetric_NodeToClient :: ArbitraryNodeToClientVersionData -> ArbitraryNodeToClientVersionData -> Bool Source #
prop_query_version_NodeToNode_ST :: ArbitraryNodeToNodeVersions -> ArbitraryNodeToNodeVersions -> Property Source #
Run prop_query_version
in the simulation monad.
prop_query_version_NodeToNode_IO :: ArbitraryNodeToNodeVersions -> ArbitraryNodeToNodeVersions -> Property Source #
Run prop_query_version
in the IO monad.
prop_query_version_NodeToNode_SimNet :: ArbitraryNodeToNodeVersions -> ArbitraryNodeToNodeVersions -> Property Source #
Run prop_query_version
with SimNet.
prop_query_version_NodeToClient_ST :: ArbitraryNodeToClientVersions -> ArbitraryNodeToClientVersions -> Property Source #
Run prop_query_version
in the simulation monad.
prop_query_version_NodeToClient_IO :: ArbitraryNodeToClientVersions -> ArbitraryNodeToClientVersions -> Property Source #
Run prop_query_version
in the IO monad.
prop_query_version_NodeToClient_SimNet :: ArbitraryNodeToClientVersions -> ArbitraryNodeToClientVersions -> Property Source #
Run prop_query_version
with SimNet.
prop_query_version :: (MonadAsync m, MonadCatch m, MonadST m, Eq vData, Acceptable vData, Queryable vData, Show vData, Ord vNumber, Show vNumber) => m (Channel m ByteString, Channel m ByteString) -> Codec (Handshake vNumber Term) DeserialiseFailure m ByteString -> VersionDataCodec Term vNumber vData -> Versions vNumber vData Bool -> Versions vNumber vData Bool -> (vData -> vData) -> m Property Source #
Run a query for the server's supported version.
prop_peerSharing_symmetric :: (MonadAsync m, MonadCatch m, MonadST m) => m (Channel m ByteString, Channel m ByteString) -> Codec (Handshake NodeToNodeVersion Term) DeserialiseFailure m ByteString -> VersionDataCodec Term NodeToNodeVersion ArbitraryNodeToNodeVersionData -> Versions NodeToNodeVersion ArbitraryNodeToNodeVersionData Bool -> Versions NodeToNodeVersion ArbitraryNodeToNodeVersionData Bool -> m Property Source #
Run a query for the server's supported version.
prop_peerSharing_symmetric_NodeToNode_SimNet :: ArbitraryNodeToNodeVersions -> ArbitraryNodeToNodeVersions -> Property Source #
Run prop_peerSharing_symmetric
with SimNet.
prop_acceptOrRefuse_symmetric :: forall vNumber vData r. (Acceptable vData, Eq vData, Show vData, Ord vNumber, Show vNumber, Eq r, Show r) => Versions vNumber vData r -> Versions vNumber vData r -> Property Source #
acceptOrRefuse
is symmetric in the following sense:
Either both sides: * accept the same version and version data; or * refuse
The refuse reason might differ, although if one side refuses it with
Refused
the other side must refuse the same version.
prop_acceptOrRefuse_symmetric_NodeToNode :: ArbitraryNodeToNodeVersions -> ArbitraryNodeToNodeVersions -> Property Source #
prop_acceptOrRefuse_symmetric_NodeToClient :: ArbitraryNodeToClientVersions -> ArbitraryNodeToClientVersions -> Property Source #
prop_channel_simultaneous_open :: (MonadAsync m, MonadCatch m, MonadST m, Acceptable vData, Ord vNumber) => m (Channel m ByteString, Channel m ByteString) -> Codec (Handshake vNumber Term) DeserialiseFailure m ByteString -> VersionDataCodec Term vNumber vData -> Versions vNumber vData Bool -> Versions vNumber vData Bool -> m Property Source #
Run two handshake clients against each other, which simulates a TCP simultaneous open.
prop_channel_simultaneous_open_ST :: ArbitraryVersions -> Property Source #
Run prop_channel_simultaneous_open
in the simulation monad.
prop_channel_simultaneous_open_IO :: ArbitraryVersions -> Property Source #
Run prop_channel_simultaneous_open
in the IO monad.
prop_channel_simultaneous_open_NodeToNode_ST :: ArbitraryNodeToNodeVersions -> ArbitraryNodeToNodeVersions -> Property Source #
transformNodeToNodeVersionData :: CodecCBORTerm Text NodeToNodeVersionData -> CodecCBORTerm Text ArbitraryNodeToNodeVersionData Source #
prop_channel_simultaneous_open_NodeToNode_IO :: ArbitraryNodeToNodeVersions -> ArbitraryNodeToNodeVersions -> Property Source #
prop_channel_simultaneous_open_NodeToClient_ST :: ArbitraryNodeToClientVersions -> ArbitraryNodeToClientVersions -> Property Source #
prop_channel_simultaneous_open_NodeToClient_IO :: ArbitraryNodeToClientVersions -> ArbitraryNodeToClientVersions -> Property Source #
prop_channel_simultaneous_open_sim :: forall vNumber vData m. (Alternative (STM m), MonadAsync m, MonadCatch m, MonadDelay m, MonadFork m, MonadLabelledSTM m, MonadMask m, MonadMonotonicTime m, MonadST m, MonadThrow (STM m), MonadTime m, MonadTimer m, Acceptable vData, Ord vNumber) => Codec (Handshake vNumber Term) DeserialiseFailure m ByteString -> VersionDataCodec Term vNumber vData -> Versions vNumber vData Bool -> Versions vNumber vData Bool -> m Property Source #
prop_channel_simultaneous_open_NodeToNode_SimNet :: ArbitraryNodeToNodeVersions -> ArbitraryNodeToNodeVersions -> Property Source #
prop_channel_simultaneous_open_NodeToClient_SimNet :: ArbitraryNodeToClientVersions -> ArbitraryNodeToClientVersions -> Property Source #
newtype ArbitraryRefuseReason Source #
Instances
Arbitrary ArbitraryRefuseReason Source # | |
Show ArbitraryRefuseReason Source # | |
Defined in Ouroboros.Network.Protocol.Handshake.Test showsPrec :: Int -> ArbitraryRefuseReason -> ShowS # show :: ArbitraryRefuseReason -> String # showList :: [ArbitraryRefuseReason] -> ShowS # | |
Eq ArbitraryRefuseReason Source # | |
Defined in Ouroboros.Network.Protocol.Handshake.Test (==) :: ArbitraryRefuseReason -> ArbitraryRefuseReason -> Bool # (/=) :: ArbitraryRefuseReason -> ArbitraryRefuseReason -> Bool # |
prop_codec_valid_cbor :: AnyMessage (Handshake VersionNumber Term) -> Property Source #
Check that the encoder produces a valid CBOR.