diff options
| author | 2023-02-11 17:04:17 +0000 | |
|---|---|---|
| committer | 2023-02-11 17:04:17 +0000 | |
| commit | 15fb92e5022eb6331806c6f9aeb8e0ca71fac6f2 (patch) | |
| tree | 5bf313c4fea5632aadc50e4a50d54affb6d3c7bf /asm/test.py | |
| parent | enable compiling and add compile test (diff) | |
comments and negative immediates
Diffstat (limited to 'asm/test.py')
| -rw-r--r-- | asm/test.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/asm/test.py b/asm/test.py index ca54f59..e59d40c 100644 --- a/asm/test.py +++ b/asm/test.py @@ -143,5 +143,16 @@ class ProgramTest(unittest.TestCase): self.assertEqual(ex.cenv.reg[0], 6) self.assertEqual(ex.cenv.reg[1], 5) + def test_exec_add(self): + p = Program() + p.parse_asm_line("add r0 10 20") + p.parse_asm_line("add r1 5 0") + p.parse_asm_line("add r1 r0 -40") + ex = ffi.Environment() + self.assertEqual(ex.load(p()), ffi.CompileRet.OK) + self.assertEqual(ex(), ffi.RunRet.STOP) + self.assertEqual(ex.cenv.reg[0], 30) + self.assertEqual(ex.cenv.reg[1], word_2c(10)) + if __name__ == "__main__": unittest.main() |
