Beispiel #1
0
int main( int argc, char* argv[] ) {
	{
		int dARRAY[] = {0,1,2};
		vector <int> d( dARRAY, dARRAY+ARRSIZE(dARRAY) );
		PotentialGeometricSequence theObject;
		eq(0, theObject.numberOfSubsequences(d),6);
	}
	{
		int dARRAY[] = {1,2,4};
		vector <int> d( dARRAY, dARRAY+ARRSIZE(dARRAY) );
		PotentialGeometricSequence theObject;
		eq(1, theObject.numberOfSubsequences(d),5);
	}
	{
		int dARRAY[] = {3,2,1,0};
		vector <int> d( dARRAY, dARRAY+ARRSIZE(dARRAY) );
		PotentialGeometricSequence theObject;
		eq(2, theObject.numberOfSubsequences(d),10);
	}
	{
		int dARRAY[] = {1,2,4,8,16};
		vector <int> d( dARRAY, dARRAY+ARRSIZE(dARRAY) );
		PotentialGeometricSequence theObject;
		eq(3, theObject.numberOfSubsequences(d),9);
	}
	{
		int dARRAY[] = {1,3,5,5,5,5,64,4,23,2,3,4,5,4,3};
		vector <int> d( dARRAY, dARRAY+ARRSIZE(dARRAY) );
		PotentialGeometricSequence theObject;
		eq(4, theObject.numberOfSubsequences(d),37);
	}
	return 0;
}
double test2() {
	int t0[] = {3,2,1,0};
	vector <int> p0(t0, t0+sizeof(t0)/sizeof(int));
	PotentialGeometricSequence * obj = new PotentialGeometricSequence();
	clock_t start = clock();
	int my_answer = obj->numberOfSubsequences(p0);
	clock_t end = clock();
	delete obj;
	cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl;
	int p1 = 10;
	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;
	}
}