sc/qa/unit/helper/csv_handler.hxx | 2 +- sc/qa/unit/helper/qahelper.cxx | 6 +++--- sc/qa/unit/subsequent_export-test.cxx | 18 +++++++++--------- sc/qa/unit/subsequent_filters-test.cxx | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-)
New commits: commit 7452a44466607ad9a3c90f801016aa1985397b88 Author: Markus Mohrhard <[email protected]> Date: Mon Feb 29 02:41:04 2016 +0100 use correct cppunit assert macro, loplugin:cppunitassertequals Change-Id: If50f49e9a14e4594778d12e2890e4ebd47b670d4 Reviewed-on: https://gerrit.libreoffice.org/22756 Tested-by: Jenkins <[email protected]> Reviewed-by: Markus Mohrhard <[email protected]> diff --git a/sc/qa/unit/helper/csv_handler.hxx b/sc/qa/unit/helper/csv_handler.hxx index 115b6bc..54a0ec4 100644 --- a/sc/qa/unit/helper/csv_handler.hxx +++ b/sc/qa/unit/helper/csv_handler.hxx @@ -213,7 +213,7 @@ public: std::cout << "CSVString: " << OUStringToOString(aCSVString, RTL_TEXTENCODING_UTF8).getStr() << std::endl; std::cout << "result: " << (int)(aCSVString == aString) << std::endl; #endif //DEBUG_CSV_HANDLER - CPPUNIT_ASSERT_MESSAGE(createErrorMessage(mnCol, mnRow, mnTab, aCSVString, aString).getStr(), aString == aCSVString ); + CPPUNIT_ASSERT_EQUAL_MESSAGE(createErrorMessage(mnCol, mnRow, mnTab, aCSVString, aString).getStr(), aCSVString, aString ); ++mnCol; } diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 96dbf5c..b59beb0 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -281,15 +281,15 @@ void testFormats(ScBootstrapFixture* pTest, ScDocument* pDoc, sal_Int32 nFormat) ScConditionalFormat* pCondFormat = pDoc->GetCondFormat(0,0,2); const ScRangeList& rRange = pCondFormat->GetRange(); - CPPUNIT_ASSERT(rRange == ScRange(0,0,2,3,0,2)); + CPPUNIT_ASSERT_EQUAL(ScRangeList(ScRange(0,0,2,3,0,2)), rRange); pCondFormat = pDoc->GetCondFormat(0,1,2); const ScRangeList& rRange2 = pCondFormat->GetRange(); - CPPUNIT_ASSERT(rRange2 == ScRange(0,1,2,0,1,2)); + CPPUNIT_ASSERT_EQUAL(ScRangeList(ScRange(0,1,2,0,1,2)), rRange2); pCondFormat = pDoc->GetCondFormat(1,1,2); const ScRangeList& rRange3 = pCondFormat->GetRange(); - CPPUNIT_ASSERT(rRange3 == ScRange(1,1,2,3,1,2)); + CPPUNIT_ASSERT_EQUAL(ScRangeList(ScRange(1,1,2,3,1,2)), rRange3); } const SdrOle2Obj* getSingleChartObject(ScDocument& rDoc, sal_uInt16 nPage) diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index c01426a..caeb15d 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -601,10 +601,10 @@ void ScExportTest::testNamedRangeBugfdo62729() ScRangeName* pNames = rDoc.GetRangeName(); //should be just a single named range - CPPUNIT_ASSERT(pNames->size() == 1 ); + CPPUNIT_ASSERT_EQUAL(size_t(1), pNames->size()); rDoc.DeleteTab(0); //should be still a single named range - CPPUNIT_ASSERT(pNames->size() == 1 ); + CPPUNIT_ASSERT_EQUAL(size_t(1), pNames->size()); ScDocShellRef xDocSh = saveAndReload(xShell, FORMAT_ODS); xShell->DoClose(); @@ -613,7 +613,7 @@ void ScExportTest::testNamedRangeBugfdo62729() pNames = rDoc2.GetRangeName(); //after reload should still have a named range - CPPUNIT_ASSERT(pNames->size() == 1 ); + CPPUNIT_ASSERT_EQUAL(size_t(1), pNames->size()); xDocSh->DoClose(); } @@ -1262,7 +1262,7 @@ void ScExportTest::testCellNoteExportXLS() ScDocShellRef xOrigDocSh = loadDoc("notes-on-3-sheets.", FORMAT_ODS); { ScDocument& rDoc = xOrigDocSh->GetDocument(); - CPPUNIT_ASSERT_MESSAGE("This document should have 3 sheets.", rDoc.GetTableCount() == 3); + CPPUNIT_ASSERT_EQUAL_MESSAGE("This document should have 3 sheets.", SCTAB(3), rDoc.GetTableCount()); // Check note's presence. CPPUNIT_ASSERT( rDoc.HasNote(ScAddress(0,0,0))); @@ -1283,7 +1283,7 @@ void ScExportTest::testCellNoteExportXLS() xOrigDocSh->DoClose(); CPPUNIT_ASSERT(xNewDocSh.Is()); ScDocument& rDoc = xNewDocSh->GetDocument(); - CPPUNIT_ASSERT_MESSAGE("This document should have 3 sheets.", rDoc.GetTableCount() == 3); + CPPUNIT_ASSERT_EQUAL_MESSAGE("This document should have 3 sheets.", SCTAB(3), rDoc.GetTableCount()); // Check note's presence again. CPPUNIT_ASSERT( rDoc.HasNote(ScAddress(0,0,0))); @@ -1315,13 +1315,13 @@ void checkMatrixRange(ScDocument& rDoc, const ScRange& rRange) ScAddress aPos(nCol, nRow, rRange.aStart.Tab()); bool bIsMatrix = rDoc.GetMatrixFormulaRange(aPos, aMatRange); CPPUNIT_ASSERT_MESSAGE("Matrix expected, but not found.", bIsMatrix); - CPPUNIT_ASSERT_MESSAGE("Wrong matrix range.", rRange == aMatRange); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong matrix range.", rRange, aMatRange); const ScFormulaCell* pCell = rDoc.GetFormulaCell(aPos); CPPUNIT_ASSERT_MESSAGE("This must be a formula cell.", pCell); bIsMatrix = pCell->GetMatrixOrigin(aMatOrigin); CPPUNIT_ASSERT_MESSAGE("Not a part of matrix formula.", bIsMatrix); - CPPUNIT_ASSERT_MESSAGE("Wrong matrix origin.", aMatOrigin == aMatRange.aStart); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong matrix origin.", aMatRange.aStart, aMatOrigin); } } } @@ -1433,8 +1433,8 @@ void ScExportTest::testSheetProtectionXLSX() // check has if (aHash.getLength() >= 2) { - CPPUNIT_ASSERT( (sal_uInt8)aHash[0] == 204 ); - CPPUNIT_ASSERT( (sal_uInt8)aHash[1] == 61 ); + CPPUNIT_ASSERT_EQUAL(sal_uInt8(204), (sal_uInt8)aHash[0]); + CPPUNIT_ASSERT_EQUAL(sal_uInt8(61), (sal_uInt8)aHash[1]); } // we could flesh out this check I guess CPPUNIT_ASSERT ( !pTabProtect->isOptionEnabled( ScTableProtection::OBJECTS ) ); diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 92648a8..efd1859 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -1827,7 +1827,7 @@ void ScFiltersTest::testPivotTableNamedRangeSourceODS() ScDocument& rDoc = xDocSh->GetDocument(); ScDPCollection* pDPs = rDoc.GetDPCollection(); - CPPUNIT_ASSERT(pDPs->GetCount() == 1); + CPPUNIT_ASSERT_EQUAL(size_t(1), pDPs->GetCount()); ScDPObject* pDP = &(*pDPs)[0]; CPPUNIT_ASSERT(pDP); @@ -1839,7 +1839,7 @@ void ScFiltersTest::testPivotTableNamedRangeSourceODS() sal_uInt16 nOrient; long nDim = pDP->GetHeaderDim(ScAddress(0,1,1), nOrient); - CPPUNIT_ASSERT_MESSAGE("Failed to detect header dimension.", nDim == 0); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Failed to detect header dimension.", long(0), nDim); CPPUNIT_ASSERT_MESSAGE("This dimension should be a page dimension.", nOrient == sheet::DataPilotFieldOrientation_PAGE); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
