-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
73 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module Reg.Transformation where | ||
|
||
import Base | ||
import Reg.Transformation.Identity qualified as Identity | ||
|
||
allTests :: TestTree | ||
allTests = | ||
testGroup | ||
"JuvixReg transformations" | ||
[ Identity.allTests | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module Reg.Transformation.Base where | ||
|
||
import Base | ||
import Juvix.Compiler.Reg.Data.InfoTable | ||
import Juvix.Compiler.Reg.Transformation | ||
import Reg.Parse.Positive qualified as Parse | ||
import Reg.Run.Base | ||
|
||
data Test = Test | ||
{ _testTransformations :: [TransformationId], | ||
_testAssertion :: InfoTable -> Assertion, | ||
_testRun :: Parse.PosTest | ||
} | ||
|
||
fromTest :: Test -> TestTree | ||
fromTest = mkTest . toTestDescr | ||
|
||
root :: Path Abs Dir | ||
root = relToProject $(mkRelDir "tests/Reg/positive/") | ||
|
||
toTestDescr :: Test -> TestDescr | ||
toTestDescr Test {..} = | ||
let Parse.PosTest {..} = _testRun | ||
tRoot = root <//> _relDir | ||
file' = tRoot <//> _file | ||
expected' = tRoot <//> _expectedFile | ||
in TestDescr | ||
{ _testName = _name, | ||
_testRoot = tRoot, | ||
_testAssertion = Steps $ regRunAssertion file' expected' _testTransformations _testAssertion | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module Reg.Transformation.Identity where | ||
|
||
import Base | ||
import Juvix.Compiler.Reg.Transformation | ||
import Reg.Parse.Positive qualified as Parse | ||
import Reg.Transformation.Base | ||
|
||
allTests :: TestTree | ||
allTests = testGroup "Identity" (map liftTest Parse.tests) | ||
|
||
pipe :: [TransformationId] | ||
pipe = [Identity] | ||
|
||
liftTest :: Parse.PosTest -> TestTree | ||
liftTest _testRun = | ||
fromTest | ||
Test | ||
{ _testTransformations = pipe, | ||
_testAssertion = const (return ()), | ||
_testRun | ||
} |