Skip to content

Commit

Permalink
test: Fix inp3.c testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
keyvank committed Dec 7, 2024
1 parent 7e329dd commit b70280a
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion examples/inp3.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ int main()
int d = c * (c + a);
printf("Result: %u\n", c + c + d + ((b + a) * a));
int *cc = &c;
printf("Addr of c - Addr of a: %u\n", (int)cc - (int)&a); // 16
printf("Addr of c - Addr of a: %u\n", (int)&a - (int)cc); // 16
printf("Double of 123: %u\n", doub(doub(123 * doub(123)) * 2) + 10);
printf("Factorial 5: %u\n", fact(5));
if (1)
Expand Down
18 changes: 9 additions & 9 deletions tests/output/inp3.c_asm_output.asm
Original file line number Diff line number Diff line change
Expand Up @@ -389,22 +389,22 @@ mov [rbp-290], rax
mov rax, __temp_str_8
mov [rbp-314], rax
mov rax, rbp
sub rax, 290
sub rax, 82
mov [rbp-322], rax
xor rax, rax
mov [rbp-330], rax
mov rax, [rbp-290]
mov rax, [rbp-322]
mov [rbp-330], rax
mov rax, rbp
sub rax, 82
xor rax, rax
mov [rbp-338], rax
mov rax, [rbp-338]
mov rax, [rbp-330]
mov [rbp-338], rax
mov rax, rbp
sub rax, 290
mov [rbp-346], rax
xor rax, rax
mov [rbp-354], rax
mov rax, [rbp-346]
mov rax, [rbp-290]
mov [rbp-354], rax
mov rax, [rbp-330]
mov rax, [rbp-338]
mov rbx, [rbp-354]
sub rax, rbx
mov [rbp-362], rax
Expand Down
6 changes: 3 additions & 3 deletions tests/output/inp3.c_lex_output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,13 @@ TKN_COMMA
TKN_L_PAREN
TKN_INT
TKN_R_PAREN
TKN_ID(cc)
TKN_AND
TKN_ID(a)
TKN_MIN
TKN_L_PAREN
TKN_INT
TKN_R_PAREN
TKN_AND
TKN_ID(a)
TKN_ID(cc)
TKN_R_PAREN
TKN_SEMICOLON
TKN_ID(printf)
Expand Down
6 changes: 3 additions & 3 deletions tests/output/inp3.c_prep_output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,13 @@ TKN_COMMA
TKN_L_PAREN
TKN_INT
TKN_R_PAREN
TKN_ID(cc)
TKN_AND
TKN_ID(a)
TKN_MIN
TKN_L_PAREN
TKN_INT
TKN_R_PAREN
TKN_AND
TKN_ID(a)
TKN_ID(cc)
TKN_R_PAREN
TKN_SEMICOLON
TKN_ID(printf)
Expand Down
2 changes: 1 addition & 1 deletion tests/output/inp3.c_run_output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ I: 8
I: 9
a n 99
Result: 42700
Addr of c - Addr of a: 4294967280
Addr of c - Addr of a: 16
Double of 123: 242074
Fact: 5
Fact: 4
Expand Down
6 changes: 3 additions & 3 deletions tests/output/inp3.c_tree_output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,15 @@ Program(
Left:
Cast:
Val:
Variable(cc)
Ref:
Variable(a)
Type:
Type(Name: (null)):
TKN_INT
Right:
Cast:
Val:
Ref:
Variable(a)
Variable(cc)
Type:
Type(Name: (null)):
TKN_INT
Expand Down

0 comments on commit b70280a

Please sign in to comment.