ouroboros-consensus-0.21.0.0: Consensus layer for the Ouroboros blockchain protocol
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Util.Corruption

Synopsis

Documentation

newtype Corruption Source #

Constructors

Corruption Word 

Instances

Instances details
Arbitrary Corruption Source # 
Instance details

Defined in Test.Util.Corruption

Show Corruption Source # 
Instance details

Defined in Test.Util.Corruption

applyCorruptionCorruptionByteStringByteString Source #

Increment (overflow if necessary) the byte at position i in the bytestring, where i = n mod length bs.

If the bytestring is empty, return it unmodified.

detectCorruption Source #

Arguments

Show a 
⇒ (a → Encoding) 
→ (∀ s. Decoder s (ByteString → a)) 
→ (a → Bool)

Integrity check that should detect the corruption. Return False when corrupt.

→ a 
Corruption 
Property 

Serialise a, apply the given corruption, deserialise it, when that fails, the corruption was detected. When deserialising the corrupted bytestring succeeds, pass the deserialised value to the integrity checking function. If that function returns False, the corruption was detected, if it returns True, the corruption was not detected and the test fails.