def test_extended_memory() -> None:
    intcode = list_to_dict([4, 888, 99])
    intcode2 = list_to_dict([1101, 1, 1, 888, 4, 888, 99])

    ic = Intcomputer(intcode, outputMethod=Intcomputer.OUT_INTERNAL_LIST)
    ic2 = Intcomputer(intcode2, outputMethod=Intcomputer.OUT_INTERNAL_LIST)
    ic.run()
    ic2.run()

    assert ic.list_output() == 0
    assert ic.ram[888] == 0

    assert ic2.list_output() == 2
    assert ic2.ram[888] == 2
def test_jit() -> None:
    ic = Intcomputer(
        list_to_dict(
            [105, 1, 6, 104, 0, 99, 105, 0, 12, 104, 1, 99, 104, 0, 99]),
        'test', Intcomputer.IN_INTERNAL_LIST, Intcomputer.OUT_INTERNAL_LIST)
    ic.run()
    assert ic.list_output() == 1
def test_eq() -> None:
    ic = Intcomputer(
        list_to_dict([1108, 3, 3, 9, 1108, 3, 4, 11, 104, 0, 104, 0, 99]),
        'test', Intcomputer.IN_INTERNAL_LIST, Intcomputer.OUT_INTERNAL_LIST)
    ic.run()
    assert ic.list_output() == 1
    assert ic.list_output() == 0
def test_lt() -> None:
    ic = Intcomputer([1107, 2, 3, 9, 1107, 3, 2, 11, 104, 0, 104, 0, 99],
                     'test', Intcomputer.IN_INTERNAL_LIST,
                     Intcomputer.OUT_INTERNAL_LIST)
    ic.run()
    assert ic.list_output() == 1
    assert ic.list_output() == 0
def test_fifo_internal_list() -> None:
    ic = Intcomputer(list_to_dict([3, 9, 3, 10, 4, 9, 4, 10, 99, 0,
                                   0]), 'test', Intcomputer.IN_INTERNAL_LIST,
                     Intcomputer.OUT_INTERNAL_LIST)
    ic.list_input(1)
    ic.list_input(2)
    ic.run()
    assert ic.list_output() == 1
    assert ic.list_output() == 2
def test_internal_list_out() -> None:
    ic = Intcomputer(list_to_dict([4, 1, 99]),
                     outputMethod=Intcomputer.OUT_INTERNAL_LIST)
    ic.run()
    assert ic.list_output() == 1
def test_relative_simple_add() -> None:
    ic = Intcomputer(list_to_dict([109, 4, 2201, -1, -2, 7, 104, 0, 99]),
                     outputMethod=Intcomputer.OUT_INTERNAL_LIST)
    ic.run()
    assert ic.list_output() == 2200
def test_jif() -> None:
    ic = Intcomputer(
        [1106, 0, 6, 104, 0, 99, 1106, 1, 12, 104, 1, 99, 104, 0, 99], 'test',
        Intcomputer.IN_INTERNAL_LIST, Intcomputer.OUT_INTERNAL_LIST)
    ic.run()
    assert ic.list_output() == 1