[Libreoffice-commits] core.git: writerperfect/qa xmloff/qa

Miklos Vajna vmiklos at collabora.co.uk
Fri Jan 6 09:35:28 UTC 2017


 writerperfect/qa/unit/DirectoryStreamTest.cxx |    2 +-
 writerperfect/qa/unit/WPXSvStreamTest.cxx     |   24 ++++++++++++------------
 xmloff/qa/unit/uxmloff.cxx                    |    6 +++---
 3 files changed, 16 insertions(+), 16 deletions(-)

New commits:
commit ff8f5e6255ed7b627fb42ecd9e2222f18293218f
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Jan 6 08:33:59 2017 +0100

    writerperfect, xmloff: fix loplugin:cppunitassertequals warnings
    
    Change-Id: Ie8246433a7cea0886f00d8c76cf6f7d023545417
    Reviewed-on: https://gerrit.libreoffice.org/32770
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/writerperfect/qa/unit/DirectoryStreamTest.cxx b/writerperfect/qa/unit/DirectoryStreamTest.cxx
index 79646ed..0b347ac 100644
--- a/writerperfect/qa/unit/DirectoryStreamTest.cxx
+++ b/writerperfect/qa/unit/DirectoryStreamTest.cxx
@@ -139,7 +139,7 @@ void lcl_testDataOperations(RVNGInputStream &rStream)
     CPPUNIT_ASSERT_EQUAL(-1, rStream.seek(0, librevenge::RVNG_SEEK_CUR));
 
     unsigned long numBytesRead = 0;
-    CPPUNIT_ASSERT(nullptr == rStream.read(1, numBytesRead));
+    CPPUNIT_ASSERT(!rStream.read(1, numBytesRead));
     CPPUNIT_ASSERT_EQUAL(0UL, numBytesRead);
 }
 
diff --git a/writerperfect/qa/unit/WPXSvStreamTest.cxx b/writerperfect/qa/unit/WPXSvStreamTest.cxx
index 16d8ebc..70ff441 100644
--- a/writerperfect/qa/unit/WPXSvStreamTest.cxx
+++ b/writerperfect/qa/unit/WPXSvStreamTest.cxx
@@ -197,7 +197,7 @@ void WPXSvStreamTest::testSeekSet()
     CPPUNIT_ASSERT(!pInput->isEnd());
 
     CPPUNIT_ASSERT_EQUAL(0, pInput->seek(nLen, RVNG_SEEK_SET));
-    CPPUNIT_ASSERT(nLen == pInput->tell());
+    CPPUNIT_ASSERT_EQUAL(pInput->tell(), nLen);
     CPPUNIT_ASSERT(pInput->isEnd());
 
     // go back to the beginning
@@ -212,7 +212,7 @@ void WPXSvStreamTest::testSeekSet()
     CPPUNIT_ASSERT(!pInput->isEnd());
 
     CPPUNIT_ASSERT(0 != pInput->seek(nLen + 1, RVNG_SEEK_SET));
-    CPPUNIT_ASSERT(nLen == pInput->tell());
+    CPPUNIT_ASSERT_EQUAL(pInput->tell(), nLen);
     CPPUNIT_ASSERT(pInput->isEnd());
 }
 
@@ -249,7 +249,7 @@ void WPXSvStreamTest::testSeekCur()
     CPPUNIT_ASSERT(!pInput->isEnd());
 
     CPPUNIT_ASSERT(0 != pInput->seek(nLen + 1, RVNG_SEEK_CUR));
-    CPPUNIT_ASSERT(nLen == pInput->tell());
+    CPPUNIT_ASSERT_EQUAL(pInput->tell(), nLen);
     CPPUNIT_ASSERT(pInput->isEnd());
 }
 
@@ -264,11 +264,11 @@ void WPXSvStreamTest::testSeekEnd()
 
     // valid seeks
     CPPUNIT_ASSERT_EQUAL(0, pInput->seek(0, RVNG_SEEK_END));
-    CPPUNIT_ASSERT(nLen == pInput->tell());
+    CPPUNIT_ASSERT_EQUAL(pInput->tell(), nLen);
     CPPUNIT_ASSERT(pInput->isEnd());
 
     CPPUNIT_ASSERT_EQUAL(0, pInput->seek(-1, RVNG_SEEK_END));
