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"], [" ", " ", " ", " ", " ", " ", " ", " ", " ", " "], [" ", " ", " ", " ", " ", " ", " ", " ", " ", " "], [" ", " ", " ", " ", " ", " ", " ", " ", " ", " "], [" ", " ", " ", " ", " ", " ", " ", " ", " ", " "], [" ", " ", " ", " ", " ", " ", " ", " ", " ", " "], [" ", " ", " ", " ", " ", " ", " ", " ", " ", " "], ])
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)
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)
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)
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)
def test_prev_unswept_beginning_of_row(): board = game._to_cells([[" ", " ", " "]]) assert game.prev_unswept(board, 2, 0) == (0, 0)
def test_next_unswept_end_of_row(): board = game._to_cells([[" ", " ", " "]]) assert game.next_unswept(board, 0, 0) == (2, 0)
def test_prev_unswept_prev_row(): board = game._to_cells([[" ", " "], [" ", " "]]) assert game.prev_unswept(board, 1, 1) == (1, 0)