plutus-conformance- Conformance Test Suite for Plutus Core
Safe HaskellSafe-Inferred



Plutus conformance test suite library.



shownParseError ∷ Text Source #

The default shown text when a parse error occurs. We don't want to show the detailed parse errors so that users of the test suite can produce the expected output more easily.

shownEvaluationFailure ∷ Text Source #

The default shown text when evaluation fails.

parseTxt ∷ Text → Either ParserErrorBundle (Program Name DefaultUni DefaultFun SrcSpan) Source #

The default parser to parse UPLC program inputs.

type UplcProg = Program Name DefaultUni DefaultFun () Source #

The input/output UPLC program type.

data UplcEvaluator Source #

The evaluator to be tested.


UplcEvaluatorWithoutCosting (UplcEvaluatorFun UplcProg)

An evaluator that just produces an output program, or fails.

UplcEvaluatorWithCosting (CostModelParamsUplcEvaluatorFun (UplcProg, ExBudget))

An evaluator that produces an output program along with the cost of evaluating it, or fails. Note that nothing cares about the cost of failing programs, so we don't test for conformance there.

discoverTests Source #



The evaluator to be tested.

→ (FilePathBool)

A function that takes a test name and returns whether it should be labelled as ExpectedFailure.


The directory to search for tests.

IO TestTree 

Walk a file tree, making test groups for directories with subdirectories, and test cases for directories without.

expectedToProg ∷ Text → Either Text UplcProg Source #

Turn the expected file content in text to a UplcProg unless the expected result is a parse or evaluation error.

getTestedValueUplcEvaluatorFun res → FilePathIO (Either Text res) Source #

Get the tested value. The tested value is either the shown parse or evaluation error, or a UplcProg.

compareAlphaEq Source #


Either Text UplcProg

golden value

Either Text UplcProg

tested value

Maybe String

If two values are the same, it returns Nothing. If they are different, it returns an error that will be printed to the user.

The comparison function used for the golden test. This function checks alpha-equivalence of programs when the output is a program.

updateGoldenFile Source #



the path to write the golden file to

Either Text UplcProg 
IO () 

Update the golden file with the tested value. TODO abstract out for other tests.

runUplcEvalTests Source #



The action to run the input through for the tests.

→ (FilePathBool)

A function that takes a test name and returns whether it should labelled as ExpectedFailure.

IO () 

Run the UPLC evaluation tests given an evaluator that evaluates UPLC programs.