double test1() { int t0[] = {-1, -1, 0, 2, 0}; vector <int> p0(t0, t0+sizeof(t0)/sizeof(int)); int t1[] = {-2, -1, 0, -1, -2}; vector <int> p1(t1, t1+sizeof(t1)/sizeof(int)); MinimumSquareEasy * obj = new MinimumSquareEasy(); clock_t start = clock(); long long my_answer = obj->minArea(p0, p1); clock_t end = clock(); delete obj; cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl; long long p2 = 9LL; cout <<"Desired answer: " <<endl; cout <<"\t" << p2 <<endl; cout <<"Your answer: " <<endl; cout <<"\t" << my_answer <<endl; if (p2 != my_answer) { cout <<"DOESN'T MATCH!!!!" <<endl <<endl; return -1; } else { cout <<"Match :-)" <<endl <<endl; return (double)(end-start)/CLOCKS_PER_SEC; } }
double test3() { int t0[] = {93, 34, 12, -11, -7, -21, 51, -22, 59, 74, -19, 29, -56, -95, -96, 9, 44, -37, -54, -21}; vector <int> p0(t0, t0+sizeof(t0)/sizeof(int)); int t1[] = {64, 12, -43, 20, 55, 74, -20, -54, 24, 20, -18, 77, 86, 22, 47, -24, -33, -57, 5, 7}; vector <int> p1(t1, t1+sizeof(t1)/sizeof(int)); MinimumSquareEasy * obj = new MinimumSquareEasy(); clock_t start = clock(); long long my_answer = obj->minArea(p0, p1); clock_t end = clock(); delete obj; cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl; long long p2 = 22801LL; cout <<"Desired answer: " <<endl; cout <<"\t" << p2 <<endl; cout <<"Your answer: " <<endl; cout <<"\t" << my_answer <<endl; if (p2 != my_answer) { cout <<"DOESN'T MATCH!!!!" <<endl <<endl; return -1; } else { cout <<"Match :-)" <<endl <<endl; return (double)(end-start)/CLOCKS_PER_SEC; } }
bool do_test(vector<int> x, vector<int> y, long long __expected) { time_t startClock = clock(); MinimumSquareEasy *instance = new MinimumSquareEasy(); long long __result = instance->minArea(x, y); double elapsed = (double)(clock() - startClock) / CLOCKS_PER_SEC; delete instance; if (__result == __expected) { cout << "PASSED!" << " (" << elapsed << " seconds)" << endl; return true; } else { cout << "FAILED!" << " (" << elapsed << " seconds)" << endl; cout << " Expected: " << to_string(__expected) << endl; cout << " Received: " << to_string(__result) << endl; return false; } }