diff options
| author | 2023-02-12 20:37:45 +0000 | |
|---|---|---|
| committer | 2023-02-12 20:37:45 +0000 | |
| commit | 304e5d63c57512cfa32de26fcf4915b45e7c5b0a (patch) | |
| tree | 8fe934df3e6a6e7768c2607681ab786b5347f242 /asm/test.py | |
| parent | more loop tests (diff) | |
syscall test
Diffstat (limited to '')
| -rw-r--r-- | asm/test.py | 17 |
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() |
