def test_execute(self): p = Pop.parse(['ax']) ctx = Context(None) ctx.registers.set(SP, 0xFFFE) self.assertEqual(ctx.registers.get(SP).value, 0xFFFE) ctx.stack.set(0xFFFE, 0x0022) p.execute(ctx) self.assertEqual(ctx.registers.get(AX).value, 0x0022) self.assertEqual(ctx.registers.get(SP).value, 0xFFFF)
def test_parse_ok(self): self.assertIsInstance(Pop.parse(['ax']), Pop)
def test_parse_bad_number_of_arguments(self): self.assertRaises(SyntaxError, lambda: Pop.parse(['ax,', '2']))