diff options
| author | 2023-02-09 16:32:32 +0000 | |
|---|---|---|
| committer | 2023-02-09 16:32:32 +0000 | |
| commit | ef84135a2e243ee8edf6f915405e2f5b65ab7500 (patch) | |
| tree | ce9a682df7f0da4f68cd07d4c5f60176c852251e /asm/test.py | |
| parent | add compile t est (diff) | |
change instructions to be an enum
Diffstat (limited to 'asm/test.py')
| -rw-r--r-- | asm/test.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/asm/test.py b/asm/test.py index 06a878f..640f3bf 100644 --- a/asm/test.py +++ b/asm/test.py @@ -9,7 +9,7 @@ class PushTest(unittest.TestCase): b = p() self.assertEqual(b, b'\x01\xC2\x85\x00') ins = ffi.parse_line(b) - self.assertEqual(ins[0], instructions["push"].opcode) + self.assertEqual(ins[0], Instruction.PUSH.opcode) self.assertEqual(ins[1][0], (1,5)) def test_parse_push_imm(self): @@ -18,7 +18,7 @@ class PushTest(unittest.TestCase): b = p() self.assertEqual(b, b'\x01\xC0\x85\x00') ins = ffi.parse_line(b) - self.assertEqual(ins[0], instructions["push"].opcode) + self.assertEqual(ins[0], Instruction.PUSH.opcode) self.assertEqual(ins[1][0], (0,5)) def test_parse_push_catch_typecheck_push_lab(self): @@ -55,7 +55,7 @@ class PushTest(unittest.TestCase): def test_compile_push(self): p = Program() p.parse_asm_line("PUSH r0") - p.parse_asm_line("PUSH r6") + p.parse_asm_line("PUSH 6") b = p() ex = ffi.ExecutionEnvironment() @@ -71,7 +71,7 @@ class PushTest(unittest.TestCase): self.assertEqual(ex.cenv.prg[0].w[2], 0) self.assertEqual(ex.cenv.prg[1].opcode, 1) - self.assertEqual(ex.cenv.prg[1].w_flags[0], 1) + self.assertEqual(ex.cenv.prg[1].w_flags[0], 0) self.assertEqual(ex.cenv.prg[1].w_flags[1], 0) self.assertEqual(ex.cenv.prg[1].w_flags[2], 0) self.assertEqual(ex.cenv.prg[1].w[0], 6) @@ -109,7 +109,7 @@ class ProgramTest(unittest.TestCase): p = Program() p.parse_asm_line("add r1 23 3648") ins = ffi.parse_line(p()) - self.assertEqual(ins[0], instructions["add"].opcode) + self.assertEqual(ins[0], Instruction.ADD.opcode) self.assertEqual(ins[1][0], (1,1)) self.assertEqual(ins[1][1], (0,23)) self.assertEqual(ins[1][2], (0,3648)) |
