Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcz committed Jun 26, 2024
1 parent 6342f46 commit 914b685
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/Casm/Run/Positive.hs
Original file line number Diff line number Diff line change
Expand Up @@ -166,5 +166,13 @@ tests =
$(mkRelDir ".")
$(mkRelFile "test016.casm")
$(mkRelFile "out/test016.out")
(Just $(mkRelFile "in/test016.json"))
(Just $(mkRelFile "in/test016.json")),
PosTest
"Test017: Peephole optimization"
True
True
$(mkRelDir ".")
$(mkRelFile "test017.casm")
$(mkRelFile "out/test017.out")
Nothing
]
1 change: 1 addition & 0 deletions tests/Casm/positive/out/test017.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7
29 changes: 29 additions & 0 deletions tests/Casm/positive/test017.casm
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
-- peephole optimization

call main
jmp end

main:
jmp lab_1
lab_1:
nop
nop
jmp lab_2
nop
nop
lab_2:
call rel 3
ret
nop
jmp lab_3
lab_4:
[ap] = 7; ap++
call rel 3
ret
nop
[ap] = [fp - 3]; ap++
ret
lab_3:
jmp lab_4

end:

0 comments on commit 914b685

Please sign in to comment.