예제 #1
0
    def test_equal_boards(self):
        board1 = [['0', 'R', 'B'], ['R', 'B', '0']]
        board2 = [['0', 'R', 'B'], ['R', 'B', '0']]
        board3 = [['0', 'R', 'B'], ['0', 'R', 'B']]

        self.assertTrue(utilities.equal_boards(board1, board2), "Two boards that are the same")
        self.assertFalse(utilities.equal_boards(board1, board3), "Second board differs in one position")
예제 #2
0
    def test_equal_boards(self):
        board1 = [['0', 'R', 'B'], ['R', 'B', '0']]
        board2 = [['0', 'R', 'B'], ['R', 'B', '0']]
        board3 = [['0', 'R', 'B'], ['0', 'R', 'B']]

        self.assertTrue(utilities.equal_boards(board1, board2),
                        "Two boards that are the same")
        self.assertFalse(utilities.equal_boards(board1, board3),
                         "Second board differs in one position")
예제 #3
0
    def test_get_board_copy(self):
        test_board = [['0', 'R', '0'],
                      ['R', '0', '0']]

        flow = Flow(test_board)
        original_board = flow.get_board_copy()
        self.assertTrue(utils.equal_boards(test_board, original_board),
                        "Returned board should be the same as the test board")

        original_board[0][0] = 'T'
        self.assertFalse(utils.equal_boards(test_board, original_board),
                         "Change made to the returned board. Test board should not be the same as it")

        self.assertTrue(utils.equal_boards(test_board, flow.get_board_copy()),
                        "Change made to the returned board should not effect the new copy")
예제 #4
0
    def test_load_game(self):
        expected_board = [['R', '0', 'G', '0', 'Y'], ['0', '0', 'B', '0', 'O'],
                          ['0', '0', '0', '0', '0'], ['0', 'G', '0', 'Y', '0'],
                          ['0', 'R', 'B', 'O', '0']]

        loaded_game = utilities.load_game(TEST_PATH + "easy5x5.txt")
        self.assertTrue(
            utilities.equal_boards(loaded_game.get_board_copy(),
                                   expected_board))
예제 #5
0
    def test_load_game(self):
        expected_board = [['R', '0', 'G', '0', 'Y'],
                         ['0', '0', 'B', '0', 'O'],
                         ['0', '0', '0', '0', '0'],
                         ['0', 'G', '0', 'Y', '0'],
                         ['0', 'R', 'B', 'O', '0']]

        loaded_game = utilities.load_game(TEST_PATH + "easy5x5.txt")
        self.assertTrue(utilities.equal_boards(loaded_game.get_board_copy(), expected_board))
예제 #6
0
    def test_get_board_copy(self):
        test_board = [["0", "R", "0"], ["R", "0", "0"]]

        flow = Flow(test_board)
        original_board = flow.get_board_copy()
        self.assertTrue(
            utils.equal_boards(test_board, original_board), "Returned board should be the same as the test board"
        )

        original_board[0][0] = "T"
        self.assertFalse(
            utils.equal_boards(test_board, original_board),
            "Change made to the returned board. Test board should not be the same as it",
        )

        self.assertTrue(
            utils.equal_boards(test_board, flow.get_board_copy()),
            "Change made to the returned board should not effect the new copy",
        )