From b9d56716622263896978725571f5a10aaa9ff72e Mon Sep 17 00:00:00 2001 From: Nicolas Kruse Date: Fri, 29 Aug 2025 22:58:50 +0200 Subject: [PATCH] tests added --- tests/test_ast_gen.py | 8 +------- tests/test_compile.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 tests/test_compile.py diff --git a/tests/test_ast_gen.py b/tests/test_ast_gen.py index 7e085a3..93bd9a2 100644 --- a/tests/test_ast_gen.py +++ b/tests/test_ast_gen.py @@ -1,11 +1,5 @@ -#from diss_helper import dmprint -import pelfy -#from IPython.display import Markdown - -from typing import Literal -from copapy import Op, Write, const +from copapy import Write, const import copapy as rc -from copapy.binwrite import data_writer, Command, RelocationType, get_variable_data, get_function_data, translate_relocation def test_ast_generation(): c1 = const(1.11) diff --git a/tests/test_compile.py b/tests/test_compile.py new file mode 100644 index 0000000..f822f53 --- /dev/null +++ b/tests/test_compile.py @@ -0,0 +1,28 @@ +#from diss_helper import dmprint +import pelfy +#from IPython.display import Markdown + +from typing import Literal +from copapy import Op, Write, const +import copapy as rc +from copapy.binwrite import data_writer, Command, RelocationType, get_variable_data, get_function_data, translate_relocation + +def test_compile(): + c1 = const(1.11) + c2 = const(2.22) + + i1 = c1 * 2 + i2 = i1 + 3 + + r1 = i1 + i2 + r2 = c2 + 4 + c1 + + out = [Write(r1), Write(r2)] + + il = rc.compile_to_instruction_list(out) + + print('#', il.print()) + + +if __name__ == "__main__": + test_compile() \ No newline at end of file