Exemple #1
0
def test_initial_board_numbers_mine_adjacent_cells(mocker):
    mocker.patch("minesweeper_vim.game.random")
    assert game.create_game(*game.EASY).board == game._to_cells([
        ["*", "*", "*", "*", "*", "*", "*", "*", "*", "*"],
        ["2", "3", "3", "3", "3", "3", "3", "3", "3", "2"],
        [" ", " ", " ", " ", " ", " ", " ", " ", " ", " "],
        [" ", " ", " ", " ", " ", " ", " ", " ", " ", " "],
        [" ", " ", " ", " ", " ", " ", " ", " ", " ", " "],
        [" ", " ", " ", " ", " ", " ", " ", " ", " ", " "],
        [" ", " ", " ", " ", " ", " ", " ", " ", " ", " "],
        [" ", " ", " ", " ", " ", " ", " ", " ", " ", " "],
    ])
Exemple #2
0
def test_prev_unswept_prev_row_skip_1():
    board = game._to_cells([[" ", "1"], [" ", " "]])
    board[0][1].is_swept = True
    assert game.prev_unswept(board, 1, 1) == (0, 0)
Exemple #3
0
def test_next_unswept_next_row_skip_1():
    board = game._to_cells([[" ", " "], ["1", " "]])
    board[1][0].is_swept = True
    assert game.next_unswept(board, 0, 0) == (1, 1)
Exemple #4
0
def test_prev_unswept_skip_unswept():
    board = game._to_cells([[" ", " ", "1", " "]])
    board[0][2].is_swept = True
    assert game.prev_unswept(board, 3, 0) == (1, 0)
Exemple #5
0
def test_next_unswept_skip_unswept():
    board = game._to_cells([[" ", "1", " ", " "]])
    board[0][1].is_swept = True
    assert game.next_unswept(board, 0, 0) == (2, 0)
Exemple #6
0
def test_prev_unswept_beginning_of_row():
    board = game._to_cells([[" ", " ", " "]])
    assert game.prev_unswept(board, 2, 0) == (0, 0)
Exemple #7
0
def test_next_unswept_end_of_row():
    board = game._to_cells([[" ", " ", " "]])
    assert game.next_unswept(board, 0, 0) == (2, 0)
Exemple #8
0
def test_prev_unswept_prev_row():
    board = game._to_cells([[" ", " "], [" ", " "]])
    assert game.prev_unswept(board, 1, 1) == (1, 0)