| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Evaluation.Helpers
Contents
Description
Various helpers for defining evaluation tests.
Synopsis
- forAllByteString :: forall (m :: DefaultFun () -> PropertyT m ByteString #
Given a lower and upper bound (both inclusive) on length, generate a
ByteStringwhose length falls within these bounds. Furthermore, the generatedByteStringwill show as a list of hex-encoded bytes on a failure, instead of the defaultShowoutput.Note
It is the caller's responsibility to ensure that the bounds are sensible: that is, that neither the upper or lower bound are negative, and that the lower bound is not greater than the upper bound.
forAllByteStringThat :: forall (m :: PropertyT m ByteString #
As forAllByteString, but with a postcondition.
Note
If the postcondition is unlikely, the generator may eventually fail after too many retries. Ensure that the postcondition is likely to avoid problems.
Evaluation helpers
evaluateTheSame :: DefaultFun () -> PropertyT IO () #
Typechecks and evaluates both PLC expressions. If either of them fail to typecheck, fail the
test, noting what the failure was. If both typecheck, but either errors when run, fail the test,
noting the log(s) for any failing expression. If both run without error, compare the results
using DefaultFun () -> PropertyT IO () #
As evaluateTheSame, but for cases where we want to compare a more complex computation to a
constant (as if by mkConstant). This is slightly more efficient.
assertEvaluatesToConstant :: forall (a :: DefaultFun () -> PropertyT IO a #
Given a PLC expression and an intended type (via a type argument), typecheck the expression, evaluate it, then produce the required Haskell value from the results. If we fail at any stage, instead fail the test and report the failure.