void test_doubleCompare_2_05_and_2_05_should_return_0()
{
	double v1 = 2.05 ,v2 = 2.05;

	
	TEST_ASSERT_EQUAL(0,doubleCompare(&v1,&v2));
}
예제 #2
0
파일: dcmp.cpp 프로젝트: agul/atester
int main(int argc, char * argv[])
{
    setName("compare two doubles, maximal absolute or relative error = %.10lf", EPS);
    registerTestlibCmd(argc, argv);
    
    double ja = ans.readDouble();
    double pa = ouf.readDouble();
    
    if (!doubleCompare(ja, pa, EPS))
        quitf(_wa, "expected %.10lf, found %.10lf", ja, pa);
    
    quitf(_ok, "answer is %.10lf", ja);
}
예제 #3
0
int main(int argc, char* argv[ ]) {
    setName("compare two sequences of doubles, max absolute or relative error = %.9f", EPS);
    registerTestlibCmd(argc, argv);
    int n = 0;
    double j = 0, p = 0;
    while (!ans.seekEof()) {
        n++;
        j = ans.readDouble();
        p = ouf.readDouble();
        if (!doubleCompare(j, p, EPS))
            quitf(_wa, "%d%s numbers differ: expected '%.9f', found '%.9f', error '%.9f'",
                n, englishEnding(n).c_str(), j, p, doubleDelta(j, p)
            );
    }
    if (n == 1)
        quitf(_ok, "found '%.9f', expected '%.9f', error '%.9f'", p, j, doubleDelta(j, p));
    quitf(_ok, "%d numbers", n);
}
void test_doubleCompare_1_9_and_2_0_should_return_minus1()
{
	double v1 = 1.9 ,v2 = 2.0;

	TEST_ASSERT_EQUAL(-1,doubleCompare(&v1,&v2));
}
void test_doubleCompare_3_01_and_3_00_should_return_1()
{
	double v1 = 3.01,v2 = 3.00;
	TEST_ASSERT_EQUAL(1,doubleCompare(&v1,&v2));
}