Kaydet (Commit) 49f658f5 authored tarafından Miklos Vajna's avatar Miklos Vajna

svl: fix loplugin:cppunitassertequals warnings

Change-Id: Ice929418e46ff42517a47dfcd5888a5cce36ae51
Reviewed-on: https://gerrit.libreoffice.org/31523Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst b0e7e629
......@@ -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);
......
......@@ -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);
......
......@@ -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.
......
......@@ -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);
......
......@@ -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());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment