예제 #1
0
파일: test.py 프로젝트: argfrot/aoc2019
def test_computer_less_than_immediate():
    ram = [3, 3, 1107, -1, 8, 3, 4, 3, 99]
    input = 8
    stdout = []
    computer = Computer(ram, receive(stdout)).run()
    try:
        computer.send(input)
    except StopIteration:
        pass
    assert stdout == [0]
예제 #2
0
파일: test.py 프로젝트: argfrot/aoc2019
def test_computer_less_than2():
    ram = [3, 9, 7, 9, 10, 9, 4, 9, 99, -1, 8]
    input = 8
    stdout = []
    computer = Computer(ram, receive(stdout)).run()
    try:
        computer.send(input)
    except StopIteration:
        pass
    assert stdout == [0]
예제 #3
0
파일: test.py 프로젝트: argfrot/aoc2019
def test_computer_jump4():
    ram = [3, 3, 1105, -1, 9, 1101, 0, 0, 12, 4, 12, 99, 1]
    input = 2
    stdout = []
    computer = Computer(ram, receive(stdout)).run()
    try:
        computer.send(input)
    except StopIteration:
        pass
    assert stdout == [1]
예제 #4
0
파일: test.py 프로젝트: argfrot/aoc2019
def test_computer_jump2():
    ram = [3, 12, 6, 12, 15, 1, 13, 14, 13, 4, 13, 99, -1, 0, 1, 9]
    input = 2
    stdout = []
    computer = Computer(ram, receive(stdout)).run()
    try:
        computer.send(input)
    except StopIteration:
        pass
    assert stdout == [1]
예제 #5
0
파일: test.py 프로젝트: argfrot/aoc2019
def test_computer_long1():
    ram = [
        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
    ]
    input = 8
    stdout = []
    computer = Computer(ram, receive(stdout)).run()
    try:
        computer.send(input)
    except StopIteration:
        pass
    assert stdout == [1000]