aboutsummaryrefslogtreecommitdiff
path: root/tests/test_hello_world.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_hello_world.py')
-rw-r--r--tests/test_hello_world.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/test_hello_world.py b/tests/test_hello_world.py
index 594ab4f..0377392 100644
--- a/tests/test_hello_world.py
+++ b/tests/test_hello_world.py
@@ -1,12 +1,12 @@
import unittest
-from crowbar_reference_compiler import compile_to_ssa, parse_header, parse_implementation, scan
+from crowbar_reference_compiler import build_ast, build_ssa, parse_header, parse_implementation, scan
class TestHelloWorld(unittest.TestCase):
def test_ssa(self):
code = r"""
-include "stdio.hro";
+//include "stdio.hro";
int32 main() {
printf("Hello, world!\n");
@@ -15,14 +15,17 @@ int32 main() {
"""
tokens = scan(code)
parse_tree = parse_implementation(tokens)
- actual_ssa = compile_to_ssa(parse_tree)
+ ast = build_ast(parse_tree, [])
+ actual_ssa = build_ssa(ast)
expected_ssa = r"""
data $data0 = { b "Hello, world!\n", b 0 }
export function w $main() {
@start
- call $printf(l $data0, ...)
- ret 0
+ %t0 =l copy $data0
+ call $printf(l %t0, ...)
+ %t1 =w copy 0
+ ret %t1
}
""".strip()
self.assertEqual(expected_ssa, actual_ssa)