summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--comphelper/qa/container/comphelper_ifcontainer.cxx30
-rw-r--r--comphelper/qa/container/testifcontainer.cxx4
-rw-r--r--comphelper/qa/string/test_string.cxx40
-rw-r--r--comphelper/qa/unit/variadictemplates.cxx10
4 files changed, 42 insertions, 42 deletions
diff --git a/comphelper/qa/container/comphelper_ifcontainer.cxx b/comphelper/qa/container/comphelper_ifcontainer.cxx
index 733a7e056751..261dedba34db 100644
--- a/comphelper/qa/container/comphelper_ifcontainer.cxx
+++ b/comphelper/qa/container/comphelper_ifcontainer.cxx
@@ -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;
}
diff --git a/comphelper/qa/container/testifcontainer.cxx b/comphelper/qa/container/testifcontainer.cxx
index 85e06c218ddf..3cc8f9c8958b 100644
--- a/comphelper/qa/container/testifcontainer.cxx
+++ b/comphelper/qa/container/testifcontainer.cxx
@@ -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() )
diff --git a/comphelper/qa/string/test_string.cxx b/comphelper/qa/string/test_string.cxx
index 0d18ac03a73b..94349ba904c5 100644
--- a/comphelper/qa/string/test_string.cxx
+++ b/comphelper/qa/string/test_string.cxx
@@ -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()
diff --git a/comphelper/qa/unit/variadictemplates.cxx b/comphelper/qa/unit/variadictemplates.cxx
index 4b45f1767606..0f5dafff6f69 100644
--- a/comphelper/qa/unit/variadictemplates.cxx
+++ b/comphelper/qa/unit/variadictemplates.cxx
@@ -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 );
}
}
}