// BEGIN KAWIGIEDIT TESTING // Generated by KawigiEdit 2.1.4 (beta) modified by pivanof bool KawigiEdit_RunTest(int testNum, vector <int> p0, vector <int> p1, bool hasAnswer, int p2) { cout << "Test " << testNum << ": [" << "{"; for (int i = 0; int(p0.size()) > i; ++i) { if (i > 0) { cout << ","; } cout << p0[i]; } cout << "}" << "," << "{"; for (int i = 0; int(p1.size()) > i; ++i) { if (i > 0) { cout << ","; } cout << p1[i]; } cout << "}"; cout << "]" << endl; GoodCompanyDivTwo *obj; int answer; obj = new GoodCompanyDivTwo(); clock_t startTime = clock(); answer = obj->countGood(p0, p1); clock_t endTime = clock(); delete obj; bool res; res = true; cout << "Time: " << double(endTime - startTime) / CLOCKS_PER_SEC << " seconds" << endl; if (hasAnswer) { cout << "Desired answer:" << endl; cout << "\t" << p2 << endl; } cout << "Your answer:" << endl; cout << "\t" << answer << endl; if (hasAnswer) { res = answer == p2; } if (!res) { cout << "DOESN'T MATCH!!!!" << endl; } else if (double(endTime - startTime) / CLOCKS_PER_SEC >= 2) { cout << "FAIL the timeout" << endl; res = false; } else if (hasAnswer) { cout << "Match :-)" << endl; } else { cout << "OK, but is it right?" << endl; } cout << "" << endl; return res; }
// BEGIN CUT HERE int main( int argc, char* argv[] ) { { int superiorARRAY[] = {-1, 0}; vector <int> superior( superiorARRAY, superiorARRAY+ARRSIZE(superiorARRAY) ); int workTypeARRAY[] = {1, 2}; vector <int> workType( workTypeARRAY, workTypeARRAY+ARRSIZE(workTypeARRAY) ); GoodCompanyDivTwo theObject; eq(0, theObject.countGood(superior, workType),2); } { int superiorARRAY[] = {-1, 0}; vector <int> superior( superiorARRAY, superiorARRAY+ARRSIZE(superiorARRAY) ); int workTypeARRAY[] = {1, 1}; vector <int> workType( workTypeARRAY, workTypeARRAY+ARRSIZE(workTypeARRAY) ); GoodCompanyDivTwo theObject; eq(1, theObject.countGood(superior, workType),1); } { int superiorARRAY[] = {-1, 0, 1, 1}; vector <int> superior( superiorARRAY, superiorARRAY+ARRSIZE(superiorARRAY) ); int workTypeARRAY[] = {1, 4, 3, 2}; vector <int> workType( workTypeARRAY, workTypeARRAY+ARRSIZE(workTypeARRAY) ); GoodCompanyDivTwo theObject; eq(2, theObject.countGood(superior, workType),4); } { int superiorARRAY[] = {-1, 0, 1, 0, 0}; vector <int> superior( superiorARRAY, superiorARRAY+ARRSIZE(superiorARRAY) ); int workTypeARRAY[] = {3, 3, 5, 2, 2}; vector <int> workType( workTypeARRAY, workTypeARRAY+ARRSIZE(workTypeARRAY) ); GoodCompanyDivTwo theObject; eq(3, theObject.countGood(superior, workType),4); } { int superiorARRAY[] = {-1, 0, 1, 1, 1, 0, 2, 5}; vector <int> superior( superiorARRAY, superiorARRAY+ARRSIZE(superiorARRAY) ); int workTypeARRAY[] = {1, 1, 2, 3, 4, 5, 3, 3}; vector <int> workType( workTypeARRAY, workTypeARRAY+ARRSIZE(workTypeARRAY) ); GoodCompanyDivTwo theObject; eq(4, theObject.countGood(superior, workType),7); } { int superiorARRAY[] = {-1, 0, 0, 1, 1, 3, 0, 2, 0, 5, 2, 5, 5, 6, 1, 2, 11, 12, 10, 4, 7, 16, 10, 9, 12, 18, 15, 23, 20, 7, 4}; vector <int> superior( superiorARRAY, superiorARRAY+ARRSIZE(superiorARRAY) ); int workTypeARRAY[] = {4, 6, 4, 7, 7, 1, 2, 8, 1, 7, 2, 4, 2, 9, 11, 1, 10, 11, 4, 6, 11, 7, 2, 8, 9, 9, 10, 10, 9, 8, 8}; vector <int> workType( workTypeARRAY, workTypeARRAY+ARRSIZE(workTypeARRAY) ); GoodCompanyDivTwo theObject; eq(5, theObject.countGood(superior, workType),27); } return 0; }