Kaydet (Commit) 9846b6ab authored tarafından Eike Rathke's avatar Eike Rathke

unit tests for rtl_math_erf() and rtl_math_erfc()

Change-Id: Ia6b025ba9980f0a7b333b2dc4ae708c3a63fca21
üst 5f2db274
......@@ -88,10 +88,44 @@ public:
CPPUNIT_ASSERT_EQUAL(0.0, res);
}
void test_erf() {
double x, res;
x = 0.0;
res = rtl::math::erf(x);
CPPUNIT_ASSERT_EQUAL(0.0,res);
rtl::math::setInf( &x, false);
res = rtl::math::erf(x);
CPPUNIT_ASSERT_EQUAL(1.0,res);
rtl::math::setInf( &x, true);
res = rtl::math::erf(x);
CPPUNIT_ASSERT_EQUAL(-1.0,res);
rtl::math::setNan( &x);
res = rtl::math::erf(x);
CPPUNIT_ASSERT_EQUAL(true,rtl::math::isNan(x));
}
void test_erfc() {
double x, res;
x = 0.0;
res = rtl::math::erfc(x);
CPPUNIT_ASSERT_EQUAL(1.0,res);
rtl::math::setInf( &x, false);
res = rtl::math::erfc(x);
CPPUNIT_ASSERT_EQUAL(0.0,res);
rtl::math::setInf( &x, true);
res = rtl::math::erfc(x);
CPPUNIT_ASSERT_EQUAL(2.0,res);
rtl::math::setNan( &x);
res = rtl::math::erfc(x);
CPPUNIT_ASSERT_EQUAL(true,rtl::math::isNan(x));
}
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(test_stringToDouble_good);
CPPUNIT_TEST(test_stringToDouble_bad);
CPPUNIT_TEST(test_stringToDouble_exponent_without_digit);
CPPUNIT_TEST(test_erf);
CPPUNIT_TEST(test_erfc);
CPPUNIT_TEST_SUITE_END();
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment