示例#1
0
def test_is_full_column_true():
    """ Check that the column of board is really full 
    """

    array = [[0, 1, 2, 0, 1, 1, 0], [0, 1, 1, 0, 2, 1,
                                     0], [0, 1, 2, 1, 1, 1, 0],
             [2, 2, 1, 2, 2, 2, 0], [1, 1, 2, 2, 1, 1, 0],
             [2, 1, 2, 1, 1, 2, 0]]
    board = Board()
    board.board = array

    assert (board.is_fill_column(1) == True)
    assert (board.is_fill_column(2) == True)
    assert (board.is_fill_column(4) == True)
    assert (board.is_fill_column(5) == True)
示例#2
0
def test_is_full_column_false():
    """ Check that the column of board is not really full 
    """

    array = [[0, 1, 2, 0, 1, 1, 0], [0, 1, 1, 0, 2, 1,
                                     0], [0, 1, 2, 1, 1, 1, 0],
             [2, 2, 1, 2, 2, 2, 0], [1, 1, 2, 2, 1, 1, 0],
             [2, 1, 2, 1, 1, 2, 0]]
    board = Board()
    board.board = array

    # compare cases with valid column
    assert (board.is_fill_column(0) == False)
    assert (board.is_fill_column(3) == False)
    assert (board.is_fill_column(6) == False)

    # compare cases with column out the range
    assert (board.is_fill_column(9) == False)