def test_opcode_3_resume_run(): opcode = [3, 7, 3, 8, 3, 9, 99, 0, 0, 0] result = [3, 7, 3, 8, 3, 9, 99, 4, 2, 42] input_list = [4, 2] object = IntCode(opcode, input_list) assert object.run() == [] assert object.halt assert object.position == 4 object.add_input(42) assert object.run() == [] assert object.opcode[:len(result)] == result assert not object.halt
def test_intcode_add_input(): opcode = [1, 9, 10, 3, 99] input_list = [1, 2, 3] object = IntCode(opcode, input_list) object.add_input(4) assert object.input_list == [4, 3, 2, 1]