summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2020-12-02 16:36:19 +0100
committerEike Rathke <erack@redhat.com>2020-12-03 18:12:53 +0100
commit9467da7473b21006f748cea1f90e30e05ea32a1d (patch)
tree9e37e1f3b1dbdde48d4b1dd19a007a6f05666b08 /sal
parente65b31244fa7d2f9bfffb7e7b9567e623a4cbf0b (diff)
tdf#138360: sal_rtl: Add unittest
Change-Id: Iac6c4bf09f55446128d7fb7a35b483ca41bc4f00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107080 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sal')
-rw-r--r--sal/qa/rtl/math/test-rtl-math.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/sal/qa/rtl/math/test-rtl-math.cxx b/sal/qa/rtl/math/test-rtl-math.cxx
index 799787e9d4a9..d5bbac1a684e 100644
--- a/sal/qa/rtl/math/test-rtl-math.cxx
+++ b/sal/qa/rtl/math/test-rtl-math.cxx
@@ -275,6 +275,17 @@ public:
CPPUNIT_ASSERT_EQUAL(0.0, res);
}
+ void test_round() {
+ double fVal = 5000000000000001.0;
+ CPPUNIT_ASSERT_EQUAL( 5000000000000001.0, rtl::math::round( fVal, 9, rtl_math_RoundingMode_Corrected));
+
+ fVal = 8796093022188.0;
+ CPPUNIT_ASSERT_EQUAL( 6093022188.0 , rtl::math::round( fVal, 9, rtl_math_RoundingMode_Corrected) - 8790000000000);
+
+ fVal = 4503599627370491.0;
+ CPPUNIT_ASSERT_EQUAL( 4503599627370000.0, rtl::math::round( fVal, -3, rtl_math_RoundingMode_Corrected));
+ }
+
void test_doubleToString() {
double fVal = 999999999999999.0;
sal_Int32 aGroups[3] = { 3, 2, 0 };
@@ -596,6 +607,7 @@ public:
CPPUNIT_TEST(test_stringToDouble_good);
CPPUNIT_TEST(test_stringToDouble_bad);
CPPUNIT_TEST(test_stringToDouble_exponent_without_digit);
+ CPPUNIT_TEST(test_round);
CPPUNIT_TEST(test_doubleToString);
CPPUNIT_TEST(test_erf);
CPPUNIT_TEST(test_erfc);