-
Notifications
You must be signed in to change notification settings - Fork 463
/
Spec.hs
29 lines (23 loc) · 938 Bytes
/
Spec.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{- | Conformance tests for the Haskell implementation. -}
module Main (main) where
import Control.Lens (traverseOf)
import PlutusConformance.Common
import PlutusCore.Evaluation.Machine.ExBudgetingDefaults (defaultCekParameters)
import UntypedPlutusCore qualified as UPLC
import UntypedPlutusCore.Evaluation.Machine.Cek (evaluateCekNoEmit)
-- | Our `evaluator` for the Haskell UPLC tests is the CEK machine.
evalUplcProg :: UplcEvaluator
evalUplcProg = traverseOf UPLC.progTerm eval
where
eval t = do
-- The evaluator throws if the term has free variables
case UPLC.deBruijnTerm t of
Left (_ :: UPLC.FreeVariableError) -> Nothing
Right _ -> Just ()
case evaluateCekNoEmit defaultCekParameters t of
Left _ -> Nothing
Right prog -> Just prog
main :: IO ()
main =
-- UPLC evaluation tests
runUplcEvalTests evalUplcProg