def test_board_is_move_allowed_board_full(): b = Board(max_row=2, row_size=4, min_val=1, solution=[1, 1, 1, 1]) m = [1, 1, 1, 1] b.play(m) assert b.is_move_allowed(m) == False
def test_board_play_after_win(): b = Board(max_row=2, row_size=3, min_val=1, max_val=3, solution=[1, 1, 1]) m = [1, 1, 1] b.play(m) played = b.play(m) assert len(b.res) == 1 and len(b.rows) == 1 and played == False
def test_board_is_move_allowed_board_full(): b = Board(max_row=1) m = b.get_random_move() b.play(m) assert b.is_move_allowed(m) == False
def test_board_play_forbidden_move(): b = Board(max_row=3, row_size=3, min_val=1, max_val=3, solution=[1, 1, 1]) m = [1, 2, 5] played = b.play(m) assert len(b.res) == 0 and len(b.rows) == 0 and played == False
def test_board_play_allowed_move(): b = Board(max_row=3, row_size=3, min_val=1, max_val=3, solution=[1, 1, 1]) m = [1, 2, 3] played = b.play(m) assert len(b.res) == 1 and len(b.rows) == 1 and played == True
def test_board_is_loose_last_move_fill_the_board(): b = Board(row_size=3, max_row=2, solution=[1, 1, 1]) m = [1, 1, 2] b.play(m) b.play(m) assert b.is_loose() == True
def test_board_is_loose_last_move_is_bad(): b = Board(row_size=3, max_row=2, solution=[1, 1, 1]) m = [1, 1, 2] b.play(m) assert b.is_loose() == False
def test_board_is_win_last_move_win(): b = Board(row_size=3, max_row=2, solution=[1, 1, 1]) m = [1, 1, 1] b.play(m) assert b.is_win() == True