def testExecuteInstruction_nop(self): expectedAcc = -10 expectedNext = 1 acc = -10 nextInst = 0 acc, nextInst = executeInstruction('nop', '+', 0, nextInst, acc) self.assertEqual(expectedAcc, acc) self.assertEqual(expectedNext, nextInst)
def testExecuteInstruction_decreaseNext(self): expectedAcc = -10 expectedNext = 1 acc = -10 nextInst = 4 acc, nextInst = executeInstruction('jmp', '-', 3, nextInst, acc) self.assertEqual(expectedAcc, acc) self.assertEqual(expectedNext, nextInst)
def testExecuteInstruction_decreaseAcc(self): expectedAcc = -10 expectedNext = 6 acc = 89 nextInst = 5 acc, nextInst = executeInstruction('acc', '-', 99, nextInst, acc) self.assertEqual(expectedAcc, acc) self.assertEqual(expectedNext, nextInst)
def testExecuteInstruction_increaseNext(self): expectedAcc = -10 expectedNext = 6 acc = -10 nextInst = 2 acc, nextInst = executeInstruction('jmp', '+', 4, nextInst, acc) self.assertEqual(expectedAcc, acc) self.assertEqual(expectedNext, nextInst)
def testExecuteInstruction_increaseAcc(self): expectedAcc = 5 expectedNext = 4 acc = 2 nextInst = 3 acc, nextInst = executeInstruction('acc', '+', 3, nextInst, acc) self.assertEqual(expectedAcc, acc) self.assertEqual(expectedNext, nextInst)