Esempio n. 1
0
bool KawigiEdit_RunTest(int testNum, int p0, int p1, int p2, bool hasAnswer, string p3) {
	cout << "Test " << testNum << ": [" << p0 << "," << p1 << "," << p2;
	cout << "]" << endl;
	FoxAndFencingEasy *obj;
	string answer;
	obj = new FoxAndFencingEasy();
	clock_t startTime = clock();
	answer = obj->WhoCanWin(p0, p1, p2);
	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" << "\"" << p3 << "\"" << endl;
	}
	cout << "Your answer:" << endl;
	cout << "\t" << "\"" << answer << "\"" << endl;
	if (hasAnswer) {
		res = answer == p3;
	}
	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
void main( int argc, char* argv[] ) {
	{
		FoxAndFencingEasy theObject;
		eq(0, theObject.WhoCanWin(1, 58, 1),"Ciel");
	}
	{
		FoxAndFencingEasy theObject;
		eq(1, theObject.WhoCanWin(100, 100, 100000000),"Draw");
	}
	{
		FoxAndFencingEasy theObject;
		eq(2, theObject.WhoCanWin(100, 150, 100000000),"Draw");
	}
	{
		FoxAndFencingEasy theObject;
		eq(3, theObject.WhoCanWin(100, 250, 100000000),"Liss");
	}
}