示例#1
0
// BEGIN KAWIGIEDIT TESTING
// Generated by KawigiEdit 2.1.4 (beta) modified by pivanof
bool KawigiEdit_RunTest(int testNum, double p0, bool hasAnswer, double p1) {
	cout << "Test " << testNum << ": [" << p0;
	cout << "]" << endl;
	FixedPointTheorem *obj;
	double answer;
	obj = new FixedPointTheorem();
	clock_t startTime = clock();
	answer = obj->cycleRange(p0);
	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" << p1 << endl;
	}
	cout << "Your answer:" << endl;
	cout << "\t" << answer << endl;
	if (hasAnswer) {
		res = fabs(p1 - answer) <= 1e-9 * max(1.0, fabs(p1));
	}
	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;
}
示例#2
0
    void testCase6() {
		double R = 3.00005;
		double expected_ = 0.004713996108955176;
        assertEquals(6, expected_, solution.cycleRange(R));
    }
示例#3
0
    void testCase5() {
		double R = 3.5689;
		double expected_ = 0.5489996297493569;
        assertEquals(5, expected_, solution.cycleRange(R));
    }
示例#4
0
    void testCase4() {
		double R = 3.565;
		double expected_ = 0.5454276003030636;
        assertEquals(4, expected_, solution.cycleRange(R));
    }
示例#5
0
    void testCase3() {
		double R = 3.55;
		double expected_ = 0.5325704489850351;
        assertEquals(3, expected_, solution.cycleRange(R));
    }
示例#6
0
    void testCase2() {
		double R = 3.4499;
		double expected_ = 0.4175631735867292;
        assertEquals(2, expected_, solution.cycleRange(R));
    }
示例#7
0
    void testCase1() {
		double R = 3.05;
		double expected_ = 0.14754098360655865;
        assertEquals(1, expected_, solution.cycleRange(R));
    }
示例#8
0
    void testCase0() {
		double R = 0.1;
		double expected_ = 0.0;
        assertEquals(0, expected_, solution.cycleRange(R));
    }