Skip to content

Commit 9542f7e

Browse files
committed
feat(tests): adding at_sym_index_sym_index instruction test
1 parent 1687cc3 commit 9542f7e

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tests/unittests/resources/LangSuite/vm-tests.ark

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,12 @@
106106
(test:eq (@ "hello" -4) "e")
107107
(test:eq (@ ["h" "e" "l" "l" "o"] 1) "e")
108108
(test:eq (@ ["h" "e" "l" "l" "o"] -1) "o")
109-
(test:eq (@ ["h" "e" "l" "l" "o"] -4) "e") })
109+
(test:eq (@ ["h" "e" "l" "l" "o"] -4) "e")
110+
111+
(let lst [1 2 3])
112+
(let idx 1)
113+
# AT_SYM_INDEX_SYM_INDEX
114+
(test:eq (@ lst idx) 2) })
110115

111116
(test:case "Short-circuiting" {
112117
(let falsy (fun () {
@@ -180,6 +185,15 @@
180185
(mut data [])
181186
(append! ((fun () data)) 5) })
182187

188+
(test:case "optimized jumps" {
189+
(mut i 10)
190+
(let n 5)
191+
# GT_SYM_JUMP_IF_FALSE
192+
(while (> i n) (set i (- i 1)))
193+
# GT_CONST_JUMP_IF_FALSE
194+
(while (> i 5) (set i (- i 1)))
195+
(test:eq i 5) })
196+
183197
(test:case "set/store head and tail" {
184198
(mut data [1 2 3 4])
185199
# STORE_TAIL_BY_INDEX

0 commit comments

Comments
 (0)