예제 #1
0
def test_part_two():
    graph = load_data("test_input.txt")
    for node_name, node in graph.nodes.items():
        print(node_name, node.out_edges)
    assert part_two(graph) == 32

    graph = load_data("test_input2.txt")
    for node_name, node in graph.nodes.items():
        print(node_name, node.out_edges)
    assert part_two(graph) == 126
예제 #2
0
def test_part_one():
    tiles = [
        Tile(int(lines[0].split()[1][:-1]), lines[1:])
        for lines in load_data('test_input.txt')
    ]
    tiles = arrange_tiles(tiles)
    assert part_one(tiles) == 20899048083289
예제 #3
0
def test_part_one():
    data = load_data("test_input.txt")
    assert part_one(data) == 25
예제 #4
0
def test_part_two():
    data = load_data("test_input.txt")
    assert part_two(data) == 286
예제 #5
0
def test_part_one():
    field_rules, my_ticket, other_tickets = load_data('test_input.txt')
    assert part_one(field_rules, other_tickets) == 71
예제 #6
0
def test_part_two():
    assert part_two(load_data("testdata.txt")) == 336
예제 #7
0
def test_loading():
    test_numbers = load_data("testdata.txt")
    assert test_numbers == [1721, 979, 366, 299, 675, 1456]
예제 #8
0
def test_part_two():
    assert part_two(load_data("test_input.txt")) == 8
    assert part_two(load_data("test_input2.txt")) == 19208
예제 #9
0
def test_part_two():
    data = load_data('test_input.txt')
    assert part_two(data) == 291
예제 #10
0
def test_part_one():
    data = load_data('test_input.txt')
    assert part_one(data) == 306
예제 #11
0
def test_part_two():
    assert part_two(load_data("invalid_test.txt")) == 0
    assert part_two(load_data("valid_test.txt")) == 4
예제 #12
0
def test_loading():
    test_input = load_data("testdata.txt")
    assert len(test_input) == 4
예제 #13
0
def test_find_valid_tickets():
    field_rules, my_ticket, other_tickets = load_data('test_input.txt')
    exp = [
        [7, 3, 47]]
    assert find_valid_tickets(field_rules, other_tickets) == exp
예제 #14
0
def test_resolving():
    graph, messages = load_data("test_input.txt")
    resolve_dependencies(graph)
    assert graph[0].is_independent()
예제 #15
0
def test_loading():
    test_input = load_data("testdata.txt")
    expected = [[1, 3, "a", "abcde"], [1, 3, "b", "cdefg"],
                [2, 9, "c", "ccccccccc"]]
    assert test_input == expected
예제 #16
0
def test_part_one():
    assert part_one(load_data("test_input.txt")) == 35
    assert part_one(load_data("test_input2.txt")) == 220
예제 #17
0
def test_part_one():
    assert part_one(*load_data('test_input.txt')) == 295
예제 #18
0
def test_loading():
    test_numbers = load_data("testdata.txt")
    pass
예제 #19
0
def test_part_two():
    assert part_two(load_data('test_input.txt')[1]) == 1068781
예제 #20
0
def test_part_one():
    graph = load_data("test_input.txt")
    for node_name, node in graph.nodes.items():
        print(node_name, node.in_edges)
    assert part_one(graph) == 4
예제 #21
0
def test_part_one():
    instructions = load_data("test_input.txt")
    assert part_one(instructions) == 165
예제 #22
0
import pytest

from solution import load_data, solution_01, solution_02


@pytest.mark.parametrize(
    "inp,exp",
    [
        ("1122", 3),
        ("1111", 4),
        ("1234", 0),
        ("91212129", 9),
        ("951484596541141557316984781494999", 1 + 5 + 27),
        (load_data(), 1341),
    ],
)
def test_solution_01(inp, exp):
    assert solution_01(inp) == exp


@pytest.mark.parametrize(
    "inp,exp",
    [
        ("1212", 6),
        ("1221", 0),
        ("123425", 4),
        ("123123", 12),
        ("12131415", 4),
        (load_data(), 1348),
    ],
)
예제 #23
0
def test_part_two():
    instructions = load_data("test_input2.txt")
    assert part_two(instructions) == 208
예제 #24
0
def test_part_one():
    assert part_one(load_data("testdata.txt")) == 7
예제 #25
0
def test_part_two():
    data = load_data('test_input.txt')
    assert part_two(data) == "mxmxvkd,sqjhc,fvjkl"