[Libreoffice-commits] core.git: desktop/qa salhelper/qa sal/qa

Miklos Vajna vmiklos at collabora.co.uk
Fri Oct 14 09:03:18 UTC 2016


 desktop/qa/desktop_lib/test_desktop_lib.cxx         |    4 
 sal/qa/rtl/strings/test_ostring.cxx                 |    4 
 sal/qa/rtl/strings/test_oustring_compare.cxx        |    4 
 sal/qa/rtl/strings/test_oustring_stringliterals.cxx |    4 
 salhelper/qa/test_api.cxx                           |   88 ++++++++++----------
 5 files changed, 52 insertions(+), 52 deletions(-)

New commits:
commit d2081e8b61bbe982f4e0977c2b46e00ccf19732f
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Oct 14 09:10:01 2016 +0200

    CppunitTest_desktop_lib: fix loplugin:cppunitassertequals warnings
    
    And also address a few new warnings in sal, plus silence such warnings
    in salhelper till we can't print typeids out of the box.
    
    Change-Id: I38049146710b6885f6a874bf74eedbc38b4d4651
    Reviewed-on: https://gerrit.libreoffice.org/29809
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index cb2e034..bcf019e 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -266,7 +266,7 @@ void DesktopLOKTest::testGetStyles()
     std::stringstream aStream(pJSON);
     boost::property_tree::read_json(aStream, aTree);
     CPPUNIT_ASSERT( aTree.size() > 0 );
-    CPPUNIT_ASSERT( aTree.get_child("commandName").get_value<std::string>() == ".uno:StyleApply" );
+    CPPUNIT_ASSERT_EQUAL( std::string(".uno:StyleApply"), aTree.get_child("commandName").get_value<std::string>()  );
 
     boost::property_tree::ptree aValues = aTree.get_child("commandValues");
     CPPUNIT_ASSERT( aValues.size() > 0 );
@@ -300,7 +300,7 @@ void DesktopLOKTest::testGetFonts()
     std::stringstream aStream(pJSON);
     boost::property_tree::read_json(aStream, aTree);
     CPPUNIT_ASSERT( aTree.size() > 0 );
-    CPPUNIT_ASSERT( aTree.get_child("commandName").get_value<std::string>() == ".uno:CharFontName" );
+    CPPUNIT_ASSERT_EQUAL( std::string(".uno:CharFontName"), aTree.get_child("commandName").get_value<std::string>() );
 
     boost::property_tree::ptree aValues = aTree.get_child("commandValues");
     CPPUNIT_ASSERT( aValues.size() > 0 );
diff --git a/sal/qa/rtl/strings/test_ostring.cxx b/sal/qa/rtl/strings/test_ostring.cxx
index ffdd468..cd2e0a2 100644
--- a/sal/qa/rtl/strings/test_ostring.cxx
+++ b/sal/qa/rtl/strings/test_ostring.cxx
@@ -95,8 +95,8 @@ void Test::testCompareTo()
 
     OString s1(str1, 2);
     OString s2(str2, 2);
-    CPPUNIT_ASSERT(s1.compareTo(s1) == 0);
-    CPPUNIT_ASSERT(s2.compareTo(s2) == 0);
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), s1.compareTo(s1));
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), s2.compareTo(s2));
     CPPUNIT_ASSERT(s1.compareTo(s2) < 0);
     CPPUNIT_ASSERT(s2.compareTo(s1) > 0);
     CPPUNIT_ASSERT(s1.compareTo(OString(s2 + "y")) < 0);
diff --git a/sal/qa/rtl/strings/test_oustring_compare.cxx b/sal/qa/rtl/strings/test_oustring_compare.cxx
index da3cd57..d500e5c 100644
--- a/sal/qa/rtl/strings/test_oustring_compare.cxx
+++ b/sal/qa/rtl/strings/test_oustring_compare.cxx
@@ -84,8 +84,8 @@ void test::oustring::Compare::compareTo()
 
     OUString s1(str1, 2);
     OUString s2(str2, 2);
-    CPPUNIT_ASSERT(s1.compareTo(s1) == 0);
-    CPPUNIT_ASSERT(s2.compareTo(s2) == 0);
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), s1.compareTo(s1));
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), s2.compareTo(s2));
     CPPUNIT_ASSERT(s1.compareTo(s2) < 0);
     CPPUNIT_ASSERT(s2.compareTo(s1) > 0);
     CPPUNIT_ASSERT(s1.compareTo(OUString(s2 + "y")) < 0);
