| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Evaluation.Builtins.Bitwise.CIP0122
Description
Tests for CIP-0122 (the first batch of bitwise builtins)
Synopsis
- abelianSemigroupLaws ∷ String → DefaultFun → Bool → TestTree
- abelianMonoidLaws ∷ String → DefaultFun → Bool → ByteString → TestTree
- idempotenceLaw ∷ String → DefaultFun → Bool → TestTree
- absorbtionLaw ∷ String → DefaultFun → Bool → ByteString → TestTree
- leftDistributiveLaw ∷ String → String → DefaultFun → DefaultFun → Bool → TestTree
- distributiveLaws ∷ String → DefaultFun → Bool → TestTree
- xorInvoluteLaw ∷ TestTree
- complementSelfInverse ∷ TestTree
- deMorgan ∷ TestTree
- getSet ∷ TestTree
- setGet ∷ TestTree
- setSet ∷ TestTree
- writeBitsHomomorphismLaws ∷ TestTree
- replicateHomomorphismLaws ∷ TestTree
- replicateIndex ∷ TestTree
Documentation
abelianSemigroupLaws ∷ String → DefaultFun → Bool → TestTree Source #
Checks that the given DefaultFun, under the given semantics, forms an
abelian semigroup: that is, the operation both commutes and associates.
abelianMonoidLaws ∷ String → DefaultFun → Bool → ByteString → TestTree Source #
As abelianSemigroupLaws, but also checks that the provided ByteString
is both a left and right identity.
idempotenceLaw ∷ String → DefaultFun → Bool → TestTree Source #
Checks that the provided DefaultFun, under the given semantics, is
idempotent; namely, that f x x = x for any x.
absorbtionLaw ∷ String → DefaultFun → Bool → ByteString → TestTree Source #
Checks that the provided ByteString is an absorbing element for the
given DefaultFun, under the given semantics. Specifically, given f
as the operation and 0 as the absorbing element, for any x,
f x 0 = f 0 x = 0.
leftDistributiveLaw ∷ String → String → DefaultFun → DefaultFun → Bool → TestTree Source #
Checks that the first DefaultFun distributes over the second from the
left, given the specified semantics (as a Bool). More precisely, for
DefaultFuns f and g, checks that f x (g y z) = g (f x y) (f x z).
distributiveLaws ∷ String → DefaultFun → Bool → TestTree Source #
Checks that the given function self-distributes both left and right.
xorInvoluteLaw ∷ TestTree Source #
If you XOR any ByteString with itself twice, nothing should change.
complementSelfInverse ∷ TestTree Source #
If you complement a ByteString twice, nothing should change.
Checks that:
- The complement of an AND is an OR of complements; and
- The complement of an OR is an AND of complements.
If you retrieve a bit value at an index, then write that same value to the same index, nothing should happen.
If you write a bit value to an index, then retrieve the bit value at the same index, you should get back what you wrote.
writeBitsHomomorphismLaws ∷ TestTree Source #
Checks that:
- Writing with an empty list of positions does nothing; and if you write a
- boolean b with one list of positions, then a second, it is the same as
- writing b with their concatenation.
replicateHomomorphismLaws ∷ TestTree Source #
Checks that:
- Replicating any byte 0 times produces the empty
ByteString; and - Replicating a byte
ntimes, then replicating a bytemtimes and concatenating the results, is the same as replicating that byten + mtimes.
replicateIndex ∷ TestTree Source #
Any call to replicateByteString must produce the same byte at
every valid index, namely the byte specified.