ouroboros-network:ouroboros-network-tests-lib
Safe HaskellNone
LanguageHaskell2010

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

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 

Fields

Instances

Instances details
Arbitrary SizedBytes Source #

Sizes of each width of the CBOR length header, and the sizes at which the width changes.

Instance details

Defined in Test.Ouroboros.Network.TxSubmission.SizedBytes

Show SizedBytes Source # 
Instance details

Defined in Test.Ouroboros.Network.TxSubmission.SizedBytes

Eq SizedBytes Source # 
Instance details

Defined in Test.Ouroboros.Network.TxSubmission.SizedBytes

data TxSubmission2Bounds Source #

Bounds on the messages generated by genBoundedMessage. Sizes are sizes of CBOR encodings.

Constructors

TxSubmission2Bounds 

Fields

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.