Skip to content

Commit

Permalink
Fix str cmp assert breaking the stack
Browse files Browse the repository at this point in the history
  • Loading branch information
ChillerDragon committed Aug 24, 2024
1 parent aeb77e5 commit 5e0632c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
4 changes: 4 additions & 0 deletions tests/assert.asm
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ assert_ok:

%macro assert_str_eq 3
; assert_str_eq [expected] [actual] [__LINE__]
push_registers

mov rbp, rsp
sub rsp, 16
mov qword [rbp-16], %1
Expand All @@ -337,6 +339,8 @@ assert_ok:
call assert_ok

mov rsp, rbp

pop_registers
%endmacro

assert_entry:
Expand Down
12 changes: 2 additions & 10 deletions tests/value_to_str_test.asm
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
_start:
init_test __FILE__

; print_label s_assert_expected
; mov rax, rsp
; mov rdi, 8
; call print_hexdump
; call print_newline


test_int_to_str:
mov rax, 10
mov rdi, assert_actual_buf
Expand All @@ -18,6 +11,7 @@ test_int_to_str:
str_to_stack "10"
assert_str_eq rax, rdi, __LINE__
mov rsp, rbp

test_negative_int_to_str0:
mov rax, -10
mov rdi, assert_actual_buf
Expand All @@ -35,7 +29,5 @@ test_ptr_to_str:
assert_str_eq rax, rdi, __LINE__
mov rsp, rbp

; TODO: this fails
exit 0
; end_test __LINE__
end_test __LINE__

0 comments on commit 5e0632c

Please sign in to comment.