// BEGIN KAWIGIEDIT TESTING // Generated by KawigiEdit 2.1.4 (beta) modified by pivanof bool KawigiEdit_RunTest(int testNum, int p0, int p1, int p2, int p3, bool hasAnswer, double p4) { cout << "Test " << testNum << ": [" << p0 << "," << p1 << "," << p2 << "," << p3; cout << "]" << endl; FoxPlayingGame *obj; double answer; obj = new FoxPlayingGame(); clock_t startTime = clock(); answer = obj->theMax(p0, p1, p2, p3); 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" << p4 << endl; } cout << "Your answer:" << endl; cout << "\t" << answer << endl; if (hasAnswer) { res = fabs(p4 - answer) <= 1e-9 * max(1.0, fabs(p4)); } 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; }
void testCase5() { int nA = 41; int nB = 34; int paramA = 9876; int paramB = -1234; double expected_ = 515323.9982341775; assertEquals(5, expected_, solution.theMax(nA, nB, paramA, paramB)); }
void testCase4() { int nA = 50; int nB = 50; int paramA = 10000; int paramB = 2000; double expected_ = 5.62949953421312E17; assertEquals(4, expected_, solution.theMax(nA, nB, paramA, paramB)); }
void testCase3() { int nA = 5; int nB = 5; int paramA = 2000; int paramB = -2000; double expected_ = 160.0; assertEquals(3, expected_, solution.theMax(nA, nB, paramA, paramB)); }
void testCase2() { int nA = 4; int nB = 3; int paramA = -2000; int paramB = 2000; double expected_ = -8.0; assertEquals(2, expected_, solution.theMax(nA, nB, paramA, paramB)); }
void testCase1() { int nA = 3; int nB = 3; int paramA = 2000; int paramB = 100; double expected_ = 6.0; assertEquals(1, expected_, solution.theMax(nA, nB, paramA, paramB)); }
void testCase0() { int nA = 5; int nB = 0; int paramA = -1000; int paramB = -2000; double expected_ = -5.0; assertEquals(0, expected_, solution.theMax(nA, nB, paramA, paramB)); }