test_row_has_no_threes_of_color()

PHOTO EMBED

Mon Oct 17 2022 14:56:22 GMT+0000 (Coordinated Universal Time)

Saved by @zaczhuang

void test_row_has_no_threes_of_color() {
    int board[MAX_SIZE][MAX_SIZE];
    
    string test_board_1[] = {"----",
                             "XXX-",
                             "-XX-",
                             "--O-"};
    int size_1 = 4;
    int row_1 = 1;
    int color_1 = RED;
    cout << "now testing row_has_no_threes_of_color()" << endl;
    read_board_from_string(board, test_board_1, size_1);
    cout << "expeced: 0 actual: "<<
    row_has_no_threes_of_color(board, size_1, row_1, color_1) << endl;
    
    int size_2 = 4;
    int row_2 = 2;
    int color_2 = RED;
    read_board_from_string(board, test_board_1, size_2);
    cout << "expeced: 1 actual: " <<
    row_has_no_threes_of_color(board, size_2, row_2, color_2) << endl;
    
    int size_3 = 4;
    int row_3 = 1;
    int color_3 = BLUE;
    read_board_from_string(board, test_board_1, size_3);
    cout << "expeced: 1 actual: " <<
    row_has_no_threes_of_color(board, size_3, row_3, color_3) << endl;
    
}

void test_col_has_no_threes_of_color(){
    int board[MAX_SIZE][MAX_SIZE];
    string test_board_1[] = {"----",
                             "XXO-",
                             "-XO-",
                             "--O-"};
    int size_1 = 4;
    int col_1 = 1;
    int color_1 = RED;
    cout << "now testing col_has_no_threes_of_color()" << endl;
    read_board_from_string(board, test_board_1, size_1);
    cout << "expeced: 1 actual: "<<
    col_has_no_threes_of_color(board, size_1, col_1, color_1) << endl;
    
    int size_2 = 4;
    int col_2 = 1;
    int color_2 = RED;
    read_board_from_string(board, test_board_1, size_2);
    cout << "expeced: 1 actual: "<<
    col_has_no_threes_of_color(board, size_2, col_2, color_2) << endl;
    
    int size_3 = 4;
    int col_3 = 2;
    int color_3 = BLUE;
    read_board_from_string(board, test_board_1, size_3);
    cout << "expeced: 0 actual: "<<
    col_has_no_threes_of_color(board, size_3, col_3, color_3) << endl;
}
content_copyCOPY