示例#1
0
def test_get_cells_symbol_zero():
    """ Check there is zero match 
    """

    array = [[0, 1, 1, 0, 1, 1, 0], [0, 1, 1, 0, 1, 1,
                                     0], [0, 1, 1, 0, 1, 1, 0],
             [0, 1, 1, 0, 1, 1, 0], [1, 1, 1, 0, 1, 1, 0],
             [1, 1, 1, 1, 1, 1, 0]]
    board = Board()
    board.board = array
    symb_a = 3
    symb_b = 2
    # positions of the symbol 3 and 2
    pos_a = []
    pos_b = []

    # compare all cells of each symbol with the respective array
    assert (board.get_cells_symbol(symb_a) == pos_a)
    assert (board.get_cells_symbol(symb_b) == pos_b)
示例#2
0
def test_get_cells_symbol_one_or_more():
    """ Check there is at least one or more match 
    """

    array = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0,
                                     0], [0, 1, 0, 0, 0, 0, 0],
             [2, 2, 1, 0, 2, 0, 0], [1, 1, 2, 2, 1, 1, 0],
             [2, 1, 2, 1, 1, 2, 2]]
    board = Board()
    board.board = array
    symb_a = 1
    symb_b = 2
    # positions of the symbol 1 and 2
    pos_a = [(2, 1), (3, 2), (4, 0), (4, 1), (4, 4), (4, 5), (5, 1), (5, 3),
             (5, 4)]
    pos_b = [(3, 0), (3, 1), (3, 4), (4, 2), (4, 3), (5, 0), (5, 2), (5, 5),
             (5, 6)]

    # compare all cells of each symbol with the respective array
    assert (board.get_cells_symbol(symb_a) == pos_a)
    assert (board.get_cells_symbol(symb_b) == pos_b)