aboutsummaryrefslogtreecommitdiffstats
path: root/asm/test.py
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2023-02-12 20:37:45 +0000
committerGravatar Peter McGoron 2023-02-12 20:37:45 +0000
commit304e5d63c57512cfa32de26fcf4915b45e7c5b0a (patch)
tree8fe934df3e6a6e7768c2607681ab786b5347f242 /asm/test.py
parentmore loop tests (diff)
syscall test
Diffstat (limited to '')
-rw-r--r--asm/test.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/asm/test.py b/asm/test.py
index 19778b5..d50b555 100644
--- a/asm/test.py
+++ b/asm/test.py
@@ -434,5 +434,22 @@ class ProgramTest(unittest.TestCase):
self.range_test(0x7FFFF00, 0x8000000, sgn=True)
self.range_test(-100, 0, sgn=True)
+class SCEnv(ffi.Environment):
+ def syscall(self, s):
+ self.s = s.value
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+
+class ProgramTest(unittest.TestCase):
+ def range_test(self, st, en, sgn=False):
+ for i in range(st, en):
+ p = Program()
+ p.parse_asm_line(f"sys {i}")
+ ex = SCEnv(p())
+ self.assertEqual(ex(), ffi.RunRet.STOP)
+ self.assertEqual(ex.s, i)
+ def test_syscall_imm(self):
+ self.range_test(0, 1000)
+
if __name__ == "__main__":
unittest.main()