double test5() {
	string p0 = "AAAWDIUAOIWDESBEAIWODJAWDBPOAWDUISAWDOOPAWD";
	int p1 = 21;
	EllysSubstringSorter * obj = new EllysSubstringSorter();
	clock_t start = clock();
	string my_answer = obj->getMin(p0, p1);
	clock_t end = clock();
	delete obj;
	cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl;
	string p2 = "AAAAAABDDDEEIIIJOOSUWWWWDBPOAWDUISAWDOOPAWD";
	cout <<"Desired answer: " <<endl;
	cout <<"\t\"" << p2 <<"\"" <<endl;
	cout <<"Your answer: " <<endl;
	cout <<"\t\"" << my_answer<<"\"" <<endl;
	if (p2 != my_answer) {
		cout <<"DOESN'T MATCH!!!!" <<endl <<endl;
		return -1;
	}
	else {
		cout <<"Match :-)" <<endl <<endl;
		return (double)(end-start)/CLOCKS_PER_SEC;
	}
}
double test2() {
	string p0 = "AAAAAAAAA";
	int p1 = 2;
	EllysSubstringSorter * obj = new EllysSubstringSorter();
	clock_t start = clock();
	string my_answer = obj->getMin(p0, p1);
	clock_t end = clock();
	delete obj;
	cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl;
	string p2 = "AAAAAAAAA";
	cout <<"Desired answer: " <<endl;
	cout <<"\t\"" << p2 <<"\"" <<endl;
	cout <<"Your answer: " <<endl;
	cout <<"\t\"" << my_answer<<"\"" <<endl;
	if (p2 != my_answer) {
		cout <<"DOESN'T MATCH!!!!" <<endl <<endl;
		return -1;
	}
	else {
		cout <<"Match :-)" <<endl <<endl;
		return (double)(end-start)/CLOCKS_PER_SEC;
	}
}
示例#3
0
// BEGIN CUT HERE
int main( int argc, char* argv[] ) {
    {
        EllysSubstringSorter theObject;
        eq(0, theObject.getMin("TOPCODER", 4),"COPTODER");
    }
    {
        EllysSubstringSorter theObject;
        eq(1, theObject.getMin("ESPRIT", 3),"EPRSIT");
    }
    {
        EllysSubstringSorter theObject;
        eq(2, theObject.getMin("AAAAAAAAA", 2),"AAAAAAAAA");
    }
    {
        EllysSubstringSorter theObject;
        eq(3, theObject.getMin("ABRACADABRA", 5),"AAABCRDABRA");
    }
    {
        EllysSubstringSorter theObject;
        eq(4, theObject.getMin("BAZINGA", 6),"ABGINZA");
    }
    {
        EllysSubstringSorter theObject;
        eq(5, theObject.getMin("AAAWDIUAOIWDESBEAIWODJAWDBPOAWDUISAWDOOPAWD", 21),"AAAAAABDDDEEIIIJOOSUWWWWDBPOAWDUISAWDOOPAWD");
    }
	return 0;
}