Implement 2019 day 9

This commit is contained in:
2021-01-24 10:16:14 +01:00
parent 4418292dc4
commit b65c805891
3 changed files with 68 additions and 10 deletions

View File

@@ -64,3 +64,18 @@ def test_day5_example(inputs: int, expected: int):
computer.run()
assert computer.output.pop() == expected
@pytest.mark.parametrize('program,output', [
([109, 1, 204, -1, 1001, 100, 1, 100, 1008, 100, 16, 101, 1006, 101, 0, 99],
[109, 1, 204, -1, 1001, 100, 1, 100, 1008, 100, 16, 101, 1006, 101, 0, 99]),
([1102, 34915192, 34915192, 7, 4, 7, 99, 0], [1219070632396864]),
([104, 1125899906842624, 99], [1125899906842624]),
])
def test_instructions_day9(program: List[int], output: List[int]) -> None:
computer = Computer(program)
computer.run()
result = list(computer.output)
assert result == output