plutus-core-1.60.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

abelianMonoidLaws :: DefaultFun -> TestTree #

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

idempotenceLaw :: DefaultFun -> TestTree #

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

absorbtionLaw :: DefaultFun -> TestTree #

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 :: DefaultFun -> TestTree #

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 :: DefaultFun -> TestTree #

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

setGet :: TestTree #

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.

setSet :: TestTree #

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.

replicateIndex :: TestTree #

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