ouroboros-consensus-test-0.1.0.0: Tests of the consensus layer
Safe HaskellNone
LanguageHaskell2010

Test.Util.Corruption

Synopsis

Documentation

newtype Corruption Source #

Constructors

Corruption Word 

Instances

Instances details
Show Corruption Source # 
Instance details

Defined in Test.Util.Corruption

Arbitrary 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.