def test_illegal_move(): tile1 = Tile(Color.RED, Shape.X) board = Board([(Position(0, 0), tile1)]) tile2 = Tile(Color.GREEN, Shape.CIRCLE) with pytest.raises(ValueError): board.make_move([(Position(0, 1), tile2)]) tiles = board.tiles expected = [Position(Position(0, 0), tile1)] assert expected == tiles
def test_valid_move(): tile1 = Tile(Color.RED, Shape.X) board = Board([(Position(0, 0), tile1)]) tile2 = Tile(Color.RED, Shape.CIRCLE) score = board.make_move([(Position(0, 1), tile2)]) assert score == 2 tiles = board.tiles expected = [(Position(0, 0), tile1), (Position(0, 1), tile2)] assert expected == tiles
def test_qwirkle_score(): tile1 = Tile(Color.RED, Shape.CIRCLE) tile2 = Tile(Color.RED, Shape.CLOVER) tile3 = Tile(Color.RED, Shape.DIAMOND) tile4 = Tile(Color.RED, Shape.SQUARE) tile5 = Tile(Color.RED, Shape.STAR) tile6 = Tile(Color.RED, Shape.X) board = Board() move = [(Position(0, 0), tile1), (Position(1, 0), tile2), (Position(2, 0), tile3), (Position(3, 0), tile4), (Position(4, 0), tile5), (Position(5, 0), tile6)] score = board.make_move(move) assert score == 12
def test_example_b(): starting_position = TILES[:3] board = Board(starting_position) move = TILES[3:6] score = board.make_move(move) assert score == 7
def test_all(): # a board = Board() move = TILES[:3] score = board.make_move(move) assert score == 3 # b move = TILES[3:6] score = board.make_move(move) assert score == 7 # c move = TILES[6:7] score = board.make_move(move) assert 4 == score # d move = TILES[7:9] score = board.make_move(move) assert score == 6 # e move = TILES[9:11] score = board.make_move(move) assert score == 7 # f move = TILES[11:13] score = board.make_move(move) assert score == 6 # g move = TILES[13:15] score = board.make_move(move) assert score == 3 # h move = TILES[15:17] score = board.make_move(move) assert score == 3 # i move = TILES[17:19] score = board.make_move(move) assert score == 10 # j move = TILES[19:20] score = board.make_move(move) assert score == 9 # k move = TILES[20:23] score = board.make_move(move) assert score == 18 # l move = TILES[23:25] score = board.make_move(move) assert score == 9
def test_example_a(): board = Board() move = TILES[:3] score = board.make_move(move) assert score == 3
def test_example_k(): starting_position = TILES[:20] board = Board(starting_position) move = TILES[20:23] score = board.make_move(move) assert score == 18
def test_example_l(): starting_position = TILES[:23] board = Board(starting_position) move = TILES[23:25] score = board.make_move(move) assert score == 9
def test_example_i(): starting_position = TILES[:17] board = Board(starting_position) move = TILES[17:19] score = board.make_move(move) assert score == 10
def test_example_j(): starting_position = TILES[:19] board = Board(starting_position) move = TILES[19:20] score = board.make_move(move) assert score == 9
def test_example_h(): starting_position = TILES[:15] board = Board(starting_position) move = TILES[15:17] score = board.make_move(move) assert score == 3
def test_example_f(): starting_position = TILES[:11] board = Board(starting_position) move = TILES[11:13] score = board.make_move(move) assert score == 6
def test_example_e(): starting_position = TILES[:9] board = Board(starting_position) move = TILES[9:11] score = board.make_move(move) assert score == 7
def test_example_d(): starting_position = TILES[:7] board = Board(starting_position) move = TILES[7:9] score = board.make_move(move) assert score == 6
def test_example_c(): starting_position = TILES[:6] board = Board(starting_position) move = TILES[6:7] score = board.make_move(move) assert 4 == score