summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
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 3067e11ac167..aaadccc8e97c 100644
--- a/sal/qa/rtl/math/test-rtl-math.cxx
+++ b/sal/qa/rtl/math/test-rtl-math.cxx
@@ -469,6 +469,18 @@ public:
fVal = 123456.789;
aRes = rtl::math::doubleToUString(fVal, rtl_math_StringFormat_E, 2, '.', false);
CPPUNIT_ASSERT_EQUAL(OUString("1.23E+005"), aRes);
+
+ // Testing "after-treatment of up-rounding to the next decade" branch
+ // See void doubleToString in sal/rtl/math.cxx
+ // 1. Yet empty buffer
+ fVal = 9.9999999999999929;
+ aRes = rtl::math::doubleToUString(fVal, rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, '.', true);
+ CPPUNIT_ASSERT_EQUAL(OUString("10"), aRes);
+
+ // 2. Buffer with some content
+ fVal = 0.99999999999999933;
+ aRes = rtl::math::doubleToUString(fVal, rtl_math_StringFormat_F, rtl_math_DecimalPlaces_Max, '.', true);
+ CPPUNIT_ASSERT_EQUAL(OUString("1"), aRes);
}
void test_approx() {