This commit is contained in:
Andre Wagner
2026-05-04 15:56:46 -05:00
parent 299984cd4b
commit 0e9c8f6e63
2 changed files with 47 additions and 4 deletions

View File

@@ -87,6 +87,27 @@ do
end
do
local stack = VM.new().stack
stack:push(10)
stack:push(20)
stack:push_fp()
stack:push(30)
stack:push(40)
stack:push(50)
assert_eq(#stack, 3)
assert_eq(stack[0], 30)
assert_eq(stack[1], 40)
assert_eq(stack[-1], 50)
assert_eq(stack[-2], 40)
stack:pop_fp()
assert_eq(#stack, 2)
assert_eq(stack[0], 10)
assert_eq(stack[1], 20)
assert_eq(stack[-1], 20)
assert_eq(stack[-2], 10)
end
print('End.')