def test_swi_0_functionally_correct(self): swi_instruction = parse_line("swi #0") processor = Processor() processor.execute_instruction(swi_instruction) self.assertEqual(processor.instructions_executed, 1) self.assertTrue(processor.halted)
def test_execute_instruction(self, mock): nop_instruction = parse_line("nop") processor = Processor() processor.execute_instruction(nop_instruction) self.assertTrue(mock.called) self.assertEqual(processor.instructions_executed, 1)
def test_halting(self, mock): nop_instruction = parse_line("nop") processor = Processor() processor.halt() processor.execute_instruction(nop_instruction) self.assertFalse(mock.called) self.assertEqual(processor.instructions_executed, 0)
def test_swi_unhandled_interrupt(self): swi_instruction = parse_line("swi #99") processor = Processor() self.assertRaises( RuntimeError, lambda: processor.execute_instruction(swi_instruction))
def setUp(self): self.proc = Processor()
def setUp(self): self.cpu = Processor()