-    CPPUNIT_ASSERT((nLen - 1) == pInput->tell());
+    CPPUNIT_ASSERT_EQUAL(pInput->tell(), (nLen - 1));
     CPPUNIT_ASSERT(!pInput->isEnd());
 
     CPPUNIT_ASSERT_EQUAL(0, pInput->seek(-nLen, RVNG_SEEK_END));
@@ -281,7 +281,7 @@ void WPXSvStreamTest::testSeekEnd()
 
     // invalid seeks
     CPPUNIT_ASSERT(0 != pInput->seek(1, RVNG_SEEK_END));
-    CPPUNIT_ASSERT(nLen == pInput->tell());
+    CPPUNIT_ASSERT_EQUAL(pInput->tell(), nLen);
     CPPUNIT_ASSERT(pInput->isEnd());
 
     CPPUNIT_ASSERT(0 != pInput->seek(-nLen - 1, RVNG_SEEK_END));
@@ -297,7 +297,7 @@ void WPXSvStreamTest::testStructured()
         assert(bool(pInput));
 
         CPPUNIT_ASSERT(pInput->isStructured());
-        CPPUNIT_ASSERT(2 == pInput->subStreamCount());
+        CPPUNIT_ASSERT_EQUAL(static_cast<unsigned>(2), pInput->subStreamCount());
         lcl_testSubStreams(pInput);
 
         // check for existing substream
@@ -318,7 +318,7 @@ void WPXSvStreamTest::testStructured()
         assert(bool(pInput));
 
         CPPUNIT_ASSERT(pInput->isStructured());
-        CPPUNIT_ASSERT(9 == pInput->subStreamCount());
+        CPPUNIT_ASSERT_EQUAL(static_cast<unsigned>(9), pInput->subStreamCount());
         lcl_testSubStreams(pInput);
 
         // check for existing substream
@@ -338,11 +338,11 @@ void WPXSvStreamTest::testStructured()
         const shared_ptr<RVNGInputStream> pInput(lcl_createStream());
 
         CPPUNIT_ASSERT(!pInput->isStructured());
-        CPPUNIT_ASSERT(0 == pInput->subStreamCount());
+        CPPUNIT_ASSERT_EQUAL(static_cast<unsigned>(0), pInput->subStreamCount());
         CPPUNIT_ASSERT(!pInput->existsSubStream("foo"));
-        CPPUNIT_ASSERT(nullptr == pInput->getSubStreamByName("foo"));
-        CPPUNIT_ASSERT(nullptr == pInput->getSubStreamById(42));
-        CPPUNIT_ASSERT(nullptr == pInput->subStreamName(42));
+        CPPUNIT_ASSERT(!pInput->getSubStreamByName("foo"));
+        CPPUNIT_ASSERT(!pInput->getSubStreamById(42));
+        CPPUNIT_ASSERT(!pInput->subStreamName(42));
     }
 }
 
diff --git a/xmloff/qa/unit/uxmloff.cxx b/xmloff/qa/unit/uxmloff.cxx
index 7fc606e..baae178 100644
--- a/xmloff/qa/unit/uxmloff.cxx
+++ b/xmloff/qa/unit/uxmloff.cxx
@@ -78,13 +78,13 @@ void Test::testAutoStylePool()
     // not that interesting but worth checking
     bool bHack = (getenv("LIBO_ONEWAY_STABLE_ODF_EXPORT") != nullptr);
     if (bHack)
-        CPPUNIT_ASSERT_MESSAGE( "style / naming changed", aName == "Bob" );
+        CPPUNIT_ASSERT_EQUAL_MESSAGE( "style / naming changed", OUString("Bob"), aName );
     else
-        CPPUNIT_ASSERT_MESSAGE( "style / naming changed", aName == "Bob1" );
+        CPPUNIT_ASSERT_EQUAL_MESSAGE( "style / naming changed", OUString("Bob1"), aName );
 
     // find ourselves again:
     OUString aSameName = xPool->Find( XML_STYLE_FAMILY_TEXT_PARAGRAPH, "", aProperties );
-    CPPUNIT_ASSERT_MESSAGE( "same style not found", aSameName == aName );
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "same style not found", aName, aSameName );
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);


More information about the Libreoffice-commits mailing list