diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-02-08 07:48:59 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-02-08 09:15:01 +0100 |
commit | 6b00d0576a310796590631d14c54d7d5ea6814ac (patch) | |
tree | 2e11a4454592be39cfeaa68458cae964d8cdef5e /test | |
parent | 17149f65f03a34e88bb4a10abcd20e6891f5d7ca (diff) |
Improve loplugin:cppunitassertequal for CPPUNIT_ASSERT(a && b)
...by re-enabling the code temporarily #if'ed-out in
a528392e71bc70136021be4e3d83732fccbb885e "Fixed/improved
loplugin:cppunitassertequals" (and which then triggers lots of other
lopglugin:cppunitassertequal CPPUNIT_ASSERT -> CPPUNIT_ASSERT_EQUAL warnings).
For two css::uno::Reference equality comparisons in cppu/qa/test_any.cxx, it
was more straightforward to rewrite them with an explicit call to operator ==
(which silences loplugin:cppunitassertequal) than to adapt them to
CPPUNIT_ASSERT_EQUAL's requirement for arguments of identical types.
In sc/qa/unit/ucalc_pivottable.cxx, ScDPItemData needs toString, which has been
implemented trivially for now, but might want to combine that with the
DEBUG_PIVOT_TABLE-only ScDPItemData::Dump.
Change-Id: Iae6d09cf69bd4e52fe4411bba9e50c48e696291c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110546
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/source/sheet/xdocumentauditing.cxx | 4 | ||||
-rw-r--r-- | test/source/table/xcell.cxx | 4 | ||||
-rw-r--r-- | test/source/table/xcellcursor.cxx | 8 |
3 files changed, 8 insertions, 8 deletions
diff --git a/test/source/sheet/xdocumentauditing.cxx b/test/source/sheet/xdocumentauditing.cxx index acbab0968397..3a08fdb2e729 100644 --- a/test/source/sheet/xdocumentauditing.cxx +++ b/test/source/sheet/xdocumentauditing.cxx @@ -122,8 +122,8 @@ void XDocumentAuditing::testRefreshArrows() CPPUNIT_ASSERT_MESSAGE("Wrong amount of shapes on page", bResult); awt::Point Position1 = m_Position; - CPPUNIT_ASSERT_MESSAGE("Arrow has been refreshed", - Position0.X == Position1.X && Position0.Y == Position1.Y); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Arrow has been refreshed", Position0.X, Position1.X); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Arrow has been refreshed", Position0.Y, Position1.Y); xDocumentAuditing->refreshArrows(); diff --git a/test/source/table/xcell.cxx b/test/source/table/xcell.cxx index 921ef78bad83..8540117a5618 100644 --- a/test/source/table/xcell.cxx +++ b/test/source/table/xcell.cxx @@ -28,8 +28,8 @@ void XCell::testGetError() xCell->setFormula("=sqrt(-2)"); const sal_Int32 nIncorrectFormula = xCell->getError(); - CPPUNIT_ASSERT_MESSAGE("Successfully able to get Error", - (nCorrectFormula == 0) && (nIncorrectFormula != 0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Successfully able to get Error", sal_Int32(0), nCorrectFormula); + CPPUNIT_ASSERT_MESSAGE("Successfully able to get Error", (nIncorrectFormula != 0)); } void XCell::testGetType() diff --git a/test/source/table/xcellcursor.cxx b/test/source/table/xcellcursor.cxx index a8e7b2be5728..f564cb5874bc 100644 --- a/test/source/table/xcellcursor.cxx +++ b/test/source/table/xcellcursor.cxx @@ -95,8 +95,8 @@ void XCellCursor::testGoToStart() const sal_Int32 startCol = aCellRangeAddr.StartColumn; const sal_Int32 endRow = aCellRangeAddr.EndRow; const sal_Int32 endCol = aCellRangeAddr.EndColumn; - CPPUNIT_ASSERT_MESSAGE("Successfully able to got to Start", - (startCol == endCol) && (endRow == startRow)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Successfully able to got to Start", startCol, endCol); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Successfully able to got to Start", endRow, startRow); } void XCellCursor::testGoToEnd() @@ -118,8 +118,8 @@ void XCellCursor::testGoToEnd() const sal_Int32 startCol = aCellRangeAddr.StartColumn; const sal_Int32 endRow = aCellRangeAddr.EndRow; const sal_Int32 endCol = aCellRangeAddr.EndColumn; - CPPUNIT_ASSERT_MESSAGE("Successfully able to go to End", - (startCol == endCol) && (endRow == startRow)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Successfully able to go to End", startCol, endCol); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Successfully able to go to End", endRow, startRow); } } |