summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-12-02 08:17:32 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-12-02 09:04:07 +0000
commit49f658f568dfae574217ec8f1c72654ffd6855bc (patch)
treee3f636e9a8eb1b0e93ce9eb269ac68358601569b
parentb0e7e6293d733a6e46f9f4fb9df262c94ef8e62c (diff)
svl: fix loplugin:cppunitassertequals warnings
Change-Id: Ice929418e46ff42517a47dfcd5888a5cce36ae51 Reviewed-on: https://gerrit.libreoffice.org/31523 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx2
-rw-r--r--svl/qa/unit/items/test_itempool.cxx22
-rw-r--r--svl/qa/unit/svl.cxx14
-rw-r--r--svl/qa/unit/test_INetContentType.cxx4
-rw-r--r--svl/qa/unit/test_lngmisc.cxx30
5 files changed, 36 insertions, 36 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 93ad652c1d8b..3abc8419613a 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -1644,7 +1644,7 @@ void DesktopLOKTest::testGetFontSubset()
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:FontSubset" );
+ CPPUNIT_ASSERT_EQUAL( std::string(".uno:FontSubset"), aTree.get_child("commandName").get_value<std::string>() );
boost::property_tree::ptree aValues = aTree.get_child("commandValues");
CPPUNIT_ASSERT( aValues.size() > 0 );
free(pJSON);
diff --git a/svl/qa/unit/items/test_itempool.cxx b/svl/qa/unit/items/test_itempool.cxx
index 9a4aae2ba622..0f533903a8a8 100644
--- a/svl/qa/unit/items/test_itempool.cxx
+++ b/svl/qa/unit/items/test_itempool.cxx
@@ -44,20 +44,20 @@ void PoolItemTest::testPool()
SfxItemPool *pPool = new SfxItemPool("testpool", 1, 4, aItems);
SfxItemPool_Impl *pImpl = SfxItemPool_Impl::GetImpl(pPool);
CPPUNIT_ASSERT(pImpl != nullptr);
- CPPUNIT_ASSERT(pImpl->maPoolItems.size() == 4);
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), pImpl->maPoolItems.size());
// Poolable
SfxVoidItem aItemOne( 1 );
SfxVoidItem aNotherOne( 1 );
{
- CPPUNIT_ASSERT(pImpl->maPoolItems[0] == nullptr);
+ CPPUNIT_ASSERT(!pImpl->maPoolItems[0]);
const SfxPoolItem &rVal = pPool->Put(aItemOne);
- CPPUNIT_ASSERT(rVal == aItemOne);
+ CPPUNIT_ASSERT(bool(rVal == aItemOne));
CPPUNIT_ASSERT(pImpl->maPoolItems[0] != nullptr);
const SfxPoolItem &rVal2 = pPool->Put(aNotherOne);
- CPPUNIT_ASSERT(rVal2 == rVal);
- CPPUNIT_ASSERT(&rVal2 == &rVal);
+ CPPUNIT_ASSERT(bool(rVal2 == rVal));
+ CPPUNIT_ASSERT_EQUAL(&rVal, &rVal2);
// Clones on Put ...
CPPUNIT_ASSERT(&rVal2 != &aItemOne);
@@ -70,13 +70,13 @@ void PoolItemTest::testPool()
SfxVoidItem aItemTwo( 2 );
SfxVoidItem aNotherTwo( 2 );
{
- CPPUNIT_ASSERT(pImpl->maPoolItems[1] == nullptr);
+ CPPUNIT_ASSERT(!pImpl->maPoolItems[1]);
const SfxPoolItem &rVal = pPool->Put(aItemTwo);
- CPPUNIT_ASSERT(rVal == aItemTwo);
+ CPPUNIT_ASSERT(bool(rVal == aItemTwo));
CPPUNIT_ASSERT(pImpl->maPoolItems[1] != nullptr);
const SfxPoolItem &rVal2 = pPool->Put(aNotherTwo);
- CPPUNIT_ASSERT(rVal2 == rVal);
+ CPPUNIT_ASSERT(bool(rVal2 == rVal));
CPPUNIT_ASSERT(&rVal2 != &rVal);
}
@@ -93,11 +93,11 @@ void PoolItemTest::testPool()
const SfxPoolItem &rKeyFour = pPool->Put(aRemoveFour);
pPool->Put(aNotherFour);
CPPUNIT_ASSERT(pImpl->maPoolItems[3]->size() > 0);
- CPPUNIT_ASSERT(pImpl->maPoolItems[3]->maFree.size() == 0);
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pImpl->maPoolItems[3]->maFree.size());
pPool->Remove(rKeyFour);
- CPPUNIT_ASSERT(pImpl->maPoolItems[3]->maFree.size() == 1);
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pImpl->maPoolItems[3]->maFree.size());
pPool->Put(aNotherFour);
- CPPUNIT_ASSERT(pImpl->maPoolItems[3]->maFree.size() == 0);
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pImpl->maPoolItems[3]->maFree.size());
}
CPPUNIT_TEST_SUITE_REGISTRATION(PoolItemTest);
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx
index b8c3fc324651..9804c7eeaca5 100644
--- a/svl/qa/unit/svl.cxx
+++ b/svl/qa/unit/svl.cxx
@@ -246,8 +246,8 @@ void Test::testNumberFormat()
size_t nStart = aTests[i].eStart;
size_t nEnd = aTests[i].eEnd;
- CPPUNIT_ASSERT_MESSAGE("Unexpected number of formats for this category.",
- (nEnd - nStart + 1) == aTests[i].nSize);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Unexpected number of formats for this category.",
+ aTests[i].nSize, (nEnd - nStart + 1));
for (size_t j = nStart; j <= nEnd; ++j)
{
@@ -291,7 +291,7 @@ void Test::testSharedString()
{
// Use shared string as normal, non-shared string, which is allowed.
SharedString aSS1("Test"), aSS2("Test");
- CPPUNIT_ASSERT_MESSAGE("Equality check should return true.", aSS1 == aSS2);
+ CPPUNIT_ASSERT_MESSAGE("Equality check should return true.", bool(aSS1 == aSS2));
SharedString aSS3("test");
CPPUNIT_ASSERT_MESSAGE("Equality check is case sensitive.", aSS1 != aSS3);
}
@@ -322,11 +322,11 @@ void Test::testSharedStringPool()
p2 = aPool.intern(aAndyLower);
CPPUNIT_ASSERT_MESSAGE("Failed to intern strings.", p1.getData() && p2.getData());
CPPUNIT_ASSERT_MESSAGE("These two ID's should differ.", p1.getData() != p2.getData());
- CPPUNIT_ASSERT_MESSAGE("These two ID's should be equal.", p1.getDataIgnoreCase() == p2.getDataIgnoreCase());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("These two ID's should be equal.", p2.getDataIgnoreCase(), p1.getDataIgnoreCase());
p2 = aPool.intern(aAndyUpper);
CPPUNIT_ASSERT_MESSAGE("Failed to intern string.", p2.getData());
CPPUNIT_ASSERT_MESSAGE("These two ID's should differ.", p1.getData() != p2.getData());
- CPPUNIT_ASSERT_MESSAGE("These two ID's should be equal.", p1.getDataIgnoreCase() == p2.getDataIgnoreCase());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("These two ID's should be equal.", p2.getDataIgnoreCase(), p1.getDataIgnoreCase());
}
void Test::testSharedStringPoolPurge()
@@ -337,8 +337,8 @@ void Test::testSharedStringPoolPurge()
aPool.intern("andy");
aPool.intern("ANDY");
- CPPUNIT_ASSERT_MESSAGE("Wrong string count.", aPool.getCount() == 3);
- CPPUNIT_ASSERT_MESSAGE("Wrong case insensitive string count.", aPool.getCountIgnoreCase() == 1);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong string count.", static_cast<size_t>(3), aPool.getCount());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong case insensitive string count.", static_cast<size_t>(1), aPool.getCountIgnoreCase());
// Since no string objects referencing the pooled strings exist, purging
// the pool should empty it.
diff --git a/svl/qa/unit/test_INetContentType.cxx b/svl/qa/unit/test_INetContentType.cxx
index 7c83a1e0252b..0eea403275e5 100644
--- a/svl/qa/unit/test_INetContentType.cxx
+++ b/svl/qa/unit/test_INetContentType.cxx
@@ -48,7 +48,7 @@ void Test::testBad() {
CPPUNIT_ASSERT(!INetContentTypes::parse(in, t, s, &ps));
CPPUNIT_ASSERT(t.isEmpty());
CPPUNIT_ASSERT(s.isEmpty());
- CPPUNIT_ASSERT(ps.end() == ps.find("foo"));
+ CPPUNIT_ASSERT(bool(ps.end() == ps.find("foo")));
}
void Test::testFull() {
@@ -78,7 +78,7 @@ void Test::testFollow() {
CPPUNIT_ASSERT(!INetContentTypes::parse(in, t, s));
CPPUNIT_ASSERT(t.isEmpty());
CPPUNIT_ASSERT(s.isEmpty());
- CPPUNIT_ASSERT(ps.end() == ps.find("baz"));
+ CPPUNIT_ASSERT(bool(ps.end() == ps.find("baz")));
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
diff --git a/svl/qa/unit/test_lngmisc.cxx b/svl/qa/unit/test_lngmisc.cxx
index 4b5596cbdeba..7ba980373849 100644
--- a/svl/qa/unit/test_lngmisc.cxx
+++ b/svl/qa/unit/test_lngmisc.cxx
@@ -57,7 +57,7 @@ namespace
// Note that '-' isn't a hyphen to RemoveHyphens.
bModified = linguistic::RemoveHyphens(str2);
CPPUNIT_ASSERT(!bModified);
- CPPUNIT_ASSERT( str2 == "a-b--c---" );
+ CPPUNIT_ASSERT_EQUAL( OUString("a-b--c---"), str2 );
bModified = linguistic::RemoveHyphens(str3);
CPPUNIT_ASSERT(bModified);
@@ -65,7 +65,7 @@ namespace
bModified = linguistic::RemoveHyphens(str4);
CPPUNIT_ASSERT(!bModified);
- CPPUNIT_ASSERT( str4 == "asdf" );
+ CPPUNIT_ASSERT_EQUAL( OUString("asdf"), str4 );
}
void LngMiscTest::testRemoveControlChars()
@@ -88,15 +88,15 @@ namespace
bModified = linguistic::RemoveControlChars(str2);
CPPUNIT_ASSERT(!bModified);
- CPPUNIT_ASSERT( str2 == "asdf" );
+ CPPUNIT_ASSERT_EQUAL( OUString("asdf"), str2 );
bModified = linguistic::RemoveControlChars(str3);
CPPUNIT_ASSERT(bModified);
- CPPUNIT_ASSERT( str3 == "asdfasdf" );
+ CPPUNIT_ASSERT_EQUAL( OUString("asdfasdf"), str3 );
bModified = linguistic::RemoveControlChars(str4);
CPPUNIT_ASSERT(bModified);
- CPPUNIT_ASSERT( str4 == " " );
+ CPPUNIT_ASSERT_EQUAL( OUString(" "), str4 );
}
void LngMiscTest::testReplaceControlChars()
@@ -119,17 +119,17 @@ namespace
bModified = linguistic::ReplaceControlChars(str2);
CPPUNIT_ASSERT(!bModified);
- CPPUNIT_ASSERT( str2 == "asdf" );
+ CPPUNIT_ASSERT_EQUAL( OUString("asdf"), str2 );
bModified = linguistic::ReplaceControlChars(str3);
CPPUNIT_ASSERT(bModified);
- CPPUNIT_ASSERT( str3 == "asdf asdf" );
+ CPPUNIT_ASSERT_EQUAL(OUString("asdf asdf"), str3 );
bModified = linguistic::ReplaceControlChars(str4);
CPPUNIT_ASSERT(bModified);
- CPPUNIT_ASSERT(str4.getLength() == 32);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(32), str4.getLength());
for(int i = 0; i < 32; i++)
- CPPUNIT_ASSERT(str4[i] == ' ');
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Unicode>(' '), str4[i]);
}
void LngMiscTest::testGetThesaurusReplaceText()
@@ -147,22 +147,22 @@ namespace
CPPUNIT_ASSERT(r.isEmpty());
r = linguistic::GetThesaurusReplaceText(str2);
- CPPUNIT_ASSERT(r == str2);
+ CPPUNIT_ASSERT_EQUAL(str2, r);
r = linguistic::GetThesaurusReplaceText(str3);
- CPPUNIT_ASSERT(r == str2);
+ CPPUNIT_ASSERT_EQUAL(str2, r);
r = linguistic::GetThesaurusReplaceText(str4);
- CPPUNIT_ASSERT(r == str2);
+ CPPUNIT_ASSERT_EQUAL(str2, r);
r = linguistic::GetThesaurusReplaceText(str5);
- CPPUNIT_ASSERT(r == str2);
+ CPPUNIT_ASSERT_EQUAL(str2, r);
r = linguistic::GetThesaurusReplaceText(str6);
- CPPUNIT_ASSERT(r == str2);
+ CPPUNIT_ASSERT_EQUAL(str2, r);
r = linguistic::GetThesaurusReplaceText(str7);
- CPPUNIT_ASSERT(r == "asdf asdf");
+ CPPUNIT_ASSERT_EQUAL(OUString("asdf asdf"), r);
r = linguistic::GetThesaurusReplaceText(str8);
CPPUNIT_ASSERT(r.isEmpty());