diff options
author | Aleksas Pantechovskis <alex.pantec@gmail.com> | 2016-03-04 18:25:59 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-03-05 21:38:03 +0000 |
commit | 714281d859ac1b25c6cf678aec865654f8ce1dee (patch) | |
tree | 6d19280a199bdf663e3da1a1a522d1c58398922f /sc/qa | |
parent | c0207352c053690adad68caa7d4e34b8fe1c1956 (diff) |
tdf#98264, replace CPPUNIT_ASSERT with CPPUNIT_ASSERT_EQUAL
Use correct assert in places from the clang plugin output in the bug report,
also fix some asserts of doubles and argument order (expected, actual)
Change-Id: I4e8e36f3025d74af2baf4a9be27fe4869c82e8cd
Reviewed-on: https://gerrit.libreoffice.org/22911
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/filters-test.cxx | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index 33bf05450140..096d3fb0b82b 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -159,20 +159,20 @@ void testRangeNameImpl(ScDocument& rDoc) CPPUNIT_ASSERT_MESSAGE("range name Global1 not found", pRangeData); double aValue; rDoc.GetValue(1,0,0,aValue); - CPPUNIT_ASSERT_MESSAGE("range name Global1 should reference Sheet1.A1", aValue == 1); + ASSERT_DOUBLES_EQUAL_MESSAGE("range name Global1 should reference Sheet1.A1", 1.0, aValue); pRangeData = rDoc.GetRangeName(0)->findByUpperName(OUString("LOCAL1")); CPPUNIT_ASSERT_MESSAGE("range name Sheet1.Local1 not found", pRangeData); rDoc.GetValue(1,2,0,aValue); - CPPUNIT_ASSERT_MESSAGE("range name Sheet1.Local1 should reference Sheet1.A3", aValue == 3); + ASSERT_DOUBLES_EQUAL_MESSAGE("range name Sheet1.Local1 should reference Sheet1.A3", 3.0, aValue); pRangeData = rDoc.GetRangeName(1)->findByUpperName(OUString("LOCAL2")); CPPUNIT_ASSERT_MESSAGE("range name Sheet2.Local2 not found", pRangeData); //check for correct results for the remaining formulas rDoc.GetValue(1,1,0, aValue); - CPPUNIT_ASSERT_MESSAGE("=global2 should be 2", aValue == 2); + ASSERT_DOUBLES_EQUAL_MESSAGE("=global2 should be 2", 2.0, aValue); rDoc.GetValue(1,3,0, aValue); - CPPUNIT_ASSERT_MESSAGE("=local2 should be 4", aValue == 4); + ASSERT_DOUBLES_EQUAL_MESSAGE("=local2 should be 4", 4.0, aValue); rDoc.GetValue(2,0,0, aValue); - CPPUNIT_ASSERT_MESSAGE("=SUM(global3) should be 10", aValue == 10); + ASSERT_DOUBLES_EQUAL_MESSAGE("=SUM(global3) should be 10", 10.0, aValue); } } @@ -202,26 +202,26 @@ void testContentImpl(ScDocument& rDoc, sal_Int32 nFormat ) //same code for ods, double fValue; //check value import rDoc.GetValue(0,0,0,fValue); - CPPUNIT_ASSERT_MESSAGE("value not imported correctly", fValue == 1); + ASSERT_DOUBLES_EQUAL_MESSAGE("value not imported correctly", 1.0, fValue); rDoc.GetValue(0,1,0,fValue); - CPPUNIT_ASSERT_MESSAGE("value not imported correctly", fValue == 2); + ASSERT_DOUBLES_EQUAL_MESSAGE("value not imported correctly", 2.0, fValue); OUString aString = rDoc.GetString(1, 0, 0); //check string import - CPPUNIT_ASSERT_MESSAGE("string imported not correctly", aString == "String1"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("string imported not correctly", OUString("String1"), aString); aString = rDoc.GetString(1, 1, 0); - CPPUNIT_ASSERT_MESSAGE("string not imported correctly", aString == "String2"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("string not imported correctly", OUString("String2"), aString); //check basic formula import // in case of DIF it just contains values rDoc.GetValue(2,0,0,fValue); - CPPUNIT_ASSERT_MESSAGE("=2*3", fValue == 6); + ASSERT_DOUBLES_EQUAL_MESSAGE("=2*3", 6.0, fValue); rDoc.GetValue(2,1,0,fValue); - CPPUNIT_ASSERT_MESSAGE("=2+3", fValue == 5); + ASSERT_DOUBLES_EQUAL_MESSAGE("=2+3", 5.0, fValue); rDoc.GetValue(2,2,0,fValue); - CPPUNIT_ASSERT_MESSAGE("=2-3", fValue == -1); + ASSERT_DOUBLES_EQUAL_MESSAGE("=2-3", -1.0, fValue); rDoc.GetValue(2,3,0,fValue); - CPPUNIT_ASSERT_MESSAGE("=C1+C2", fValue == 11); + ASSERT_DOUBLES_EQUAL_MESSAGE("=C1+C2", 11.0, fValue); //check merged cells import if (nFormat != FORMAT_LOTUS123 && nFormat != FORMAT_DIF) @@ -418,7 +418,7 @@ void ScFiltersTest::testSheetNamesXLSX() ScDocument& rDoc = xDocSh->GetDocument(); std::vector<OUString> aTabNames = rDoc.GetAllTableNames(); - CPPUNIT_ASSERT_MESSAGE("The document should have 5 sheets in total.", aTabNames.size() == 5); + CPPUNIT_ASSERT_EQUAL_MESSAGE("The document should have 5 sheets in total.", size_t(5), aTabNames.size()); CPPUNIT_ASSERT_EQUAL(OUString("S&P"), aTabNames[0]); CPPUNIT_ASSERT_EQUAL(OUString("Sam's Club"), aTabNames[1]); CPPUNIT_ASSERT_EQUAL(OUString("\"The Sheet\""), aTabNames[2]); |