Пример #1
0
def test_possible_connections_bottom_right_corner():
    size = 7
    corner_index = size * size - 1
    actual = game._possible_connections(corner_index, size)
    actual.sort()
    expected = [corner_index - size - 1, corner_index - size, corner_index - 1]
    assert actual == expected
Пример #2
0
def test_possible_connections_bottom_left_corner():
    size = 13
    corner_index = size * (size - 1)
    actual = game._possible_connections(corner_index, size)
    actual.sort()
    expected = [corner_index - size, corner_index + 1]
    assert actual == expected
Пример #3
0
def test_possible_connections_top_right_corner():
    size = 12
    corner_index = 11
    actual = game._possible_connections(corner_index, size)
    actual.sort()
    expected = [corner_index - 1, corner_index + size]
    assert actual == expected
Пример #4
0
def test_possible_connections_top_left_corner():
    size = 11
    corner_index = 0
    actual = game._possible_connections(corner_index, size)
    actual.sort()
    expected = [corner_index + 1, corner_index + size, corner_index + size + 1]
    assert actual == expected
Пример #5
0
def test_possible_connections_right_side():
    size = 6
    side_index = size * 2 - 1
    actual = game._possible_connections(side_index, size)
    actual.sort()
    expected = [
        side_index - size - 1, side_index - size, side_index - 1,
        side_index + size
    ]
    assert actual == expected
Пример #6
0
def test_possible_connections_top_side():
    size = 23
    side_index = size // 2
    actual = game._possible_connections(side_index, size)
    actual.sort()
    expected = [
        side_index - 1, side_index + 1, side_index + size,
        side_index + size + 1
    ]
    assert actual == expected
Пример #7
0
def test_possible_connections_left_side():
    size = 45
    side_index = size * 7
    actual = game._possible_connections(side_index, size)
    actual.sort()
    expected = [
        side_index - size, side_index + 1, side_index + size,
        side_index + size + 1
    ]
    assert actual == expected
Пример #8
0
def test_possible_connections_center():
    size = 5
    center_index = 12
    actual = game._possible_connections(center_index, size)
    actual.sort()
    expected = [
        center_index - size - 1, center_index - size, center_index - 1,
        center_index + 1, center_index + size, center_index + size + 1
    ]
    assert actual == expected
Пример #9
0
def test_possible_connections_bottom_side():
    size = 16
    side_index = size * size - size // 2
    actual = game._possible_connections(side_index, size)
    actual.sort()
    expected = [
        side_index - size - 1, side_index - size, side_index - 1,
        side_index + 1
    ]
    assert actual == expected


###########################
# the union find algorithm functions have been tested by some of the result(s,a) tests
###########################