import unittest import os from .comp import OpcodeComputer class Test_OpcodeComputer(unittest.TestCase): inputfile = os.path.join(os.path.dirname(__file__), "input/day9_input") def test_addition(self): com = OpcodeComputer(mem="1,0,0,0,99") com.process_all() self.assertEqual(com.memory, [2, 0, 0, 0, 99]) def test_multiplication(self): com = OpcodeComputer(mem="2,3,0,3,99") com.process_all() self.assertEqual(com.memory, [2, 3, 0, 6, 99]) def test_multiplication2(self): com = OpcodeComputer(mem="2,4,4,5,99,0") com.process_all() self.assertEqual(com.memory, [2, 4, 4, 5, 99, 9801]) def test_addition2(self): com = OpcodeComputer(mem="1,1,1,4,99,5,6,0,99") com.process_all() self.assertEqual(com.memory, [30, 1, 1, 4, 2, 5, 6, 0, 99]) if __name__ == "__main__": unittest.main()