plutarch-testlib
Safe HaskellNone
LanguageGHC2021

Plutarch.Test.Unit

Description

Utilities for unit testing plutarch terms

Synopsis

Documentation

testCompileFail :: forall (a :: S -> Type). TestName -> (forall (s :: S). Term s a) -> TestTree Source #

Assert that term failed to compile

Since: 1.0.0

testEval :: forall (a :: S -> Type). TestName -> (forall (s :: S). Term s a) -> TestTree Source #

Assert that term compiled and evaluated without errors

Since: 1.0.0

testEvalFail :: forall (a :: S -> Type). TestName -> (forall (s :: S). Term s a) -> TestTree Source #

Assert that term compiled correctly but evaluated with errors

Since: 1.0.0

testEvalEqual Source #

Arguments

:: forall (a :: S -> Type). TestName 
-> (forall (s0 :: S). Term s0 a)

Actual

-> (forall (s1 :: S). Term s1 a)

Expected

-> TestTree 

Assert that term compiled and evaluated without errors and matches the expected value note that comparison is done on AST level, not by Eq or PEq

Since: 1.0.0

testEvalEqualTraces :: forall (a :: S -> Type). TestName -> (forall (s :: S). Term s a) -> LogLevel -> [Text] -> TestTree Source #

Assert that term compiled (with specified tracing level and DetTracing) and evaluated without errors produced traces that match expected value. Note that this succeeds even if script evaluated to error if traces still match

Since: 1.0.0

data TermResult Source #

Since: 1.0.0

Constructors

FailedToCompile Text 
FailedToEvaluate (CekEvaluationException NamedDeBruijn DefaultUni DefaultFun) [Text] 
Evaluated String [Text] 

evalTermResult :: forall (a :: S -> Type). Config -> (forall (s :: S). Term s a) -> TermResult Source #

Since: 1.0.0