2022-09-06 16:26:48 +03:00
|
|
|
module Core.Transformation.Base where
|
|
|
|
|
|
|
|
import Base
|
2022-10-12 11:19:02 +03:00
|
|
|
import Core.Eval.Base
|
|
|
|
import Core.Eval.Positive qualified as Eval
|
2022-09-06 16:26:48 +03:00
|
|
|
import Juvix.Compiler.Core.Data.InfoTable
|
|
|
|
import Juvix.Compiler.Core.Transformation
|
|
|
|
|
|
|
|
data Test = Test
|
2022-10-12 11:19:02 +03:00
|
|
|
{ _testTransformations :: [TransformationId],
|
2022-09-12 13:45:40 +03:00
|
|
|
_testAssertion :: InfoTable -> Assertion,
|
2022-10-12 11:19:02 +03:00
|
|
|
_testEval :: Eval.PosTest
|
2022-09-06 16:26:48 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fromTest :: Test -> TestTree
|
|
|
|
fromTest = mkTest . toTestDescr
|
|
|
|
|
|
|
|
troot :: FilePath
|
|
|
|
troot = "tests/Core/positive/"
|
|
|
|
|
|
|
|
toTestDescr :: Test -> TestDescr
|
2022-10-12 11:19:02 +03:00
|
|
|
toTestDescr Test {..} =
|
|
|
|
let Eval.PosTest {..} = _testEval
|
|
|
|
tRoot = troot </> _relDir
|
|
|
|
in TestDescr
|
|
|
|
{ _testName = _name,
|
|
|
|
_testRoot = tRoot,
|
|
|
|
_testAssertion = Steps $ coreEvalAssertion _file _expectedFile _testTransformations _testAssertion
|
|
|
|
}
|