summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-10-24 21:31:45 +0200
committerEike Rathke <erack@redhat.com>2015-10-24 21:34:53 +0200
commit9846b6ab3d36c8b2696e8829c121016f9fa81e66 (patch)
tree16fa3fc4ccead8df887b0cfa84f4cef3f4d2472a /sal
parent5f2db274dbf4d8b808f9ddbe4959deadbc1ec9fa (diff)
unit tests for rtl_math_erf() and rtl_math_erfc()
Change-Id: Ia6b025ba9980f0a7b333b2dc4ae708c3a63fca21
Diffstat (limited to 'sal')
-rw-r--r--sal/qa/rtl/math/test-rtl-math.cxx34
1 files changed, 34 insertions, 0 deletions
diff --git a/sal/qa/rtl/math/test-rtl-math.cxx b/sal/qa/rtl/math/test-rtl-math.cxx
index e6422c4bdeb9..b462de480431 100644
--- a/sal/qa/rtl/math/test-rtl-math.cxx
+++ b/sal/qa/rtl/math/test-rtl-math.cxx
@@ -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();
};