This commit is contained in:
Andre Wagner
2026-05-06 11:12:41 -05:00
parent 0fae9a0b37
commit 88f9ce0ea6
3 changed files with 70 additions and 8 deletions

View File

@@ -197,4 +197,23 @@ do TEST("VM: local variables")
assert_eq(vm:to_integer(-1), 3)
end
do TEST("VM: functions")
local vm = VM:new():set_debug(true):load(assemble([[
.func 0
pushf 1
pushi 2
pushi 3
call 2
ret
.func 1
dupv 0
dupv 1
sum
ret
]])):call(0)
assert_eq(vm:stack_sz(), 1)
assert_eq(vm:to_integer(-1), 5)
end
print('End.')