Beispiel #1
0
int main()
{
  CCipher c;

  cout << c.decode("VQREQFGT",2) <<endl;

    cout << c.decode("ABCDEFGHIJKLMNOPQRSTUVWXYZ",10) <<endl;
}
int main()
{
   CCipher test;
   string s,t;
   cin>>s;
  //cout<<s;
   t=test.decode(s,3);
   cout<<endl<<t;
   return 0;
}
Beispiel #3
0
bool do_test(string cipherText, int shift, string __expected) {
    time_t startClock = clock();
    CCipher *instance = new CCipher();
    string __result = instance->decode(cipherText, shift);
    double elapsed = (double)(clock() - startClock) / CLOCKS_PER_SEC;
    delete instance;

    if (__result == __expected) {
        cout << "PASSED!" << " (" << elapsed << " seconds)" << endl;
        return true;
    }
    else {
        cout << "FAILED!" << " (" << elapsed << " seconds)" << endl;
        cout << "           Expected: " << to_string(__expected) << endl;
        cout << "           Received: " << to_string(__result) << endl;
        return false;
    }
}
Beispiel #4
0
double test2() {
	string p0 = "TOPCODER";
	int p1 = 0;
	CCipher * obj = new CCipher();
	clock_t start = clock();
	string my_answer = obj->decode(p0, p1);
	clock_t end = clock();
	delete obj;
	cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl;
	string p2 = "TOPCODER";
	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;
	}
}
Beispiel #5
0
    void testCase5() {
		string cipherText = "LIPPSASVPH";
		int shift = 4;
		string expected_ = "HELLOWORLD";
        assertEquals(5, expected_, solution.decode(cipherText, shift));
    }
Beispiel #6
0
    void testCase4() {
		string cipherText = "DBNPCBQ";
		int shift = 1;
		string expected_ = "CAMOBAP";
        assertEquals(4, expected_, solution.decode(cipherText, shift));
    }
Beispiel #7
0
    void testCase3() {
		string cipherText = "ZWBGLZ";
		int shift = 25;
		string expected_ = "AXCHMA";
        assertEquals(3, expected_, solution.decode(cipherText, shift));
    }
Beispiel #8
0
    void testCase2() {
		string cipherText = "TOPCODER";
		int shift = 0;
		string expected_ = "TOPCODER";
        assertEquals(2, expected_, solution.decode(cipherText, shift));
    }
Beispiel #9
0
    void testCase1() {
		string cipherText = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
		int shift = 10;
		string expected_ = "QRSTUVWXYZABCDEFGHIJKLMNOP";
        assertEquals(1, expected_, solution.decode(cipherText, shift));
    }
Beispiel #10
0
    void testCase0() {
		string cipherText = "VQREQFGT";
		int shift = 2;
		string expected_ = "TOPCODER";
        assertEquals(0, expected_, solution.decode(cipherText, shift));
    }
Beispiel #11
0
int main(int argc, char *argv[])
{
	CCipher obj;
	cout<<obj.decode("VQREQFGT",2);

}
int main() {
  CCipher cc;
  cout << cc.decode("ABCDEFGHIJKLMNOPQRSTUVWXYZ", 10) << endl;
  return 0;
}