Add more unit tests for Virtual Machine #3

This commit is contained in:
2021-11-10 22:38:54 +01:00
parent d32c2fa94a
commit f84e10a019
2 changed files with 120 additions and 9 deletions

View File

@@ -110,7 +110,7 @@ load vm (index:_) _ = do
let stack = _stack vm
let stackSize = S.length stack
val <- except $ evalState (runExceptT (getAt (stackSize - fp + index) ("Index " ++ (show index) ++ "out of stack bounds") )) vm
val <- except $ evalState (runExceptT (getAt (stackSize - fp + index) ("Index " ++ (show index) ++ " out of stack bounds") )) vm
return $ execState (push [val] >> forward 2) vm
load _ [] _ = except $ Left $ "Local parameter index expected"