From e2a8373c423b838996e7eff42e9ec43f230abd9f Mon Sep 17 00:00:00 2001 From: mlokr Date: Fri, 13 Sep 2024 18:23:00 +0200 Subject: [PATCH] updating tests --- hblang/tests/codegen_tests_c_strings.txt | 5 ++-- ...ts_comptime_function_from_another_file.txt | 2 +- hblang/tests/codegen_tests_directives.txt | 2 +- hblang/tests/codegen_tests_generic_types.txt | 28 +++++++++---------- .../tests/codegen_tests_global_variables.txt | 2 +- hblang/tests/codegen_tests_inline_test.txt | 2 +- ...codegen_tests_integer_inference_issues.txt | 2 +- hblang/tests/codegen_tests_request_page.txt | 2 +- .../tests/codegen_tests_struct_patterns.txt | 2 +- ...sts_struct_return_from_module_function.txt | 24 ++++++++-------- .../codegen_tests_writing_into_string.txt | 4 +-- 11 files changed, 37 insertions(+), 38 deletions(-) diff --git a/hblang/tests/codegen_tests_c_strings.txt b/hblang/tests/codegen_tests_c_strings.txt index 852ab9c..b770918 100644 --- a/hblang/tests/codegen_tests_c_strings.txt +++ b/hblang/tests/codegen_tests_c_strings.txt @@ -1,12 +1,11 @@ main: ADDI64 r254, r254, -24d ST r31, r254, 0a, 24h - LRA r32, r0, :abඞ - 56789 + LRA r32, r0, :"abඞ\n\r\t56789\0" CP r2, r32 JAL r31, r0, :str_len CP r32, r1 - LRA r33, r0, :fff + LRA r33, r0, :"fff\0" CP r2, r33 JAL r31, r0, :str_len CP r33, r1 diff --git a/hblang/tests/codegen_tests_comptime_function_from_another_file.txt b/hblang/tests/codegen_tests_comptime_function_from_another_file.txt index 39a050a..86ad55c 100644 --- a/hblang/tests/codegen_tests_comptime_function_from_another_file.txt +++ b/hblang/tests/codegen_tests_comptime_function_from_another_file.txt @@ -6,6 +6,6 @@ main: LD r31, r254, 0a, 16h ADDI64 r254, r254, 16d JALA r0, r31, 0a -code size: 239 +code size: 95 ret: 50 status: Ok(()) diff --git a/hblang/tests/codegen_tests_directives.txt b/hblang/tests/codegen_tests_directives.txt index f3d453c..19bb2cb 100644 --- a/hblang/tests/codegen_tests_directives.txt +++ b/hblang/tests/codegen_tests_directives.txt @@ -22,6 +22,6 @@ main: ADDI64 r254, r254, 80d JALA r0, r31, 0a ev: Ecall -code size: 234 +code size: 230 ret: 0 status: Ok(()) diff --git a/hblang/tests/codegen_tests_generic_types.txt b/hblang/tests/codegen_tests_generic_types.txt index d0aafa4..1cec9c8 100644 --- a/hblang/tests/codegen_tests_generic_types.txt +++ b/hblang/tests/codegen_tests_generic_types.txt @@ -32,6 +32,19 @@ deinit: LD r31, r254, 0a, 24h ADDI64 r254, r254, 24d JALA r0, r31, 0a +new: + ADDI64 r254, r254, -24d + ST r31, r254, 0a, 24h + CP r32, r1 + LI64 r33, 0d + ST r33, r32, 0a, 8h + LI64 r33, 0d + ST r33, r32, 8a, 8h + LI64 r33, 0d + ST r33, r32, 16a, 8h + LD r31, r254, 0a, 24h + ADDI64 r254, r254, 24d + JALA r0, r31, 0a free: ADDI64 r254, r254, -40d ST r31, r254, 0a, 40h @@ -124,19 +137,6 @@ malloc: LD r31, r254, 0a, 32h ADDI64 r254, r254, 32d JALA r0, r31, 0a -new: - ADDI64 r254, r254, -24d - ST r31, r254, 0a, 24h - CP r32, r1 - LI64 r33, 0d - ST r33, r32, 0a, 8h - LI64 r33, 0d - ST r33, r32, 8a, 8h - LI64 r33, 0d - ST r33, r32, 16a, 8h - LD r31, r254, 0a, 24h - ADDI64 r254, r254, 24d - JALA r0, r31, 0a -code size: 1332 +code size: 1201 ret: 69 status: Ok(()) diff --git a/hblang/tests/codegen_tests_global_variables.txt b/hblang/tests/codegen_tests_global_variables.txt index 181df45..f1b89c6 100644 --- a/hblang/tests/codegen_tests_global_variables.txt +++ b/hblang/tests/codegen_tests_global_variables.txt @@ -11,6 +11,6 @@ main: LD r31, r254, 0a, 32h ADDI64 r254, r254, 32d JALA r0, r31, 0a -code size: 299 +code size: 146 ret: 55 status: Ok(()) diff --git a/hblang/tests/codegen_tests_inline_test.txt b/hblang/tests/codegen_tests_inline_test.txt index 514c31c..7f67cf1 100644 --- a/hblang/tests/codegen_tests_inline_test.txt +++ b/hblang/tests/codegen_tests_inline_test.txt @@ -156,6 +156,6 @@ line: 2: LD r31, r254, 48a, 32h ADDI64 r254, r254, 80d JALA r0, r31, 0a -code size: 1416 +code size: 1400 ret: 0 status: Ok(()) diff --git a/hblang/tests/codegen_tests_integer_inference_issues.txt b/hblang/tests/codegen_tests_integer_inference_issues.txt index 3558654..36eb5eb 100644 --- a/hblang/tests/codegen_tests_integer_inference_issues.txt +++ b/hblang/tests/codegen_tests_integer_inference_issues.txt @@ -24,6 +24,6 @@ integer_range: LD r31, r254, 0a, 32h ADDI64 r254, r254, 32d JALA r0, r31, 0a -code size: 214 +code size: 210 ret: 42 status: Ok(()) diff --git a/hblang/tests/codegen_tests_request_page.txt b/hblang/tests/codegen_tests_request_page.txt index a85f4d4..7a905e5 100644 --- a/hblang/tests/codegen_tests_request_page.txt +++ b/hblang/tests/codegen_tests_request_page.txt @@ -42,7 +42,7 @@ request_page: ADDI64 r254, r254, -32d ST r31, r254, 0a, 32h CP r32, r2 - LRA r33, r0, :"\0\u{1}xxxxxxxx" + LRA r33, r0, :"\0\u{1}xxxxxxxx\0" CP r34, r33 ADDI64 r34, r34, 1d ST r32, r34, 0a, 1h diff --git a/hblang/tests/codegen_tests_struct_patterns.txt b/hblang/tests/codegen_tests_struct_patterns.txt index aee57f7..d599dbe 100644 --- a/hblang/tests/codegen_tests_struct_patterns.txt +++ b/hblang/tests/codegen_tests_struct_patterns.txt @@ -60,6 +60,6 @@ fib: 1: LD r31, r254, 0a, 32h ADDI64 r254, r254, 32d JALA r0, r31, 0a -code size: 464 +code size: 452 ret: 0 status: Ok(()) diff --git a/hblang/tests/codegen_tests_struct_return_from_module_function.txt b/hblang/tests/codegen_tests_struct_return_from_module_function.txt index 716c114..bec0270 100644 --- a/hblang/tests/codegen_tests_struct_return_from_module_function.txt +++ b/hblang/tests/codegen_tests_struct_return_from_module_function.txt @@ -1,14 +1,3 @@ -foo: - ADDI64 r254, r254, -8d - ST r31, r254, 0a, 8h - LI64 r1, 3d - ANDI r2, r2, -4294967296d - ORI r2, r2, 2d - ANDI r2, r2, 4294967295d - ORI r2, r2, 8589934592d - LD r31, r254, 0a, 8h - ADDI64 r254, r254, 8d - JALA r0, r31, 0a main: ADDI64 r254, r254, -40d ST r31, r254, 16a, 24h @@ -32,6 +21,17 @@ main: LD r31, r254, 16a, 24h ADDI64 r254, r254, 40d JALA r0, r31, 0a -code size: 317 +foo: + ADDI64 r254, r254, -8d + ST r31, r254, 0a, 8h + LI64 r1, 3d + ANDI r2, r2, -4294967296d + ORI r2, r2, 2d + ANDI r2, r2, 4294967295d + ORI r2, r2, 8589934592d + LD r31, r254, 0a, 8h + ADDI64 r254, r254, 8d + JALA r0, r31, 0a +code size: 313 ret: 0 status: Ok(()) diff --git a/hblang/tests/codegen_tests_writing_into_string.txt b/hblang/tests/codegen_tests_writing_into_string.txt index 989afd0..87b8955 100644 --- a/hblang/tests/codegen_tests_writing_into_string.txt +++ b/hblang/tests/codegen_tests_writing_into_string.txt @@ -9,14 +9,14 @@ main: inl: ADDI64 r254, r254, -16d ST r31, r254, 0a, 16h - LRA r32, r0, :luhahah + LRA r32, r0, :"luhahah\0" LD r31, r254, 0a, 16h ADDI64 r254, r254, 16d JALA r0, r31, 0a outl: ADDI64 r254, r254, -16d ST r31, r254, 0a, 16h - LRA r32, r0, :whahaha + LRA r32, r0, :"whahaha\0" LD r31, r254, 0a, 16h ADDI64 r254, r254, 16d JALA r0, r31, 0a