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

Evaluation.Builtins.Bitwise.Conformance

Description

Share Hedgehog inputs and terms between assertions and conformance generation.

Synopsis

Documentation

data Check Source #

A property check expressed without performing it. Normal QuickCheck suites interpret it as an assertion, the Hedgehog suites have their own interpreter, and the test generator extracts its terms, first checking with checkHolds that the reference implementation satisfies the property for the sampled input.

Constructors

CheckEq PlcTerm PlcTerm

Both terms evaluate successfully to equal results.

CheckEvaluatesTo PlcTerm TypeErrorOrCekResult

The term evaluates to the given result.

CheckTrue PlcTerm

The term evaluates successfully to True.

CheckOk PlcTerm

The term evaluates successfully.

CheckFails PlcTerm

The term fails to evaluate.

CheckBoth Check Check

Both checks must hold. When generating, each check contributes its own numbered cases, so one sampled input can use several numbers.

CheckImplies Bool Check 
CheckDistinct [PlcTerm]

All terms evaluate successfully to pairwise distinct results.

CheckSatisfies String PlcTerm (TypeErrorOrCekResult → Bool)

The term's result satisfies the predicate, labelled for failure reports.

Instances

Instances details
Testable Check Source # 
Instance details

Defined in Evaluation.Builtins.Conformance

Methods

property ∷ Check → Property #

propertyForAllShrinkShow ∷ Gen a → (a → [a]) → (a → [String]) → (a → Check) → Property #

Show Check Source #

Shows the terms of a check; the predicate of CheckSatisfies is omitted.

Instance details

Defined in Evaluation.Builtins.Conformance

checkConstant ∷ ∀ a. Contains DefaultUni a ⇒ a → PlcTerm → Gen Check Source #

Compare a term's result with a constant. The constant is only used by the normal tests; the generated tests export the term alone.

checkProperty ∷ Gen Check → Property Source #

Keep Hedgehog's input shrinking and normal assertion reporting.

generateBitwisePropertyFiles ∷ OutputFormat → CheckMode → FilePath → Int → QCGen → PropertyId → String → Gen Check → IO Generated Source #

Sample Hedgehog generators directly, with seeds derived from the executable's QuickCheck seed. No property runner or assertions are involved. Discarded inputs are retried, and the lazy stream stops at the requested case count. Equality cases retain both terms, numbered together with -A/-B suffixes.