Kaydet (Commit) 583e41b9 authored tarafından Miklos Vajna's avatar Miklos Vajna

comphelper: fix loplugin:cppunitassertequals warnings

Change-Id: If042462d8f250dbe2e1be278b7524dab243b08e8
Reviewed-on: https://gerrit.libreoffice.org/28012Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst b17b4da3
......@@ -68,8 +68,8 @@ namespace comphelper_ifcontainer
pContainer = new comphelper::OInterfaceContainerHelper2(m_aGuard);
CPPUNIT_ASSERT_MESSAGE("Empty container not empty",
pContainer->getLength() == 0);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Empty container not empty",
static_cast<sal_Int32>(0), pContainer->getLength());
int i;
for (i = 0; i < nTests; i++)
......@@ -77,21 +77,21 @@ namespace comphelper_ifcontainer
Reference<XEventListener> xRef = new ContainerListener(&aStats);
int nNewLen = pContainer->addInterface(xRef);
CPPUNIT_ASSERT_MESSAGE("addition length mismatch",
nNewLen == i + 1);
CPPUNIT_ASSERT_MESSAGE("addition length mismatch",
pContainer->getLength() == i + 1);
CPPUNIT_ASSERT_EQUAL_MESSAGE("addition length mismatch",
i + 1, nNewLen);
CPPUNIT_ASSERT_EQUAL_MESSAGE("addition length mismatch",
static_cast<sal_Int32>(i + 1), pContainer->getLength());
}
CPPUNIT_ASSERT_MESSAGE("alive count mismatch",
aStats.m_nAlive == nTests);
CPPUNIT_ASSERT_EQUAL_MESSAGE("alive count mismatch",
nTests, aStats.m_nAlive);
EventObject aObj;
pContainer->disposeAndClear(aObj);
CPPUNIT_ASSERT_MESSAGE("dispose count mismatch",
aStats.m_nDisposed == nTests);
CPPUNIT_ASSERT_MESSAGE("leaked container left alive",
aStats.m_nAlive == 0);
CPPUNIT_ASSERT_EQUAL_MESSAGE("dispose count mismatch",
nTests, aStats.m_nDisposed);
CPPUNIT_ASSERT_EQUAL_MESSAGE("leaked container left alive",
0, aStats.m_nAlive);
delete pContainer;
}
......@@ -119,13 +119,13 @@ namespace comphelper_ifcontainer
for (i = 0; i < nTests; i++)
{
CPPUNIT_ASSERT_MESSAGE("mismatching elements",
aElements[i] == aListeners[i]);
bool(aElements[i] == aListeners[i]));
}
}
pContainer->clear();
CPPUNIT_ASSERT_MESSAGE("non-empty container post clear",
pContainer->getLength() == 0);
CPPUNIT_ASSERT_EQUAL_MESSAGE("non-empty container post clear",
static_cast<sal_Int32>(0), pContainer->getLength());
delete pContainer;
}
......
......@@ -117,7 +117,7 @@ void TestInterfaceContainer2::test1()
static_cast<XVetoableChangeListener*>(iterator.next())->vetoableChange( PropertyChangeEvent() );
iterator.remove();
CPPUNIT_ASSERT( helper.getLength() == 0 );
CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(0), helper.getLength() );
helper.disposeAndClear( EventObject() );
}
......@@ -141,7 +141,7 @@ void TestInterfaceContainer2::test1()
iterator.remove();
}
}
CPPUNIT_ASSERT( helper.getLength() == 2 );
CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(2), helper.getLength() );
{
comphelper::OInterfaceIteratorHelper2 iterator( helper );
while( iterator.hasMoreElements() )
......
......@@ -220,8 +220,8 @@ void TestString::testNatural()
// --- Some generic tests to ensure we do not alter original behavior
// outside what we want
CPPUNIT_ASSERT(
compareNatural("ABC", "ABC", xCollator, xBI, lang::Locale()) == 0
CPPUNIT_ASSERT_EQUAL(
static_cast<sal_Int32>(0), compareNatural("ABC", "ABC", xCollator, xBI, lang::Locale())
);
// Case sensitivity
CPPUNIT_ASSERT(
......@@ -271,8 +271,8 @@ void TestString::testNatural()
CPPUNIT_ASSERT(
compareNatural("abc010", "abc08", xCollator, xBI, lang::Locale()) > 0
);
CPPUNIT_ASSERT(
compareNatural("apple10apple", "apple10apple", xCollator, xBI, lang::Locale()) == 0
CPPUNIT_ASSERT_EQUAL(
static_cast<sal_Int32>(0), compareNatural("apple10apple", "apple10apple", xCollator, xBI, lang::Locale())
);
}
......@@ -282,10 +282,10 @@ void TestString::testStripStart()
OString aOut;
aOut = ::comphelper::string::stripStart(aIn, 'b');
CPPUNIT_ASSERT(aOut == "abc");
CPPUNIT_ASSERT_EQUAL(OString("abc"), aOut);
aOut = ::comphelper::string::stripStart(aIn, 'a');
CPPUNIT_ASSERT(aOut == "bc");
CPPUNIT_ASSERT_EQUAL(OString("bc"), aOut);
aIn = "aaa";
aOut = ::comphelper::string::stripStart(aIn, 'a');
......@@ -293,7 +293,7 @@ void TestString::testStripStart()
aIn = "aba";
aOut = ::comphelper::string::stripStart(aIn, 'a');
CPPUNIT_ASSERT(aOut == "ba");
CPPUNIT_ASSERT_EQUAL(OString("ba"), aOut);
}
void TestString::testStripEnd()
......@@ -302,10 +302,10 @@ void TestString::testStripEnd()
OString aOut;
aOut = ::comphelper::string::stripEnd(aIn, 'b');
CPPUNIT_ASSERT(aOut == "abc");
CPPUNIT_ASSERT_EQUAL(OString("abc"), aOut);
aOut = ::comphelper::string::stripEnd(aIn, 'c');
CPPUNIT_ASSERT(aOut == "ab");
CPPUNIT_ASSERT_EQUAL(OString("ab"), aOut);
aIn = "aaa";
aOut = ::comphelper::string::stripEnd(aIn, 'a');
......@@ -313,7 +313,7 @@ void TestString::testStripEnd()
aIn = "aba";
aOut = ::comphelper::string::stripEnd(aIn, 'a');
CPPUNIT_ASSERT(aOut == "ab");
CPPUNIT_ASSERT_EQUAL(OString("ab"), aOut);
}
void TestString::testStrip()
......@@ -322,10 +322,10 @@ void TestString::testStrip()
OString aOut;
aOut = ::comphelper::string::strip(aIn, 'b');
CPPUNIT_ASSERT(aOut == "abc");
CPPUNIT_ASSERT_EQUAL(OString("abc"), aOut);
aOut = ::comphelper::string::strip(aIn, 'c');
CPPUNIT_ASSERT(aOut == "ab");
CPPUNIT_ASSERT_EQUAL(OString("ab"), aOut);
aIn = "aaa";
aOut = ::comphelper::string::strip(aIn, 'a');
......@@ -333,7 +333,7 @@ void TestString::testStrip()
aIn = "aba";
aOut = ::comphelper::string::strip(aIn, 'a');
CPPUNIT_ASSERT(aOut == "b");
CPPUNIT_ASSERT_EQUAL(OString("b"), aOut);
}
void TestString::testToken()
......@@ -345,13 +345,13 @@ void TestString::testToken()
CPPUNIT_ASSERT(aOut.isEmpty());
aOut = aIn.getToken(0, '.');
CPPUNIT_ASSERT(aOut == "10");
CPPUNIT_ASSERT_EQUAL(OString("10"), aOut);
aOut = aIn.getToken(1, '.');
CPPUNIT_ASSERT(aOut == "11");
CPPUNIT_ASSERT_EQUAL(OString("11"), aOut);
aOut = aIn.getToken(2, '.');
CPPUNIT_ASSERT(aOut == "12");
CPPUNIT_ASSERT_EQUAL(OString("12"), aOut);
aOut = aIn.getToken(3, '.');
CPPUNIT_ASSERT(aOut.isEmpty());
......@@ -363,13 +363,13 @@ void TestString::testTokenCount()
sal_Int32 nOut;
nOut = ::comphelper::string::getTokenCount(aIn, '.');
CPPUNIT_ASSERT(nOut == 3);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), nOut);
nOut = ::comphelper::string::getTokenCount(aIn, 'X');
CPPUNIT_ASSERT(nOut == 1);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), nOut);
nOut = ::comphelper::string::getTokenCount(OString(), 'X');
CPPUNIT_ASSERT(nOut == 0);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), nOut);
}
void TestString::testReverseString()
......@@ -377,7 +377,7 @@ void TestString::testReverseString()
OString aIn("ABC");
OString aOut = ::comphelper::string::reverseString(aIn);
CPPUNIT_ASSERT(aOut == "CBA");
CPPUNIT_ASSERT_EQUAL(OString("CBA"), aOut);
}
void TestString::testSplit()
......
......@@ -129,11 +129,11 @@ void VariadicTemplatesTest::testUnwrapArgs() {
::com::sun::star::uno::Any* p2 = seq2.getArray();
for( sal_Int16 i = 0; i < seq1.getLength() && i < seq2.getLength(); ++i ) {
CPPUNIT_ASSERT_MESSAGE( "seq1 and seq2 are equal",
p1[i] == p2[i] );
CPPUNIT_ASSERT_EQUAL_MESSAGE( "seq1 and seq2 are equal",
p1[i], p2[i] );
}
CPPUNIT_ASSERT_MESSAGE( "seq1 and seq2 are equal",
seq1 == seq2 );
bool(seq1 == seq2) );
}
catch( ::com::sun::star::lang::IllegalArgumentException& err ) {
std::stringstream ss;
......@@ -171,8 +171,8 @@ void VariadicTemplatesTest::testUnwrapArgs() {
CPPUNIT_FAIL( "unwrapArgs failed while the baseline did not throw" );
}
catch( ::com::sun::star::lang::IllegalArgumentException& err2 ) {
CPPUNIT_ASSERT_MESSAGE( "err1.ArgumentPosition == err2.ArgumentPosition",
err1.ArgumentPosition == err2.ArgumentPosition );
CPPUNIT_ASSERT_EQUAL_MESSAGE( "err1.ArgumentPosition == err2.ArgumentPosition",
err1.ArgumentPosition, err2.ArgumentPosition );
}
}
}
......
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