Esempio n. 1
0
bool do_test(vector<int> numbers, long long __expected) {
    time_t startClock = clock();
    Cryptography *instance = new Cryptography();
    long long __result = instance->encrypt(numbers);
    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;
    }
}
Esempio n. 2
0
double test2() {
	int t0[] = {1000,999,998,997,996,995};
	vector <int> p0(t0, t0+sizeof(t0)/sizeof(int));
	Cryptography * obj = new Cryptography();
	clock_t start = clock();
	long long my_answer = obj->encrypt(p0);
	clock_t end = clock();
	delete obj;
	cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl;
	long long p1 = 986074810223904000LL;
	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;
	}
}
Esempio n. 3
0
int main() {
    Cryptography test;
    long ans = test.encrypt(numbers);
    printf("%d\n", ans);
    return 0;
}