| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Test.Ouroboros.Network.TxSubmission.SizedBytes
Description
Values with a CBOR encoding of an exact, chosen size, for testing size
limits of codecs, and TxSubmission2 messages built from them within
given size bounds.
Synopsis
- tests :: TestTree
- newtype SizedBytes = SizedBytes {}
- codec_sized :: forall (m :: Type -> Type). MonadST m => Codec (TxSubmission2 SizedBytes SizedBytes) DeserialiseFailure m ByteString
- data TxSubmission2Bounds = TxSubmission2Bounds {}
- genBoundedMessage :: TxSubmission2Bounds -> Gen (AnyMessage (TxSubmission2 SizedBytes SizedBytes))
- shrinkBoundedMessage :: AnyMessage (TxSubmission2 SizedBytes SizedBytes) -> [AnyMessage (TxSubmission2 SizedBytes SizedBytes)]
- withinBounds :: TxSubmission2Bounds -> AnyMessage (TxSubmission2 SizedBytes SizedBytes) -> Bool
Documentation
newtype SizedBytes Source #
A value represented only by the size of its CBOR encoding, which is a byte string of exactly that many bytes. It can stand in for any encoded value, to build encodings of a chosen size.
Constructors
| SizedBytes | |
Instances
| Arbitrary SizedBytes Source # | Sizes of each width of the CBOR length header, and the sizes at which the width changes. |
| Show SizedBytes Source # | |
Defined in Test.Ouroboros.Network.TxSubmission.SizedBytes Methods showsPrec :: Int -> SizedBytes -> ShowS # show :: SizedBytes -> String # showList :: [SizedBytes] -> ShowS # | |
| Eq SizedBytes Source # | |
codec_sized :: forall (m :: Type -> Type). MonadST m => Codec (TxSubmission2 SizedBytes SizedBytes) DeserialiseFailure m ByteString Source #
data TxSubmission2Bounds Source #
Bounds on the messages generated by genBoundedMessage. Sizes are sizes
of CBOR encodings.
Constructors
| TxSubmission2Bounds | |
Fields
| |
Instances
| Show TxSubmission2Bounds Source # | |
Defined in Test.Ouroboros.Network.TxSubmission.SizedBytes Methods showsPrec :: Int -> TxSubmission2Bounds -> ShowS # show :: TxSubmission2Bounds -> String # showList :: [TxSubmission2Bounds] -> ShowS # | |
genBoundedMessage :: TxSubmission2Bounds -> Gen (AnyMessage (TxSubmission2 SizedBytes SizedBytes)) Source #
Generate any message within the given bounds. Counts and sizes are biased towards the bounds.
shrinkBoundedMessage :: AnyMessage (TxSubmission2 SizedBytes SizedBytes) -> [AnyMessage (TxSubmission2 SizedBytes SizedBytes)] Source #
Shrink a message, keeping its constructor. Fewer txids or txs, and
smaller sizes and counts, keep a message within the bounds it was
generated in (see withinBounds).
withinBounds :: TxSubmission2Bounds -> AnyMessage (TxSubmission2 SizedBytes SizedBytes) -> Bool Source #
Whether a message is within the given bounds; every message generated by
genBoundedMessage is.