コード例 #1
0
def test_sum_unmarked_values_full_board():
    file = "4_21/simple_example.txt"
    _, boards = parse_file(file)

    final_sum = boards[0].sum_unmarked_values()

    assert final_sum == 300
コード例 #2
0
def test_check_for_winner():
    file = "4_21/simple_example.txt"
    draw_list, boards = parse_file(file)

    boards = mark_first_five(draw_list, boards)

    assert check_for_winner(boards) == 0
コード例 #3
0
def test_update_and_check():
    file = "4_21/simple_example.txt"
    draw_list, boards = parse_file(file)

    index, value = update_and_check(draw_list, boards)
    assert index == 0
    assert value == 0
コード例 #4
0
def test_import_data():
    file = "4_21/simple_example.txt"
    draw_list, boards = parse_file(file)
    assert draw_list == [22, 13, 17, 11, 0]

    assert boards[0].board == [
        [22, 13, 17, 11, 0],
        [8, 2, 23, 4, 24],
        [21, 9, 14, 16, 7],
        [6, 10, 3, 18, 5],
        [1, 12, 20, 15, 19],
    ]
コード例 #5
0
def test_mark_first_five():
    file = "4_21/simple_example.txt"
    draw_list, boards = parse_file(file)

    boards = mark_first_five(draw_list, boards)
    assert boards[0].counter == {
        "rows": [5, 0, 0, 0, 0],
        "cols": [1, 1, 1, 1, 1]
    }

    assert boards[0].board == [
        ["x", "x", "x", "x", "x"],
        [8, 2, 23, 4, 24],
        [21, 9, 14, 16, 7],
        [6, 10, 3, 18, 5],
        [1, 12, 20, 15, 19],
    ]