Exemple #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
Exemple #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
def test_part_one():
    data = load_data("test_input.txt")
    assert part_one(data) == 25
def test_part_two():
    data = load_data("test_input.txt")
    assert part_two(data) == 286
def test_part_one():
    field_rules, my_ticket, other_tickets = load_data('test_input.txt')
    assert part_one(field_rules, other_tickets) == 71
def test_part_two():
    assert part_two(load_data("testdata.txt")) == 336
Exemple #7
0
def test_loading():
    test_numbers = load_data("testdata.txt")
    assert test_numbers == [1721, 979, 366, 299, 675, 1456]
def test_part_two():
    assert part_two(load_data("test_input.txt")) == 8
    assert part_two(load_data("test_input2.txt")) == 19208
Exemple #9
0
def test_part_two():
    data = load_data('test_input.txt')
    assert part_two(data) == 291
Exemple #10
0
def test_part_one():
    data = load_data('test_input.txt')
    assert part_one(data) == 306
def test_part_two():
    assert part_two(load_data("invalid_test.txt")) == 0
    assert part_two(load_data("valid_test.txt")) == 4
def test_loading():
    test_input = load_data("testdata.txt")
    assert len(test_input) == 4
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
Exemple #14
0
def test_resolving():
    graph, messages = load_data("test_input.txt")
    resolve_dependencies(graph)
    assert graph[0].is_independent()
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
def test_part_one():
    assert part_one(load_data("test_input.txt")) == 35
    assert part_one(load_data("test_input2.txt")) == 220
Exemple #17
0
def test_part_one():
    assert part_one(*load_data('test_input.txt')) == 295
Exemple #18
0
def test_loading():
    test_numbers = load_data("testdata.txt")
    pass
Exemple #19
0
def test_part_two():
    assert part_two(load_data('test_input.txt')[1]) == 1068781
Exemple #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
def test_part_one():
    instructions = load_data("test_input.txt")
    assert part_one(instructions) == 165
Exemple #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),
    ],
)
def test_part_two():
    instructions = load_data("test_input2.txt")
    assert part_two(instructions) == 208
def test_part_one():
    assert part_one(load_data("testdata.txt")) == 7
def test_part_two():
    data = load_data('test_input.txt')
    assert part_two(data) == "mxmxvkd,sqjhc,fvjkl"