Ejemplo n.º 1
0
double test2() {
    string p0 = "H YPPAHSYADILO";
    InsideOut * obj = new InsideOut();
    clock_t start = clock();
    string my_answer = obj->unscramble(p0);
    clock_t end = clock();
    delete obj;
    cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl;
    string p1 = "HAPPY HOLIDAYS";
    cout <<"Desired answer: " <<endl;
    cout <<"\t\"" << p1 <<"\"" <<endl;
    cout <<"Your answer: " <<endl;
    cout <<"\t\"" << my_answer<<"\"" <<endl;
    if (p1 != my_answer) {
        cout <<"DOESN'T MATCH!!!!" <<endl <<endl;
        return -1;
    }
    else {
        cout <<"Match :-)" <<endl <<endl;
        return (double)(end-start)/CLOCKS_PER_SEC;
    }
}
Ejemplo n.º 2
0
double test4() {
    string p0 = "RUT OWT SNEH HCNERF EERHTEGDIRTRAP A DNA  SEVODELT";
    InsideOut * obj = new InsideOut();
    clock_t start = clock();
    string my_answer = obj->unscramble(p0);
    clock_t end = clock();
    delete obj;
    cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl;
    string p1 = "THREE FRENCH HENS TWO TURTLEDOVES  AND A PARTRIDGE";
    cout <<"Desired answer: " <<endl;
    cout <<"\t\"" << p1 <<"\"" <<endl;
    cout <<"Your answer: " <<endl;
    cout <<"\t\"" << my_answer<<"\"" <<endl;
    if (p1 != my_answer) {
        cout <<"DOESN'T MATCH!!!!" <<endl <<endl;
        return -1;
    }
    else {
        cout <<"Match :-)" <<endl <<endl;
        return (double)(end-start)/CLOCKS_PER_SEC;
    }
}
Ejemplo n.º 3
0
double test0() {
    string p0 = "I ENIL SIHTHSIREBBIG S";
    InsideOut * obj = new InsideOut();
    clock_t start = clock();
    string my_answer = obj->unscramble(p0);
    clock_t end = clock();
    delete obj;
    cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl;
    string p1 = "THIS LINE IS GIBBERISH";
    cout <<"Desired answer: " <<endl;
    cout <<"\t\"" << p1 <<"\"" <<endl;
    cout <<"Your answer: " <<endl;
    cout <<"\t\"" << my_answer<<"\"" <<endl;
    if (p1 != my_answer) {
        cout <<"DOESN'T MATCH!!!!" <<endl <<endl;
        return -1;
    }
    else {
        cout <<"Match :-)" <<endl <<endl;
        return (double)(end-start)/CLOCKS_PER_SEC;
    }
}
Ejemplo n.º 4
0
double test3() {
    string p0 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    InsideOut * obj = new InsideOut();
    clock_t start = clock();
    string my_answer = obj->unscramble(p0);
    clock_t end = clock();
    delete obj;
    cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl;
    string p1 = "MLKJIHGFEDCBAZYXWVUTSRQPON";
    cout <<"Desired answer: " <<endl;
    cout <<"\t\"" << p1 <<"\"" <<endl;
    cout <<"Your answer: " <<endl;
    cout <<"\t\"" << my_answer<<"\"" <<endl;
    if (p1 != my_answer) {
        cout <<"DOESN'T MATCH!!!!" <<endl <<endl;
        return -1;
    }
    else {
        cout <<"Match :-)" <<endl <<endl;
        return (double)(end-start)/CLOCKS_PER_SEC;
    }
}
Ejemplo n.º 5
0
int main( int argc, char* argv[] )
{

	InsideOut objectInsideOut;

	//test case0
	string param00 = "I ENIL SIHTHSIREBBIG S";
	string ret0 = objectInsideOut.unscramble(param00);
	string need0 = "THIS LINE IS GIBBERISH";
	assert_eq(0,ret0,need0);

	//test case1
	string param10 = "LEVELKAYAK";
	string ret1 = objectInsideOut.unscramble(param10);
	string need1 = "LEVELKAYAK";
	assert_eq(1,ret1,need1);

	//test case2
	string param20 = "H YPPAHSYADILO";
	string ret2 = objectInsideOut.unscramble(param20);
	string need2 = "HAPPY HOLIDAYS";
	assert_eq(2,ret2,need2);

	//test case3
	string param30 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	string ret3 = objectInsideOut.unscramble(param30);
	string need3 = "MLKJIHGFEDCBAZYXWVUTSRQPON";
	assert_eq(3,ret3,need3);

	//test case4
	string param40 = "RUT OWT SNEH HCNERF EERHTEGDIRTRAP A DNA  SEVODELT";
	string ret4 = objectInsideOut.unscramble(param40);
	string need4 = "THREE FRENCH HENS TWO TURTLEDOVES  AND A PARTRIDGE";
	assert_eq(4,ret4,need4);

}