diff options
| author | 2023-02-12 19:28:48 +0000 | |
|---|---|---|
| committer | 2023-02-12 19:28:48 +0000 | |
| commit | 00e9d12c716da6ff05142522a49798f22aab90cd (patch) | |
| tree | 64c076c90205123f1aedc433bfab3e4d6cbc075c /asm/test.py | |
| parent | documentation (diff) | |
add mov and unconditional jump
Diffstat (limited to 'asm/test.py')
| -rw-r--r-- | asm/test.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/asm/test.py b/asm/test.py index 4008e3d..52ae268 100644 --- a/asm/test.py +++ b/asm/test.py @@ -310,6 +310,19 @@ class DivTest(unittest.TestCase): self.assertEqual(cm.exception.opcode, 5) class LabelTest(unittest.TestCase): + def test_unconditional_jump(self): + p = Program() + p.parse_lines([ + "mov r0 5", + "mov r0 6", + "j l0", + "mov r0 7", + "CLB l0", + ]) + ex = ffi.Environment(p()) + self.assertEqual(ex(), ffi.RunRet.STOP) + self.assertEqual(ex.getreg(0), 6) + def test_simple_loop(self): p = Program() p.parse_lines([ @@ -338,5 +351,14 @@ class ProgramTest(unittest.TestCase): self.assertEqual(ex.getreg(0), 6) self.assertEqual(ex.getreg(1), 5) + def test_parse_2_byte_num(self): + p = Program() + p.parse_asm_line("mov r0 127") + p.parse_asm_line("mov r1 128") + ex = ffi.Environment(p()) + self.assertEqual(ex(), ffi.RunRet.STOP) + self.assertEqual(ex.getreg(0), 127) + self.assertEqual(ex.getreg(1), 128) + if __name__ == "__main__": unittest.main() |
