示例#1
0
double test1()
{
    long long p0 = 1LL;
    long long p1 = 2LL;
    long long p2 = 3LL;
    int p3 = 3;
    FoxPaintingBalls * obj = new FoxPaintingBalls();
    clock_t start = clock();
    long long my_answer = obj->theMax(p0, p1, p2, p3);
    clock_t end = clock();
    delete obj;
    cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl;
    long long p4 = 0LL;
    cout <<"Desired answer: " <<endl;
    cout <<"\t" << p4 <<endl;
    cout <<"Your answer: " <<endl;
    cout <<"\t" << my_answer <<endl;
    if (p4 != my_answer)
    {
        cout <<"DOESN'T MATCH!!!!" <<endl <<endl;
        return -1;
    }
    else
    {
        cout <<"Match :-)" <<endl <<endl;
        return (double)(end-start)/CLOCKS_PER_SEC;
    }
}
示例#2
0
double test5()
{
    long long p0 = 19330428391852493LL;
    long long p1 = 48815737582834113LL;
    long long p2 = 11451481019198930LL;
    int p3 = 3456;
    FoxPaintingBalls * obj = new FoxPaintingBalls();
    clock_t start = clock();
    long long my_answer = obj->theMax(p0, p1, p2, p3);
    clock_t end = clock();
    delete obj;
    cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl;
    long long p4 = 5750952686LL;
    cout <<"Desired answer: " <<endl;
    cout <<"\t" << p4 <<endl;
    cout <<"Your answer: " <<endl;
    cout <<"\t" << my_answer <<endl;
    if (p4 != my_answer)
    {
        cout <<"DOESN'T MATCH!!!!" <<endl <<endl;
        return -1;
    }
    else
    {
        cout <<"Match :-)" <<endl <<endl;
        return (double)(end-start)/CLOCKS_PER_SEC;
    }
}
示例#3
0
bool KawigiEdit_RunTest(int testNum, long long p0, long long p1, long long p2, int p3, bool hasAnswer, long long p4) {
	cout << "Test " << testNum << ": [" << p0 << "," << p1 << "," << p2 << "," << p3;
	cout << "]" << endl;
	FoxPaintingBalls *obj;
	long long answer;
	obj = new FoxPaintingBalls();
	clock_t startTime = clock();
	answer = obj->theMax(p0, p1, p2, p3);
	clock_t endTime = clock();
	delete obj;
	bool res;
	res = true;
	cout << "Time: " << double(endTime - startTime) / CLOCKS_PER_SEC << " seconds" << endl;
	if (hasAnswer) {
		cout << "Desired answer:" << endl;
		cout << "\t" << p4 << endl;
	}
	cout << "Your answer:" << endl;
	cout << "\t" << answer << endl;
	if (hasAnswer) {
		res = answer == p4;
	}
	if (!res) {
		cout << "DOESN'T MATCH!!!!" << endl;
	} else if (double(endTime - startTime) / CLOCKS_PER_SEC >= 2) {
		cout << "FAIL the timeout" << endl;
		res = false;
	} else if (hasAnswer) {
		cout << "Match :-)" << endl;
	} else {
		cout << "OK, but is it right?" << endl;
	}
	cout << "" << endl;
	return res;
}
示例#4
0
int main(int argc, char* argv[]) {
  FoxPaintingBalls test;
  {
    test.runTest(2, 2, 2, 3, 1);
  }
  {
    test.runTest(1, 2, 3, 3, 0);
  }
  {
    test.runTest(8, 6, 6, 4, 2);
  }
  {
    test.runTest(7, 6, 7, 4, 2);
  }
  {
    test.runTest(100, 100, 100, 4, 30);
  }
  {
    test.runTest(1, 1, 1, 1, 3);
  }
  {
    test.runTest(19330428391852493, 48815737582834113, 11451481019198930, 3456, 5750952686);
  }
}