Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Corruption = Corruption Word
- applyCorruption ∷ Corruption → ByteString → ByteString
- detectCorruption ∷ Show a ⇒ (a → Encoding) → (∀ s. Decoder s (ByteString → a)) → (a → Bool) → a → Corruption → Property
Documentation
newtype Corruption Source #
Instances
Arbitrary Corruption Source # | |
Defined in Test.Util.Corruption arbitrary ∷ Gen Corruption Source # shrink ∷ Corruption → [Corruption] Source # | |
Show Corruption Source # | |
Defined in Test.Util.Corruption |
applyCorruption ∷ Corruption → ByteString → ByteString 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.
∷ Show a | |
⇒ (a → Encoding) | |
→ (∀ s. Decoder s (ByteString → a)) | |
→ (a → Bool) | Integrity check that should detect the corruption. Return |
→ 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.