예제 #1
0
파일: test.cpp 프로젝트: frankelj/Project-3
void test_rows_are_different () {
    cout << "Begin testing rows are different" << endl;
    
    int board[MAX_SIZE][MAX_SIZE];
    
    // test case 1
    string test_board_1[] = {"XOOX",
                             "XOOX",
                             "----",
                             "----"};
    int size_1 = 4;
    read_board_from_string(board, test_board_1, size_1);
    cout << rows_are_different(board, size_1, 0, 1) << endl;
    
    // test case 2
    string test_board_2[] = {"XOOX",
                             "XXOO",
                             "----",
                             "----"};
    int size_2 = 4;
    read_board_from_string(board, test_board_2, size_2);
    cout << rows_are_different(board, size_2, 0, 1) << endl;
    
    // test case 3
    string test_board_3[] = {"XO-X",
                             "XOOX",
                             "----",
                             "----"};
    int size_3 = 4;
    read_board_from_string(board, test_board_3, size_3);
    cout << rows_are_different(board, size_3, 0, 1) << endl;
    
    // test case 4
    string test_board_4[] = {"XO-X",
                             "XOOX",
                             "----",
                             "----"};
    int size_4 = 4;
    read_board_from_string(board, test_board_4, size_4);
    cout << rows_are_different(board, size_4, 2, 3) << endl;
    
    // test case 5
    string test_board_5[] = {"XO-X",
                             "XO-X",
                             "----",
                             "----"};
    int size_5 = 4;
    read_board_from_string(board, test_board_5, size_5);
    cout << rows_are_different(board, size_5, 0, 1) << endl;
    
    cout << "End testing rows are different" << endl;
}
예제 #2
0
bool board_has_no_duplicates(const int board[MAX_SIZE][MAX_SIZE], int size) {
    for (int x = 0; x < size; x++) {
        for (int y = x + 1; y < size; y++) {
            if (!rows_are_different(board, size, x, y)) {
                return false;
            }
            else if (!cols_are_different(board, size, x, y)) {
                return false;
            }
        }
    }

    return true;
}
예제 #3
0
void test_rows_are_different(){
 int board[MAX_SIZE][MAX_SIZE];
 int row1 = 0 ;
 int row2 = 1 ;


    // test case 1
    string test_board_3[] = {"OOOX",
                             "OO--",
                             "XX--",
                             "OO--"};
    int size_1 = 4;
    read_board_from_string(board, test_board_3, size_1);
    cout << rows_are_different(board, size_1, row1, row2) << endl;
cout << "hello world" << endl;

}