-
Notifications
You must be signed in to change notification settings - Fork 1
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
4 changed files
with
25 additions
and
17 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
21 changes: 21 additions & 0 deletions
21
tests/unit-tests/CompilationLib/Compilation/CompilationTests.hs
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 CompilationLib.Compilation.CompilationTests where | ||
|
||
import Test.Tasty (TestTree, testGroup) | ||
import Test.Tasty.HUnit (testCase, (@=?), assertEqual) | ||
import qualified Parsing.Ast as Ast | ||
import Compilation.RetVal (RetVal(RetVal)) | ||
import Parsing.Ast (Expr(Num)) | ||
import qualified Exec.InferType as Type | ||
import qualified Instruction as Type | ||
import Compilation.Compile (compileConditional) | ||
import Instruction (Instruction(Push)) | ||
|
||
testCompileConditional :: TestTree | ||
testCompileConditional = testGroup "compileConditional" | ||
[ testCase "simple conditional" $ | ||
let ast = Ast.Call "if" [ Ast.Boolean True, Ast.Num 1, Ast.Num 2 ] | ||
reg = (["foo"], []) | ||
RetVal instrs blocks reg' = compileConditional ast reg | ||
in do | ||
assertEqual "instructions" [Type.Conditional [Push "#t"] [Push "1"] [Push "2"]] instrs | ||
] |
16 changes: 0 additions & 16 deletions
16
tests/unit-tests/CompilationLib/Parser/Compilation/CompilationTests.hs
This file was deleted.
Oops, something went wrong.