summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-10-14 09:10:01 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-10-14 08:59:32 +0000
commitd2081e8b61bbe982f4e0977c2b46e00ccf19732f (patch)
treee078c6339af200c98cdffe390f491c6c8c9893f2
parentfaf4bf0c3e017b9caec27a1f7355c9cf636bf19b (diff)
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@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx4
-rw-r--r--sal/qa/rtl/strings/test_ostring.cxx4
-rw-r--r--sal/qa/rtl/strings/test_oustring_compare.cxx4
-rw-r--r--sal/qa/rtl/strings/test_oustring_stringliterals.cxx4
-rw-r--r--salhelper/qa/test_api.cxx88
5 files changed, 52 insertions, 52 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index cb2e034fd2d3..bcf019e548f2 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 ffdd46821b38..cd2e0a22bb99 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 da3cd57bd9ea..d500e5cce700 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 082e83e9dd7c..27f70800d0d2 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 4a73b63d273b..33a3c9400cba 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;