diff --git a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
index 082e83e..27f7080 100644
--- a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
+++ b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
@@ -276,8 +276,8 @@ void test::oustring::StringLiterals::checkUtf16() {
     CPPUNIT_ASSERT_EQUAL(rtl::OUString(u"def"), s2);
     CPPUNIT_ASSERT(s1.endsWithIgnoreAsciiCase(u"EFDE", &s2));
     CPPUNIT_ASSERT_EQUAL(rtl::OUString(u"d"), s2);
-    CPPUNIT_ASSERT(s1 == u"defde");
-    CPPUNIT_ASSERT(u"defde" == s1);
+    CPPUNIT_ASSERT(bool(s1 == u"defde"));
+    CPPUNIT_ASSERT(bool(u"defde" == s1));
     CPPUNIT_ASSERT(s1 != u"abc");
     CPPUNIT_ASSERT(u"abc" != s1);
     CPPUNIT_ASSERT_EQUAL(sal_Int32(3), s1.indexOf(u"de", 1));
diff --git a/salhelper/qa/test_api.cxx b/salhelper/qa/test_api.cxx
index 4a73b63..33a3c94 100644
--- a/salhelper/qa/test_api.cxx
+++ b/salhelper/qa/test_api.cxx
@@ -110,14 +110,14 @@ void Test::testCondition() {
     osl::Mutex mutex;
     std::unique_ptr< salhelper::Condition > p(new DerivedCondition(mutex));
     CPPUNIT_ASSERT(typeid (*p.get()) != typeid (salhelper::Condition));
-    CPPUNIT_ASSERT(typeid (p.get()) == typeid (salhelper::Condition *));
-    CPPUNIT_ASSERT(
+    CPPUNIT_ASSERT(bool(typeid (p.get()) == typeid (salhelper::Condition *)));
+    CPPUNIT_ASSERT(bool(
         typeid (const_cast< salhelper::Condition const * >(p.get()))
-        == typeid (salhelper::Condition const *));
-    CPPUNIT_ASSERT(
+        == typeid (salhelper::Condition const *)));
+    CPPUNIT_ASSERT(bool(
         typeid (const_cast< salhelper::Condition volatile * >(p.get()))
-        == typeid (salhelper::Condition volatile *));
-    CPPUNIT_ASSERT(typeid (salhelper::Condition *) == getConditionTypeInfo());
+        == typeid (salhelper::Condition volatile *)));
+    CPPUNIT_ASSERT(bool(typeid (salhelper::Condition *) == getConditionTypeInfo()));
 }
 
 #ifdef _MSC_VER
@@ -129,45 +129,45 @@ void Test::testCondition() {
 
 void Test::testConditionModifier() {
     salhelper::ConditionModifier * p = nullptr;
-    CPPUNIT_ASSERT(typeid (*p) == typeid (salhelper::ConditionModifier));
-    CPPUNIT_ASSERT(typeid (p) == typeid (salhelper::ConditionModifier *));
-    CPPUNIT_ASSERT(
+    CPPUNIT_ASSERT(bool(typeid (*p) == typeid (salhelper::ConditionModifier)));
+    CPPUNIT_ASSERT(bool(typeid (p) == typeid (salhelper::ConditionModifier *)));
+    CPPUNIT_ASSERT(bool(
         typeid (const_cast< salhelper::ConditionModifier const * >(p))
-        == typeid (salhelper::ConditionModifier const *));
-    CPPUNIT_ASSERT(
+        == typeid (salhelper::ConditionModifier const *)));
+    CPPUNIT_ASSERT(bool(
         typeid (const_cast< salhelper::ConditionModifier volatile * >(p))
-        == typeid (salhelper::ConditionModifier volatile *));
-    CPPUNIT_ASSERT(
+        == typeid (salhelper::ConditionModifier volatile *)));
+    CPPUNIT_ASSERT(bool(
         typeid (salhelper::ConditionModifier *)
-        == getConditionModifierTypeInfo());
+        == getConditionModifierTypeInfo()));
 }
 
 void Test::testConditionWaiter() {
     salhelper::ConditionWaiter * p = nullptr;
-    CPPUNIT_ASSERT(typeid (*p) == typeid (salhelper::ConditionWaiter));
-    CPPUNIT_ASSERT(typeid (p) == typeid (salhelper::ConditionWaiter *));
-    CPPUNIT_ASSERT(
+    CPPUNIT_ASSERT(bool(typeid (*p) == typeid (salhelper::ConditionWaiter)));
+    CPPUNIT_ASSERT(bool(typeid (p) == typeid (salhelper::ConditionWaiter *)));
+    CPPUNIT_ASSERT(bool(
         typeid (const_cast< salhelper::ConditionWaiter const * >(p))
-        == typeid (salhelper::ConditionWaiter const *));
-    CPPUNIT_ASSERT(
+        == typeid (salhelper::ConditionWaiter const *)));
+    CPPUNIT_ASSERT(bool(
         typeid (const_cast< salhelper::ConditionWaiter volatile * >(p))
-        == typeid (salhelper::ConditionWaiter volatile *));
-    CPPUNIT_ASSERT(
-        typeid (salhelper::ConditionWaiter *) == getConditionWaiterTypeInfo());
+        == typeid (salhelper::ConditionWaiter volatile *)));
+    CPPUNIT_ASSERT(bool(
+        typeid (salhelper::ConditionWaiter *) == getConditionWaiterTypeInfo()));
 }
 
 void Test::testConditionWaiterTimedout() {
     salhelper::ConditionWaiter::timedout x;
-    CPPUNIT_ASSERT(typeid (x) == typeid (salhelper::ConditionWaiter::timedout));
-    CPPUNIT_ASSERT(
-        typeid (&x) == typeid (salhelper::ConditionWaiter::timedout *));
-    CPPUNIT_ASSERT(
+    CPPUNIT_ASSERT(bool(typeid (x) == typeid (salhelper::ConditionWaiter::timedout)));
+    CPPUNIT_ASSERT(bool(
+        typeid (&x) == typeid (salhelper::ConditionWaiter::timedout *)));
+    CPPUNIT_ASSERT(bool(
         typeid (const_cast< salhelper::ConditionWaiter::timedout const * >(&x))
-        == typeid (salhelper::ConditionWaiter::timedout const *));
-    CPPUNIT_ASSERT(
+        == typeid (salhelper::ConditionWaiter::timedout const *)));
+    CPPUNIT_ASSERT(bool(
         (typeid
          (const_cast< salhelper::ConditionWaiter::timedout volatile * >(&x)))
-        == typeid (salhelper::ConditionWaiter::timedout volatile *));
+        == typeid (salhelper::ConditionWaiter::timedout volatile *)));
     try {
         throw salhelper::ConditionWaiter::timedout();
     } catch (salhelper::ConditionWaiter::timedout &) {
@@ -179,16 +179,16 @@ void Test::testConditionWaiterTimedout() {
 void Test::testORealDynamicLoader() {
     salhelper::ORealDynamicLoader * p = nullptr;
     CPPUNIT_ASSERT(typeid (p) != typeid (salhelper::ORealDynamicLoader));
-    CPPUNIT_ASSERT(typeid (p) == typeid (salhelper::ORealDynamicLoader *));
-    CPPUNIT_ASSERT(
+    CPPUNIT_ASSERT(bool(typeid (p) == typeid (salhelper::ORealDynamicLoader *)));
+    CPPUNIT_ASSERT(bool(
         typeid (const_cast< salhelper::ORealDynamicLoader const * >(p))
-        == typeid (salhelper::ORealDynamicLoader const *));
-    CPPUNIT_ASSERT(
+        == typeid (salhelper::ORealDynamicLoader const *)));
+    CPPUNIT_ASSERT(bool(
         typeid (const_cast< salhelper::ORealDynamicLoader volatile * >(p))
-        == typeid (salhelper::ORealDynamicLoader volatile *));
-    CPPUNIT_ASSERT(
+        == typeid (salhelper::ORealDynamicLoader volatile *)));
+    CPPUNIT_ASSERT(bool(
         typeid (salhelper::ORealDynamicLoader *)
-        == getORealDynamicLoaderTypeInfo());
+        == getORealDynamicLoaderTypeInfo()));
 }
 
 #ifdef _MSC_VER
@@ -200,18 +200,18 @@ void Test::testSimpleReferenceObject() {
     try {
         CPPUNIT_ASSERT(
             typeid (*p) != typeid (salhelper::SimpleReferenceObject));
-        CPPUNIT_ASSERT(
-            typeid (p) == typeid (salhelper::SimpleReferenceObject *));
-        CPPUNIT_ASSERT(
+        CPPUNIT_ASSERT(bool(
+            typeid (p) == typeid (salhelper::SimpleReferenceObject *)));
+        CPPUNIT_ASSERT(bool(
             typeid (const_cast< salhelper::SimpleReferenceObject const * >(p))
-            == typeid (salhelper::SimpleReferenceObject const *));
-        CPPUNIT_ASSERT(
+            == typeid (salhelper::SimpleReferenceObject const *)));
+        CPPUNIT_ASSERT(bool(
             (typeid
              (const_cast< salhelper::SimpleReferenceObject volatile * >(p)))
-            == typeid (salhelper::SimpleReferenceObject volatile *));
-        CPPUNIT_ASSERT(
+            == typeid (salhelper::SimpleReferenceObject volatile *)));
+        CPPUNIT_ASSERT(bool(
             typeid (salhelper::SimpleReferenceObject *)
-            == getSimpleReferenceObjectTypeInfo());
+            == getSimpleReferenceObjectTypeInfo()));
     } catch (...) {
         delete static_cast< DerivedSimpleReferenceObject * >(p);
         throw;


More information about the Libreoffice-commits mailing list