summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-01-14 20:27:30 +0100
committerEike Rathke <erack@redhat.com>2016-01-14 20:53:30 +0100
commit5299400e5cce3060a0de85bb4dedd065b5ad1f41 (patch)
tree6cf27e5d8c1397d153a81704b6dc7fe63e387562
parentfdf982f70b2944053d995baaa3d78c7cdc4bbc4b (diff)
unit test for negative decimal places rounding, tdf#96918 related
Change-Id: Ib2f3ffaa7c4216b66479c750465c2beab927405a
-rw-r--r--sal/qa/rtl/math/test-rtl-math.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/sal/qa/rtl/math/test-rtl-math.cxx b/sal/qa/rtl/math/test-rtl-math.cxx
index 47736f1986a3..3de49569a082 100644
--- a/sal/qa/rtl/math/test-rtl-math.cxx
+++ b/sal/qa/rtl/math/test-rtl-math.cxx
@@ -97,6 +97,20 @@ public:
'.', aGroups, ',', true));
CPPUNIT_ASSERT_EQUAL( OUString("99,99,99,99,99,99,999"), aRes);
+ fVal = 949.0;
+ aRes = rtl::math::doubleToUString( fVal,
+ rtl_math_StringFormat_Automatic,
+ -2, // round before decimals
+ '.', aGroups, ',', true);
+ CPPUNIT_ASSERT_EQUAL( OUString("900"), aRes);
+
+ fVal = 950.0;
+ aRes = rtl::math::doubleToUString( fVal,
+ rtl_math_StringFormat_Automatic,
+ -2, // round before decimals
+ '.', aGroups, ',', true);
+ CPPUNIT_ASSERT_EQUAL( OUString("1,000"), aRes);
+
fVal = 4503599627370495.0;
aRes = rtl::math::doubleToUString( fVal,
rtl_math_StringFormat_Automatic,