Skip to content

Commit

Permalink
Re-organize tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
thealmarty committed Jun 28, 2022
1 parent bfc7273 commit d0be54d
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 57 deletions.
12 changes: 12 additions & 0 deletions plutus-conformance/agda/Spec.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{- | Conformance tests for the Agda implementation. -}

module Main (main) where

import MAlonzo.Code.Main (runUAgda)
import PlutusConformance.Common (agdaEvalUplcProg, runUplcEvalTests)

main :: IO ()
main =
-- UPLC evaluation tests
runUplcEvalTests agdaEvalUplcProg

Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ main = do
putStrLn $ inputFile <> " failed to parse. Error written to " <> outFilePath
T.writeFile outFilePath shownParseError
Right pro -> do
-- catch all sync exceptions and keep going
-- (we still need this even with `evalUplcProg` using the safe eval function)
case evalUplcProg (() <$ pro) of
(Just prog) -> do
T.writeFile outFilePath (render $ pretty prog)
Expand Down
11 changes: 11 additions & 0 deletions plutus-conformance/haskell/Spec.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{- | Conformance tests for the Haskell implementation. -}

module Main (main) where

import PlutusConformance.Common (evalUplcProg, runUplcEvalTests)

main :: IO ()
main =
-- UPLC evaluation tests
runUplcEvalTests evalUplcProg

33 changes: 19 additions & 14 deletions plutus-conformance/plutus-conformance.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ executable add-test-output
import: lang
type: exitcode-stdio-1.0
main-is: Spec.hs
hs-source-dirs: add-test-output/
hs-source-dirs: executables/add-test-output/
other-modules:
build-depends:
, base >=4.9 && <5
Expand All @@ -71,34 +71,39 @@ executable add-test-output
, tasty-golden
, text

test-suite uplc-eval-test
executable haskell-implementation
import: lang
type: exitcode-stdio-1.0
main-is: Spec.hs
hs-source-dirs: uplc/evaluation
hs-source-dirs: executables/haskell-implementation
other-modules:
build-depends:
, base >=4.9 && <5
, base >=4.9 && <5
, directory
, optparse-applicative
, plutus-conformance
, plutus-core
, tasty-golden
, text

test-suite tplc-eval-test
test-suite haskell-implementation-conformance
import: lang
type: exitcode-stdio-1.0
main-is: Spec.hs
hs-source-dirs: tplc/evaluation
hs-source-dirs: haskell
other-modules:
build-depends:
, base >=4.9 && <5
, tasty-golden
, text
, base >=4.9 && <5
, plutus-conformance
, plutus-core

test-suite tplc-typecheck-test
test-suite agda-implementation-conformance
import: lang
type: exitcode-stdio-1.0
main-is: Spec.hs
hs-source-dirs: tplc/typecheck
hs-source-dirs: agda
other-modules:
build-depends:
, base >=4.9 && <5
, tasty-golden
, text
, base >=4.9 && <5
, plutus-conformance
, plutus-metatheory
6 changes: 5 additions & 1 deletion plutus-conformance/src/PlutusConformance/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ parseTxt ::
-> Either ParserErrorBundle (UPLC.Program Name DefaultUni DefaultFun SourcePos)
parseTxt resTxt = runQuoteT $ UPLC.parseProgram resTxt

-- | Our `evaluator` for the UPLC tests is the CEK machine.
-- | Our `evaluator` for the Haskell UPLC tests is the CEK machine.
evalUplcProg :: UplcEvaluator
evalUplcProg = traverseOf UPLC.progTerm eval
where
Expand All @@ -138,6 +138,10 @@ evalUplcProg = traverseOf UPLC.progTerm eval
Left _ -> Nothing
Right prog -> Just prog

-- | Our `evaluator` for the Agda UPLC tests is the CEK machine.
agdaEvalUplcProg :: UplcProg -> Maybe UplcProg
agdaEvalUplcProg _p = undefined

-- | Run the tests given a `evaluator` that evaluates UPLC programs.
runUplcEvalTests ::
UplcEvaluator -- ^ The action to run the input through for the tests.
Expand Down
15 changes: 0 additions & 15 deletions plutus-conformance/tplc/evaluation/Spec.hs

This file was deleted.

15 changes: 0 additions & 15 deletions plutus-conformance/tplc/typecheck/Spec.hs

This file was deleted.

10 changes: 0 additions & 10 deletions plutus-conformance/uplc/evaluation/Spec.hs

This file was deleted.

0 comments on commit d0be54d

Please sign in to comment.