def test_equals_example(input, expected):
    computer = OpcodeComputer([3, 3, 1108, -1, 8, 3, 4, 3, 99])
    computer.input_src = iter([input])
    computer.output = Mock()

    computer.run()

    computer.output.assert_called_with(expected)
def test_lt_example(input, expected):
    computer = OpcodeComputer(
        [3, 12, 6, 12, 15, 1, 13, 14, 13, 4, 13, 99, -1, 0, 1, 9])
    computer.input_src = iter([input])
    computer.output = Mock()

    computer.run()

    computer.output.assert_called_with(expected)
def test_large_example(input, expected):
    computer = OpcodeComputer([
        3, 21, 1008, 21, 8, 20, 1005, 20, 22, 107, 8, 21, 20, 1006, 20, 31,
        1106, 0, 36, 98, 0, 0, 1002, 21, 125, 20, 4, 20, 1105, 1, 46, 104, 999,
        1105, 1, 46, 1101, 1000, 1, 20, 4, 20, 1105, 1, 46, 98, 99
    ])

    computer.input_src = iter([input])
    computer.output = Mock()

    computer.run()

    computer.output.assert_called_with(expected)
def test_simple_jump():
    computer = OpcodeComputer([1106, 0, 6, 104, 1, 99, 104, 2, 99])
    computer.output = Mock()
    computer.run()
    computer.output.assert_called_with(2)