[Libreoffice-commits] core.git: sal/qa

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Thu Dec 3 17:13:30 UTC 2020


 sal/qa/rtl/math/test-rtl-math.cxx |   12 ++++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit 9467da7473b21006f748cea1f90e30e05ea32a1d
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Wed Dec 2 16:36:19 2020 +0100
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Thu Dec 3 18:12:53 2020 +0100

    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 at redhat.com>

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);


More information about the Libreoffice-commits mailing list