plutus-core-1.45.0.0: Language library for Plutus Core
Safe HaskellSafe-Inferred
LanguageHaskell2010

Evaluation.Builtins.Bitwise.CIP0122

Description

Tests for CIP-0122 (the first batch of bitwise builtins)

Synopsis

Documentation

abelianSemigroupLawsStringDefaultFunBoolTestTree Source #

Checks that the given DefaultFun, under the given semantics, forms an abelian semigroup: that is, the operation both commutes and associates.

abelianMonoidLawsStringDefaultFunBoolByteStringTestTree Source #

As abelianSemigroupLaws, but also checks that the provided ByteString is both a left and right identity.

idempotenceLawStringDefaultFunBoolTestTree Source #

Checks that the provided DefaultFun, under the given semantics, is idempotent; namely, that f x x = x for any x.

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

leftDistributiveLawStringStringDefaultFunDefaultFunBoolTestTree 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).

distributiveLawsStringDefaultFunBoolTestTree Source #

Checks that the given function self-distributes both left and right.

xorInvoluteLawTestTree Source #

If you XOR any ByteString with itself twice, nothing should change.

complementSelfInverseTestTree Source #

If you complement a ByteString twice, nothing should change.

deMorganTestTree Source #

Checks that:

  • The complement of an AND is an OR of complements; and
  • The complement of an OR is an AND of complements.

getSetTestTree Source #

If you retrieve a bit value at an index, then write that same value to the same index, nothing should happen.

setGetTestTree Source #

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.

setSetTestTree Source #

If you write twice to the same bit index, the second write should win.

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

replicateHomomorphismLawsTestTree Source #

Checks that:

  • Replicating any byte 0 times produces the empty ByteString; and
  • Replicating a byte n times, then replicating a byte m times and concatenating the results, is the same as replicating that byte n + m times.

replicateIndexTestTree Source #

Any call to replicateByteString must produce the same byte at every valid index, namely the byte specified.