Kaydet (Commit) 7452a444 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

use correct cppunit assert macro, loplugin:cppunitassertequals

Change-Id: If50f49e9a14e4594778d12e2890e4ebd47b670d4
Reviewed-on: https://gerrit.libreoffice.org/22756Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 3bd54fd1
...@@ -213,7 +213,7 @@ public: ...@@ -213,7 +213,7 @@ public:
std::cout << "CSVString: " << OUStringToOString(aCSVString, RTL_TEXTENCODING_UTF8).getStr() << std::endl; std::cout << "CSVString: " << OUStringToOString(aCSVString, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
std::cout << "result: " << (int)(aCSVString == aString) << std::endl; std::cout << "result: " << (int)(aCSVString == aString) << std::endl;
#endif //DEBUG_CSV_HANDLER #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; ++mnCol;
} }
......
...@@ -281,15 +281,15 @@ void testFormats(ScBootstrapFixture* pTest, ScDocument* pDoc, sal_Int32 nFormat) ...@@ -281,15 +281,15 @@ void testFormats(ScBootstrapFixture* pTest, ScDocument* pDoc, sal_Int32 nFormat)
ScConditionalFormat* pCondFormat = pDoc->GetCondFormat(0,0,2); ScConditionalFormat* pCondFormat = pDoc->GetCondFormat(0,0,2);
const ScRangeList& rRange = pCondFormat->GetRange(); 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); pCondFormat = pDoc->GetCondFormat(0,1,2);
const ScRangeList& rRange2 = pCondFormat->GetRange(); 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); pCondFormat = pDoc->GetCondFormat(1,1,2);
const ScRangeList& rRange3 = pCondFormat->GetRange(); 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) const SdrOle2Obj* getSingleChartObject(ScDocument& rDoc, sal_uInt16 nPage)
......
...@@ -601,10 +601,10 @@ void ScExportTest::testNamedRangeBugfdo62729() ...@@ -601,10 +601,10 @@ void ScExportTest::testNamedRangeBugfdo62729()
ScRangeName* pNames = rDoc.GetRangeName(); ScRangeName* pNames = rDoc.GetRangeName();
//should be just a single named range //should be just a single named range
CPPUNIT_ASSERT(pNames->size() == 1 ); CPPUNIT_ASSERT_EQUAL(size_t(1), pNames->size());
rDoc.DeleteTab(0); rDoc.DeleteTab(0);
//should be still a single named range //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); ScDocShellRef xDocSh = saveAndReload(xShell, FORMAT_ODS);
xShell->DoClose(); xShell->DoClose();
...@@ -613,7 +613,7 @@ void ScExportTest::testNamedRangeBugfdo62729() ...@@ -613,7 +613,7 @@ void ScExportTest::testNamedRangeBugfdo62729()
pNames = rDoc2.GetRangeName(); pNames = rDoc2.GetRangeName();
//after reload should still have a named range //after reload should still have a named range
CPPUNIT_ASSERT(pNames->size() == 1 ); CPPUNIT_ASSERT_EQUAL(size_t(1), pNames->size());
xDocSh->DoClose(); xDocSh->DoClose();
} }
...@@ -1262,7 +1262,7 @@ void ScExportTest::testCellNoteExportXLS() ...@@ -1262,7 +1262,7 @@ void ScExportTest::testCellNoteExportXLS()
ScDocShellRef xOrigDocSh = loadDoc("notes-on-3-sheets.", FORMAT_ODS); ScDocShellRef xOrigDocSh = loadDoc("notes-on-3-sheets.", FORMAT_ODS);
{ {
ScDocument& rDoc = xOrigDocSh->GetDocument(); 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. // Check note's presence.
CPPUNIT_ASSERT( rDoc.HasNote(ScAddress(0,0,0))); CPPUNIT_ASSERT( rDoc.HasNote(ScAddress(0,0,0)));
...@@ -1283,7 +1283,7 @@ void ScExportTest::testCellNoteExportXLS() ...@@ -1283,7 +1283,7 @@ void ScExportTest::testCellNoteExportXLS()
xOrigDocSh->DoClose(); xOrigDocSh->DoClose();
CPPUNIT_ASSERT(xNewDocSh.Is()); CPPUNIT_ASSERT(xNewDocSh.Is());
ScDocument& rDoc = xNewDocSh->GetDocument(); 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. // Check note's presence again.
CPPUNIT_ASSERT( rDoc.HasNote(ScAddress(0,0,0))); CPPUNIT_ASSERT( rDoc.HasNote(ScAddress(0,0,0)));
...@@ -1315,13 +1315,13 @@ void checkMatrixRange(ScDocument& rDoc, const ScRange& rRange) ...@@ -1315,13 +1315,13 @@ void checkMatrixRange(ScDocument& rDoc, const ScRange& rRange)
ScAddress aPos(nCol, nRow, rRange.aStart.Tab()); ScAddress aPos(nCol, nRow, rRange.aStart.Tab());
bool bIsMatrix = rDoc.GetMatrixFormulaRange(aPos, aMatRange); bool bIsMatrix = rDoc.GetMatrixFormulaRange(aPos, aMatRange);
CPPUNIT_ASSERT_MESSAGE("Matrix expected, but not found.", bIsMatrix); 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); const ScFormulaCell* pCell = rDoc.GetFormulaCell(aPos);
CPPUNIT_ASSERT_MESSAGE("This must be a formula cell.", pCell); CPPUNIT_ASSERT_MESSAGE("This must be a formula cell.", pCell);
bIsMatrix = pCell->GetMatrixOrigin(aMatOrigin); bIsMatrix = pCell->GetMatrixOrigin(aMatOrigin);
CPPUNIT_ASSERT_MESSAGE("Not a part of matrix formula.", bIsMatrix); 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() ...@@ -1433,8 +1433,8 @@ void ScExportTest::testSheetProtectionXLSX()
// check has // check has
if (aHash.getLength() >= 2) if (aHash.getLength() >= 2)
{ {
CPPUNIT_ASSERT( (sal_uInt8)aHash[0] == 204 ); CPPUNIT_ASSERT_EQUAL(sal_uInt8(204), (sal_uInt8)aHash[0]);
CPPUNIT_ASSERT( (sal_uInt8)aHash[1] == 61 ); CPPUNIT_ASSERT_EQUAL(sal_uInt8(61), (sal_uInt8)aHash[1]);
} }
// we could flesh out this check I guess // we could flesh out this check I guess
CPPUNIT_ASSERT ( !pTabProtect->isOptionEnabled( ScTableProtection::OBJECTS ) ); CPPUNIT_ASSERT ( !pTabProtect->isOptionEnabled( ScTableProtection::OBJECTS ) );
......
...@@ -1827,7 +1827,7 @@ void ScFiltersTest::testPivotTableNamedRangeSourceODS() ...@@ -1827,7 +1827,7 @@ void ScFiltersTest::testPivotTableNamedRangeSourceODS()
ScDocument& rDoc = xDocSh->GetDocument(); ScDocument& rDoc = xDocSh->GetDocument();
ScDPCollection* pDPs = rDoc.GetDPCollection(); ScDPCollection* pDPs = rDoc.GetDPCollection();
CPPUNIT_ASSERT(pDPs->GetCount() == 1); CPPUNIT_ASSERT_EQUAL(size_t(1), pDPs->GetCount());
ScDPObject* pDP = &(*pDPs)[0]; ScDPObject* pDP = &(*pDPs)[0];
CPPUNIT_ASSERT(pDP); CPPUNIT_ASSERT(pDP);
...@@ -1839,7 +1839,7 @@ void ScFiltersTest::testPivotTableNamedRangeSourceODS() ...@@ -1839,7 +1839,7 @@ void ScFiltersTest::testPivotTableNamedRangeSourceODS()
sal_uInt16 nOrient; sal_uInt16 nOrient;
long nDim = pDP->GetHeaderDim(ScAddress(0,1,1), 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.", CPPUNIT_ASSERT_MESSAGE("This dimension should be a page dimension.",
nOrient == sheet::DataPilotFieldOrientation_PAGE); nOrient == sheet::DataPilotFieldOrientation_PAGE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment