// BEGIN CUT HERE void main( int argc, char* argv[] ) { { int grezPowerARRAY[] = {10, 20, 30}; vector <int> grezPower( grezPowerARRAY, grezPowerARRAY+ARRSIZE(grezPowerARRAY) ); PrimalUnlicensedCreatures theObject; eq(0, theObject.maxWins(31, grezPower),3); } { int grezPowerARRAY[] = {24, 5, 6, 38}; vector <int> grezPower( grezPowerARRAY, grezPowerARRAY+ARRSIZE(grezPowerARRAY) ); PrimalUnlicensedCreatures theObject; eq(1, theObject.maxWins(20, grezPower),3); } { int grezPowerARRAY[] = {3, 3, 3, 3, 3, 1, 25 }; vector <int> grezPower( grezPowerARRAY, grezPowerARRAY+ARRSIZE(grezPowerARRAY) ); PrimalUnlicensedCreatures theObject; eq(2, theObject.maxWins(20, grezPower),6); } { int grezPowerARRAY[] = {3, 13, 6, 4, 9}; vector <int> grezPower( grezPowerARRAY, grezPowerARRAY+ARRSIZE(grezPowerARRAY) ); PrimalUnlicensedCreatures theObject; eq(3, theObject.maxWins(4, grezPower),5); } { int grezPowerARRAY[] = {7, 8, 9, 10}; vector <int> grezPower( grezPowerARRAY, grezPowerARRAY+ARRSIZE(grezPowerARRAY) ); PrimalUnlicensedCreatures theObject; eq(4, theObject.maxWins(7, grezPower),0); } }
// BEGIN KAWIGIEDIT TESTING // Generated by KawigiEdit 2.1.4 (beta) modified by pivanof bool KawigiEdit_RunTest(int testNum, int p0, vector <int> p1, bool hasAnswer, int p2) { cout << "Test " << testNum << ": [" << p0 << "," << "{"; for (int i = 0; int(p1.size()) > i; ++i) { if (i > 0) { cout << ","; } cout << p1[i]; } cout << "}"; cout << "]" << endl; PrimalUnlicensedCreatures *obj; int answer; obj = new PrimalUnlicensedCreatures(); clock_t startTime = clock(); answer = obj->maxWins(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; }