Example #1
0
double test6() {
	string p0 = "vfsebgjfyfgerkqlr";
	string p1 = "ezbiwls";
	string p2 = "kjerx";
	string p3 = "jbmjvaawoxycfndukrjfg";
	string p4 = "bgjfyfgerkqlrvfsebgjfyfgerkqlrvfsebgjfyfgerkqlrvfs";
	int p5 = 1575724;
	AkariDaisukiDiv1 * obj = new AkariDaisukiDiv1();
	clock_t start = clock();
	int my_answer = obj->countF(p0, p1, p2, p3, p4, p5);
	clock_t end = clock();
	delete obj;
	cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl;
	int p6 = 483599313;
	cout <<"Desired answer: " <<endl;
	cout <<"\t" << p6 <<endl;
	cout <<"Your answer: " <<endl;
	cout <<"\t" << my_answer <<endl;
	if (p6 != my_answer) {
		cout <<"DOESN'T MATCH!!!!" <<endl <<endl;
		return -1;
	}
	else {
		cout <<"Match :-)" <<endl <<endl;
		return (double)(end-start)/CLOCKS_PER_SEC;
	}
}
Example #2
0
double test1() {
	string p0 = "a";
	string p1 = "b";
	string p2 = "c";
	string p3 = "x";
	string p4 = "abcdefghij";
	int p5 = 1;
	AkariDaisukiDiv1 * obj = new AkariDaisukiDiv1();
	clock_t start = clock();
	int my_answer = obj->countF(p0, p1, p2, p3, p4, p5);
	clock_t end = clock();
	delete obj;
	cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl;
	int p6 = 0;
	cout <<"Desired answer: " <<endl;
	cout <<"\t" << p6 <<endl;
	cout <<"Your answer: " <<endl;
	cout <<"\t" << my_answer <<endl;
	if (p6 != my_answer) {
		cout <<"DOESN'T MATCH!!!!" <<endl <<endl;
		return -1;
	}
	else {
		cout <<"Match :-)" <<endl <<endl;
		return (double)(end-start)/CLOCKS_PER_SEC;
	}
}
bool KawigiEdit_RunTest(int testNum, string p0, string p1, string p2, string p3, string p4, int p5, bool hasAnswer, int p6) {
	cout << "Test " << testNum << ": [" << "\"" << p0 << "\"" << "," << "\"" << p1 << "\"" << "," << "\"" << p2 << "\"" << "," << "\"" << p3 << "\"" << "," << "\"" << p4 << "\"" << "," << p5;
	cout << "]" << endl;
	AkariDaisukiDiv1 *obj;
	int answer;
	obj = new AkariDaisukiDiv1();
	clock_t startTime = clock();
	answer = obj->countF(p0, p1, p2, p3, p4, p5);
	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" << p6 << endl;
	}
	cout << "Your answer:" << endl;
	cout << "\t" << answer << endl;
	if (hasAnswer) {
		res = answer == p6;
	}
	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;
}