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