summaryrefslogtreecommitdiff
path: root/tools/qa
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-09-14 08:49:52 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-09-15 09:53:57 +0200
commit331e2e5ed3bf4e0b2c1fab3b7bca836170317827 (patch)
tree09fb12876006112c5bf5f8f33ec72641b828885c /tools/qa
parent54e608c6605ca2bcfd8dfdbe674d5110a18d2c5c (diff)
long->sal_Int32 in Fraction
because long is 32bits on Windows and 64bits on Linux. Reasoning: (a) all the users of Fraction used to be 32bit in the past (b) this makes the Linux code behave the same as the Windows code (c) changing it to 64bits would be dangerous because then call sites could see silent truncation. Change-Id: I2a36200623a3cf2e7d62ccad030a20614e1798fb Reviewed-on: https://gerrit.libreoffice.org/42200 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'tools/qa')
-rw-r--r--tools/qa/cppunit/test_fract.cxx19
1 files changed, 2 insertions, 17 deletions
diff --git a/tools/qa/cppunit/test_fract.cxx b/tools/qa/cppunit/test_fract.cxx
index 6352588ef6b2..12977b5635f8 100644
--- a/tools/qa/cppunit/test_fract.cxx
+++ b/tools/qa/cppunit/test_fract.cxx
@@ -73,27 +73,12 @@ public:
aFract3.GetNumerator() == 2 &&
aFract3.GetDenominator() == 1 );
-#if SAL_TYPES_SIZEOFLONG == 8
- Fraction aFract4(0x7AAAAAAAAAAAAAAA, 0x3555555555555555);
- CPPUNIT_ASSERT_MESSAGE( "Fraction #4 cancellation wrong",
- aFract4.GetNumerator() == 0x7AAAAAAAAAAAAAAA &&
- aFract4.GetDenominator() == 0x3555555555555555 );
- aFract4.ReduceInaccurate(62);
- CPPUNIT_ASSERT_MESSAGE( "Fraction #4 ReduceInaccurate errorneously cut precision",
- aFract4.GetNumerator() == 0x7AAAAAAAAAAAAAAA &&
- aFract4.GetDenominator() == 0x3555555555555555 );
-
- aFract4.ReduceInaccurate(61);
- CPPUNIT_ASSERT_MESSAGE( "Fraction #4 ReduceInaccurate reduce to 61 bit failed",
- aFract4.GetNumerator() == 0x3D55555555555555 &&
- aFract4.GetDenominator() == 0x1AAAAAAAAAAAAAAA );
-#endif
}
void testMinLongDouble() {
Fraction f(double(SAL_MIN_INT32));
- CPPUNIT_ASSERT_EQUAL(long(SAL_MIN_INT32), f.GetNumerator());
- CPPUNIT_ASSERT_EQUAL(1L, f.GetDenominator());
+ CPPUNIT_ASSERT_EQUAL(SAL_MIN_INT32, f.GetNumerator());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), f.GetDenominator());
}
void testCreateFromDoubleIn32BitsPlatform() {