double test1() { string t0[] = {"....................", "...................."} ; vector <string> p0(t0, t0+sizeof(t0)/sizeof(string)); FourBlocksEasy * obj = new FourBlocksEasy(); clock_t start = clock(); int my_answer = obj->maxScore(p0); clock_t end = clock(); delete obj; cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl; int p1 = 160; cout <<"Desired answer: " <<endl; cout <<"\t" << p1 <<endl; cout <<"Your answer: " <<endl; cout <<"\t" << my_answer <<endl; if (p1 != my_answer) { cout <<"DOESN'T MATCH!!!!" <<endl <<endl; return -1; } else { cout <<"Match :-)" <<endl <<endl; return (double)(end-start)/CLOCKS_PER_SEC; } }
int test53() { vector<string> grid = {"1", "."}; FourBlocksEasy* pObj = new FourBlocksEasy(); clock_t start = clock(); int result = pObj->maxScore(grid); clock_t end = clock(); delete pObj; int expected = 2; if(result == expected) { cout << "Test Case 53: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 0; } else { cout << "Test Case 53: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl; return 1; } }