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>
This commit is contained in:
@@ -266,7 +266,7 @@ void DesktopLOKTest::testGetStyles()
|
|||||||
std::stringstream aStream(pJSON);
|
std::stringstream aStream(pJSON);
|
||||||
boost::property_tree::read_json(aStream, aTree);
|
boost::property_tree::read_json(aStream, aTree);
|
||||||
CPPUNIT_ASSERT( aTree.size() > 0 );
|
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");
|
boost::property_tree::ptree aValues = aTree.get_child("commandValues");
|
||||||
CPPUNIT_ASSERT( aValues.size() > 0 );
|
CPPUNIT_ASSERT( aValues.size() > 0 );
|
||||||
@@ -300,7 +300,7 @@ void DesktopLOKTest::testGetFonts()
|
|||||||
std::stringstream aStream(pJSON);
|
std::stringstream aStream(pJSON);
|
||||||
boost::property_tree::read_json(aStream, aTree);
|
boost::property_tree::read_json(aStream, aTree);
|
||||||
CPPUNIT_ASSERT( aTree.size() > 0 );
|
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");
|
boost::property_tree::ptree aValues = aTree.get_child("commandValues");
|
||||||
CPPUNIT_ASSERT( aValues.size() > 0 );
|
CPPUNIT_ASSERT( aValues.size() > 0 );
|
||||||
|
@@ -95,8 +95,8 @@ void Test::testCompareTo()
|
|||||||
|
|
||||||
OString s1(str1, 2);
|
OString s1(str1, 2);
|
||||||
OString s2(str2, 2);
|
OString s2(str2, 2);
|
||||||
CPPUNIT_ASSERT(s1.compareTo(s1) == 0);
|
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), s1.compareTo(s1));
|
||||||
CPPUNIT_ASSERT(s2.compareTo(s2) == 0);
|
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), s2.compareTo(s2));
|
||||||
CPPUNIT_ASSERT(s1.compareTo(s2) < 0);
|
CPPUNIT_ASSERT(s1.compareTo(s2) < 0);
|
||||||
CPPUNIT_ASSERT(s2.compareTo(s1) > 0);
|
CPPUNIT_ASSERT(s2.compareTo(s1) > 0);
|
||||||
CPPUNIT_ASSERT(s1.compareTo(OString(s2 + "y")) < 0);
|
CPPUNIT_ASSERT(s1.compareTo(OString(s2 + "y")) < 0);
|
||||||
|
@@ -84,8 +84,8 @@ void test::oustring::Compare::compareTo()
|
|||||||
|
|
||||||
OUString s1(str1, 2);
|
OUString s1(str1, 2);
|
||||||
OUString s2(str2, 2);
|
OUString s2(str2, 2);
|
||||||
CPPUNIT_ASSERT(s1.compareTo(s1) == 0);
|
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), s1.compareTo(s1));
|
||||||
CPPUNIT_ASSERT(s2.compareTo(s2) == 0);
|
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), s2.compareTo(s2));
|
||||||
CPPUNIT_ASSERT(s1.compareTo(s2) < 0);
|
CPPUNIT_ASSERT(s1.compareTo(s2) < 0);
|
||||||
CPPUNIT_ASSERT(s2.compareTo(s1) > 0);
|
CPPUNIT_ASSERT(s2.compareTo(s1) > 0);
|
||||||
CPPUNIT_ASSERT(s1.compareTo(OUString(s2 + "y")) < 0);
|
CPPUNIT_ASSERT(s1.compareTo(OUString(s2 + "y")) < 0);
|
||||||
|
@@ -276,8 +276,8 @@ void test::oustring::StringLiterals::checkUtf16() {
|
|||||||
CPPUNIT_ASSERT_EQUAL(rtl::OUString(u"def"), s2);
|
CPPUNIT_ASSERT_EQUAL(rtl::OUString(u"def"), s2);
|
||||||
CPPUNIT_ASSERT(s1.endsWithIgnoreAsciiCase(u"EFDE", &s2));
|
CPPUNIT_ASSERT(s1.endsWithIgnoreAsciiCase(u"EFDE", &s2));
|
||||||
CPPUNIT_ASSERT_EQUAL(rtl::OUString(u"d"), s2);
|
CPPUNIT_ASSERT_EQUAL(rtl::OUString(u"d"), s2);
|
||||||
CPPUNIT_ASSERT(s1 == u"defde");
|
CPPUNIT_ASSERT(bool(s1 == u"defde"));
|
||||||
CPPUNIT_ASSERT(u"defde" == s1);
|
CPPUNIT_ASSERT(bool(u"defde" == s1));
|
||||||
CPPUNIT_ASSERT(s1 != u"abc");
|
CPPUNIT_ASSERT(s1 != u"abc");
|
||||||
CPPUNIT_ASSERT(u"abc" != s1);
|
CPPUNIT_ASSERT(u"abc" != s1);
|
||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(3), s1.indexOf(u"de", 1));
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(3), s1.indexOf(u"de", 1));
|
||||||
|
@@ -110,14 +110,14 @@ void Test::testCondition() {
|
|||||||
osl::Mutex mutex;
|
osl::Mutex mutex;
|
||||||
std::unique_ptr< salhelper::Condition > p(new DerivedCondition(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(typeid (p.get()) == typeid (salhelper::Condition *));
|
CPPUNIT_ASSERT(bool(typeid (p.get()) == typeid (salhelper::Condition *)));
|
||||||
CPPUNIT_ASSERT(
|
CPPUNIT_ASSERT(bool(
|
||||||
typeid (const_cast< salhelper::Condition const * >(p.get()))
|
typeid (const_cast< salhelper::Condition const * >(p.get()))
|
||||||
== typeid (salhelper::Condition const *));
|
== typeid (salhelper::Condition const *)));
|
||||||
CPPUNIT_ASSERT(
|
CPPUNIT_ASSERT(bool(
|
||||||
typeid (const_cast< salhelper::Condition volatile * >(p.get()))
|
typeid (const_cast< salhelper::Condition volatile * >(p.get()))
|
||||||
== typeid (salhelper::Condition volatile *));
|
== typeid (salhelper::Condition volatile *)));
|
||||||
CPPUNIT_ASSERT(typeid (salhelper::Condition *) == getConditionTypeInfo());
|
CPPUNIT_ASSERT(bool(typeid (salhelper::Condition *) == getConditionTypeInfo()));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@@ -129,45 +129,45 @@ void Test::testCondition() {
|
|||||||
|
|
||||||
void Test::testConditionModifier() {
|
void Test::testConditionModifier() {
|
||||||
salhelper::ConditionModifier * p = nullptr;
|
salhelper::ConditionModifier * p = nullptr;
|
||||||
CPPUNIT_ASSERT(typeid (*p) == typeid (salhelper::ConditionModifier));
|
CPPUNIT_ASSERT(bool(typeid (*p) == typeid (salhelper::ConditionModifier)));
|
||||||
CPPUNIT_ASSERT(typeid (p) == typeid (salhelper::ConditionModifier *));
|
CPPUNIT_ASSERT(bool(typeid (p) == typeid (salhelper::ConditionModifier *)));
|
||||||
CPPUNIT_ASSERT(
|
CPPUNIT_ASSERT(bool(
|
||||||
typeid (const_cast< salhelper::ConditionModifier const * >(p))
|
typeid (const_cast< salhelper::ConditionModifier const * >(p))
|
||||||
== typeid (salhelper::ConditionModifier const *));
|
== typeid (salhelper::ConditionModifier const *)));
|
||||||
CPPUNIT_ASSERT(
|
CPPUNIT_ASSERT(bool(
|
||||||
typeid (const_cast< salhelper::ConditionModifier volatile * >(p))
|
typeid (const_cast< salhelper::ConditionModifier volatile * >(p))
|
||||||
== typeid (salhelper::ConditionModifier volatile *));
|
== typeid (salhelper::ConditionModifier volatile *)));
|
||||||
CPPUNIT_ASSERT(
|
CPPUNIT_ASSERT(bool(
|
||||||
typeid (salhelper::ConditionModifier *)
|
typeid (salhelper::ConditionModifier *)
|
||||||
== getConditionModifierTypeInfo());
|
== getConditionModifierTypeInfo()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Test::testConditionWaiter() {
|
void Test::testConditionWaiter() {
|
||||||
salhelper::ConditionWaiter * p = nullptr;
|
salhelper::ConditionWaiter * p = nullptr;
|
||||||
CPPUNIT_ASSERT(typeid (*p) == typeid (salhelper::ConditionWaiter));
|
CPPUNIT_ASSERT(bool(typeid (*p) == typeid (salhelper::ConditionWaiter)));
|
||||||
CPPUNIT_ASSERT(typeid (p) == typeid (salhelper::ConditionWaiter *));
|
CPPUNIT_ASSERT(bool(typeid (p) == typeid (salhelper::ConditionWaiter *)));
|
||||||
CPPUNIT_ASSERT(
|
CPPUNIT_ASSERT(bool(
|
||||||
typeid (const_cast< salhelper::ConditionWaiter const * >(p))
|
typeid (const_cast< salhelper::ConditionWaiter const * >(p))
|
||||||
== typeid (salhelper::ConditionWaiter const *));
|
== typeid (salhelper::ConditionWaiter const *)));
|
||||||
CPPUNIT_ASSERT(
|
CPPUNIT_ASSERT(bool(
|
||||||
typeid (const_cast< salhelper::ConditionWaiter volatile * >(p))
|
typeid (const_cast< salhelper::ConditionWaiter volatile * >(p))
|
||||||
== typeid (salhelper::ConditionWaiter volatile *));
|
== typeid (salhelper::ConditionWaiter volatile *)));
|
||||||
CPPUNIT_ASSERT(
|
CPPUNIT_ASSERT(bool(
|
||||||
typeid (salhelper::ConditionWaiter *) == getConditionWaiterTypeInfo());
|
typeid (salhelper::ConditionWaiter *) == getConditionWaiterTypeInfo()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Test::testConditionWaiterTimedout() {
|
void Test::testConditionWaiterTimedout() {
|
||||||
salhelper::ConditionWaiter::timedout x;
|
salhelper::ConditionWaiter::timedout x;
|
||||||
CPPUNIT_ASSERT(typeid (x) == typeid (salhelper::ConditionWaiter::timedout));
|
CPPUNIT_ASSERT(bool(typeid (x) == typeid (salhelper::ConditionWaiter::timedout)));
|
||||||
CPPUNIT_ASSERT(
|
CPPUNIT_ASSERT(bool(
|
||||||
typeid (&x) == typeid (salhelper::ConditionWaiter::timedout *));
|
typeid (&x) == typeid (salhelper::ConditionWaiter::timedout *)));
|
||||||
CPPUNIT_ASSERT(
|
CPPUNIT_ASSERT(bool(
|
||||||
typeid (const_cast< salhelper::ConditionWaiter::timedout const * >(&x))
|
typeid (const_cast< salhelper::ConditionWaiter::timedout const * >(&x))
|
||||||
== typeid (salhelper::ConditionWaiter::timedout const *));
|
== typeid (salhelper::ConditionWaiter::timedout const *)));
|
||||||
CPPUNIT_ASSERT(
|
CPPUNIT_ASSERT(bool(
|
||||||
(typeid
|
(typeid
|
||||||
(const_cast< salhelper::ConditionWaiter::timedout volatile * >(&x)))
|
(const_cast< salhelper::ConditionWaiter::timedout volatile * >(&x)))
|
||||||
== typeid (salhelper::ConditionWaiter::timedout volatile *));
|
== typeid (salhelper::ConditionWaiter::timedout volatile *)));
|
||||||
try {
|
try {
|
||||||
throw salhelper::ConditionWaiter::timedout();
|
throw salhelper::ConditionWaiter::timedout();
|
||||||
} catch (salhelper::ConditionWaiter::timedout &) {
|
} catch (salhelper::ConditionWaiter::timedout &) {
|
||||||
@@ -179,16 +179,16 @@ void Test::testConditionWaiterTimedout() {
|
|||||||
void Test::testORealDynamicLoader() {
|
void Test::testORealDynamicLoader() {
|
||||||
salhelper::ORealDynamicLoader * p = nullptr;
|
salhelper::ORealDynamicLoader * p = nullptr;
|
||||||
CPPUNIT_ASSERT(typeid (p) != typeid (salhelper::ORealDynamicLoader));
|
CPPUNIT_ASSERT(typeid (p) != typeid (salhelper::ORealDynamicLoader));
|
||||||
CPPUNIT_ASSERT(typeid (p) == typeid (salhelper::ORealDynamicLoader *));
|
CPPUNIT_ASSERT(bool(typeid (p) == typeid (salhelper::ORealDynamicLoader *)));
|
||||||
CPPUNIT_ASSERT(
|
CPPUNIT_ASSERT(bool(
|
||||||
typeid (const_cast< salhelper::ORealDynamicLoader const * >(p))
|
typeid (const_cast< salhelper::ORealDynamicLoader const * >(p))
|
||||||
== typeid (salhelper::ORealDynamicLoader const *));
|
== typeid (salhelper::ORealDynamicLoader const *)));
|
||||||
CPPUNIT_ASSERT(
|
CPPUNIT_ASSERT(bool(
|
||||||
typeid (const_cast< salhelper::ORealDynamicLoader volatile * >(p))
|
typeid (const_cast< salhelper::ORealDynamicLoader volatile * >(p))
|
||||||
== typeid (salhelper::ORealDynamicLoader volatile *));
|
== typeid (salhelper::ORealDynamicLoader volatile *)));
|
||||||
CPPUNIT_ASSERT(
|
CPPUNIT_ASSERT(bool(
|
||||||
typeid (salhelper::ORealDynamicLoader *)
|
typeid (salhelper::ORealDynamicLoader *)
|
||||||
== getORealDynamicLoaderTypeInfo());
|
== getORealDynamicLoaderTypeInfo()));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@@ -200,18 +200,18 @@ void Test::testSimpleReferenceObject() {
|
|||||||
try {
|
try {
|
||||||
CPPUNIT_ASSERT(
|
CPPUNIT_ASSERT(
|
||||||
typeid (*p) != typeid (salhelper::SimpleReferenceObject));
|
typeid (*p) != typeid (salhelper::SimpleReferenceObject));
|
||||||
CPPUNIT_ASSERT(
|
CPPUNIT_ASSERT(bool(
|
||||||
typeid (p) == typeid (salhelper::SimpleReferenceObject *));
|
typeid (p) == typeid (salhelper::SimpleReferenceObject *)));
|
||||||
CPPUNIT_ASSERT(
|
CPPUNIT_ASSERT(bool(
|
||||||
typeid (const_cast< salhelper::SimpleReferenceObject const * >(p))
|
typeid (const_cast< salhelper::SimpleReferenceObject const * >(p))
|
||||||
== typeid (salhelper::SimpleReferenceObject const *));
|
== typeid (salhelper::SimpleReferenceObject const *)));
|
||||||
CPPUNIT_ASSERT(
|
CPPUNIT_ASSERT(bool(
|
||||||
(typeid
|
(typeid
|
||||||
(const_cast< salhelper::SimpleReferenceObject volatile * >(p)))
|
(const_cast< salhelper::SimpleReferenceObject volatile * >(p)))
|
||||||
== typeid (salhelper::SimpleReferenceObject volatile *));
|
== typeid (salhelper::SimpleReferenceObject volatile *)));
|
||||||
CPPUNIT_ASSERT(
|
CPPUNIT_ASSERT(bool(
|
||||||
typeid (salhelper::SimpleReferenceObject *)
|
typeid (salhelper::SimpleReferenceObject *)
|
||||||
== getSimpleReferenceObjectTypeInfo());
|
== getSimpleReferenceObjectTypeInfo()));
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
delete static_cast< DerivedSimpleReferenceObject * >(p);
|
delete static_cast< DerivedSimpleReferenceObject * >(p);
|
||||||
throw;
|
throw;
|
||||||
|
Reference in New Issue
Block a user