double test2() { int t0[] = {2}; vector <int> p0(t0, t0+sizeof(t0)/sizeof(int)); int t1[] = {1}; vector <int> p1(t1, t1+sizeof(t1)/sizeof(int)); GreaterGameDiv2 * obj = new GreaterGameDiv2(); clock_t start = clock(); int my_answer = obj->calc(p0, p1); clock_t end = clock(); delete obj; cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl; int p2 = 1; 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> snuke, vector<int> sothe, int __expected) { time_t startClock = clock(); GreaterGameDiv2 *instance = new GreaterGameDiv2(); int __result = instance->calc(snuke, sothe); 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; } }