class TestCpu(unittest.TestCase): def setUp(self): self.pcb = Pcb() self.cpu = Cpu(Memory()) def test_set_current_pcb_sets_current_pcb(self): self.assertIsNone(self.cpu.get_pcb(), "Current PCB not set correctly") self.cpu.set_current_pcb(self.pcb) self.assertEquals(self.cpu.get_pcb(), self.pcb, "Current PCB not set correctly") def test_fetch(self): self.expectedFailures() def test_fetch_increments_pcb_pc(self): self.assertEquals(first, second, msg)
class TestCpu(unittest.TestCase): def setUp(self): self.pcb = Pcb() self.cpu = Cpu( Memory() ) def test_set_current_pcb_sets_current_pcb(self): self.assertIsNone(self.cpu.get_pcb(), "Current PCB not set correctly") self.cpu.set_current_pcb(self.pcb) self.assertEquals(self.cpu.get_pcb(), self.pcb, "Current PCB not set correctly") def test_fetch(self): self.expectedFailures() def test_fetch_increments_pcb_pc(self): self.assertEquals(first, second, msg)
def setUp(self): self.memory = Memory() self.memory.put(1, Instruction("CPU Instruction", True )) self.memory.put(2, Instruction("IO Instruction", False )) self.irq_manager = IrqManager() self.cpu = Cpu(self.memory, self.irq_manager) self.pcb = Pcb(0, 1, 2)
class TestCpu(unittest.TestCase): def setUp(self): self.memory = Memory() self.memory.put(1, Instruction("CPU Instruction", True )) self.memory.put(2, Instruction("IO Instruction", False )) self.irq_manager = IrqManager() self.cpu = Cpu(self.memory, self.irq_manager) self.pcb = Pcb(0, 1, 2) def test_when_fetch_without_pcb_then_throws_exception(self): with self.assertRaises(NoPcbSetException): self.cpu.__fetch() def test_when_fetch_with_pcb_and_no_interruption_then_executes_instruction(self): self.cpu.set_current_pcb(self.pcb) def test_when_fetch_with_pcb_and_interruption_ocurrs_then_delegates_to_int_mgr(self): pass
def setUp(self): self.pcb = Pcb() self.cpu = Cpu( Memory() )
def setUp(self): self.pcb = Pcb() self.cpu = Cpu(Memory())