1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-15 18:13:56 +03:00
juvix/test/Core/Transformation/Lifting.hs
2023-02-02 11:10:12 +01:00

39 lines
989 B
Haskell

module Core.Transformation.Lifting (allTests) where
import Base
import Core.Eval.Positive qualified as Eval
import Core.Transformation.Base
import Juvix.Compiler.Core.Transformation
allTests :: TestTree
allTests =
testGroup
"Lifting"
[ testGroup "Lambda and LetRec lifting" (map liftTest Eval.tests),
testGroup "Only LetRec lifting" (map letRecLiftTest Eval.tests)
]
liftTest :: Eval.PosTest -> TestTree
liftTest _testEval =
fromTest
Test
{ _testTransformations = pipe,
_testAssertion = \i -> unless (isLifted i) (error "not lambda lifted"),
_testEval
}
where
pipe :: [TransformationId]
pipe = [LambdaLetRecLifting]
letRecLiftTest :: Eval.PosTest -> TestTree
letRecLiftTest _testEval =
fromTest
Test
{ _testTransformations = pipe,
_testAssertion = \i -> unless (isLetRecLifted i) (error "not letrec lifted"),
_testEval
}
where
pipe :: [TransformationId]
pipe = [LetRecLifting]