From 2c2f0c048b1bcac8ffa5dd5a99e2ce1fe91efd11 Mon Sep 17 00:00:00 2001 From: Jakub Doka Date: Sun, 27 Oct 2024 19:13:25 +0100 Subject: [PATCH] cleaning up tests --- lang/README.md | 2 +- lang/src/son.rs | 2 +- lang/tests/son_tests_arrays.txt | 14 ++++++------ lang/tests/son_tests_intcast_store.txt | 9 ++++---- lang/tests/son_tests_request_page.txt | 5 ++--- .../son_tests_signed_to_unsigned_upcast.txt | 5 ++--- lang/tests/son_tests_smh_happened.txt | 0 ...s.txt => son_tests_struct_in_register.txt} | 0 lang/tests/son_tests_struct_patterns.txt | 22 +++++++++---------- 9 files changed, 28 insertions(+), 31 deletions(-) delete mode 100644 lang/tests/son_tests_smh_happened.txt rename lang/tests/{son_tests_structs_in_registers.txt => son_tests_struct_in_register.txt} (100%) diff --git a/lang/README.md b/lang/README.md index 025e5b9..2d6ad49 100644 --- a/lang/README.md +++ b/lang/README.md @@ -776,7 +776,7 @@ sqrt := fn(x: uint): uint { } ``` -#### structs_in_registers +#### struct_in_register ```hb ColorBGRA := struct {b: u8, g: u8, r: u8, a: u8} MAGENTA := ColorBGRA.{b: 205, g: 0, r: 205, a: 255} diff --git a/lang/src/son.rs b/lang/src/son.rs index 783d359..4ef84d3 100644 --- a/lang/src/son.rs +++ b/lang/src/son.rs @@ -3684,7 +3684,7 @@ mod tests { different_types; struct_return_from_module_function; sort_something_viredly; - //structs_in_registers; + struct_in_register; comptime_function_from_another_file; inline_test; inlined_generic_functions; diff --git a/lang/tests/son_tests_arrays.txt b/lang/tests/son_tests_arrays.txt index d9e2165..bdc1c3d 100644 --- a/lang/tests/son_tests_arrays.txt +++ b/lang/tests/son_tests_arrays.txt @@ -1,12 +1,12 @@ main: ADDI64 r254, r254, -36d ST r31, r254, 28a, 8h - LI8 r1, 0b - ST r1, r254, 0a, 1h - ST r1, r254, 1a, 1h - LI8 r5, 255b - ST r5, r254, 2a, 1h - LI8 r8, 1b + LI8 r2, 0b + ST r2, r254, 0a, 1h + ST r2, r254, 1a, 1h + LI16 r4, 511h + ST r4, r254, 2a, 1h + LI16 r8, 1h ST r8, r254, 3a, 1h LI64 r11, 1d ADDI64 r2, r254, 4d @@ -31,6 +31,6 @@ pass: LD r1, r10, 0a, 8h ADD64 r1, r1, r9 JALA r0, r31, 0a -code size: 316 +code size: 318 ret: 8 status: Ok(()) diff --git a/lang/tests/son_tests_intcast_store.txt b/lang/tests/son_tests_intcast_store.txt index 5172d11..a1d01be 100644 --- a/lang/tests/son_tests_intcast_store.txt +++ b/lang/tests/son_tests_intcast_store.txt @@ -16,15 +16,14 @@ set: ADDI64 r254, r254, -25d LI8 r7, 5b ST r7, r254, 0a, 1h - ANDI r10, r4, 4294967295d - ST r10, r254, 1a, 4h - LI32 r1, 8w - ST r1, r254, 5a, 4h + ST r4, r254, 1a, 4h + LI64 r11, 8d + ST r11, r254, 5a, 4h ST r2, r254, 9a, 8h ST r3, r254, 17a, 8h LD r1, r254, 1a, 4h ADDI64 r254, r254, 25d JALA r0, r31, 0a -code size: 284 +code size: 277 ret: 1024 status: Ok(()) diff --git a/lang/tests/son_tests_request_page.txt b/lang/tests/son_tests_request_page.txt index b7cf60c..03c37f1 100644 --- a/lang/tests/son_tests_request_page.txt +++ b/lang/tests/son_tests_request_page.txt @@ -3,7 +3,6 @@ create_back_buffer: ST r31, r254, 0a, 48h LI64 r32, 255d JGTS r2, r32, :0 - AND r2, r2, r32 JAL r31, r0, :request_page JMP :1 0: CP r33, r2 @@ -21,7 +20,7 @@ create_back_buffer: CP r2, r34 JAL r31, r0, :request_page JMP :4 - 3: AND r2, r33, r32 + 3: CP r2, r33 JAL r31, r0, :request_page 4: SUB64 r33, r33, r32 JMP :5 @@ -44,6 +43,6 @@ request_page: LI64 r2, 3d ECA JALA r0, r31, 0a -code size: 336 +code size: 331 ret: 42 status: Ok(()) diff --git a/lang/tests/son_tests_signed_to_unsigned_upcast.txt b/lang/tests/son_tests_signed_to_unsigned_upcast.txt index 75c8045..ecb617f 100644 --- a/lang/tests/son_tests_signed_to_unsigned_upcast.txt +++ b/lang/tests/son_tests_signed_to_unsigned_upcast.txt @@ -1,7 +1,6 @@ main: - LI32 r1, 1w - ANDI r1, r1, 4294967295d + LI64 r1, 1d JALA r0, r31, 0a -code size: 36 +code size: 29 ret: 1 status: Ok(()) diff --git a/lang/tests/son_tests_smh_happened.txt b/lang/tests/son_tests_smh_happened.txt deleted file mode 100644 index e69de29..0000000 diff --git a/lang/tests/son_tests_structs_in_registers.txt b/lang/tests/son_tests_struct_in_register.txt similarity index 100% rename from lang/tests/son_tests_structs_in_registers.txt rename to lang/tests/son_tests_struct_in_register.txt diff --git a/lang/tests/son_tests_struct_patterns.txt b/lang/tests/son_tests_struct_patterns.txt index b377b50..a141e79 100644 --- a/lang/tests/son_tests_struct_patterns.txt +++ b/lang/tests/son_tests_struct_patterns.txt @@ -33,22 +33,22 @@ fib_iter: JMP :2 1: JALA r0, r31, 0a main: - ADDI64 r254, r254, -26d - ST r31, r254, 2a, 24h - LI8 r32, 10b - ST r32, r254, 0a, 1h - ST r32, r254, 1a, 1h + ADDI64 r254, r254, -18d + ST r31, r254, 2a, 16h + LI8 r1, 10b + ST r1, r254, 0a, 1h + ST r1, r254, 1a, 1h LD r5, r254, 0a, 1h ANDI r2, r5, 255d JAL r31, r0, :fib - CP r33, r1 - ANDI r2, r32, 255d + CP r32, r1 + LI64 r2, 10d JAL r31, r0, :fib_iter - CP r4, r33 + CP r4, r32 SUB64 r1, r4, r1 - LD r31, r254, 2a, 24h - ADDI64 r254, r254, 26d + LD r31, r254, 2a, 16h + ADDI64 r254, r254, 18d JALA r0, r31, 0a -code size: 354 +code size: 353 ret: 0 status: Ok(())