summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-07-13 09:18:07 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-07-13 08:46:50 +0000
commitf4719c4959ac2cd5ebef5bc3e617385639fd5ba4 (patch)
tree113da486d36409560a21bcbb27f646310e49b905 /sal
parentcba5a9223a7e8141dc171c3e2e992ce1c0df8330 (diff)
sal: fix remaining loplugin:cppunitassertequals warnings
Change-Id: I9f9b647ed73e06a5e926eff8f95dda92fec134c0 Reviewed-on: https://gerrit.libreoffice.org/27177 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sal')
-rw-r--r--sal/qa/osl/file/test_cpy_wrt_file.cxx6
-rw-r--r--sal/qa/rtl/oustringbuffer/test_oustringbuffer_tostring.cxx6
-rw-r--r--sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx16
-rw-r--r--sal/qa/rtl/ref/rtl_ref.cxx20
-rw-r--r--sal/qa/rtl/strings/test_ostring_concat.cxx6
-rw-r--r--sal/qa/rtl/strings/test_ostring_stringliterals.cxx26
-rw-r--r--sal/qa/rtl/strings/test_oustring_concat.cxx6
-rw-r--r--sal/qa/rtl/strings/test_oustring_endswith.cxx6
-rw-r--r--sal/qa/rtl/strings/test_oustring_stringliterals.cxx24
-rw-r--r--sal/qa/rtl/textenc/rtl_tencinfo.cxx6
-rw-r--r--sal/qa/rtl/textenc/rtl_textcvt.cxx36
-rw-r--r--sal/qa/sal/test_types.cxx2
12 files changed, 80 insertions, 80 deletions
diff --git a/sal/qa/osl/file/test_cpy_wrt_file.cxx b/sal/qa/osl/file/test_cpy_wrt_file.cxx
index 2addac8cf9ef..3c7c0e315660 100644
--- a/sal/qa/osl/file/test_cpy_wrt_file.cxx
+++ b/sal/qa/osl/file/test_cpy_wrt_file.cxx
@@ -41,7 +41,7 @@ public:
//create a tempfile
rtl::OUString aTmpFile;
err = FileBase::createTempFile(nullptr, nullptr, &aTmpFile);
- CPPUNIT_ASSERT_MESSAGE("temp File creation failed", err == osl::FileBase::E_None);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("temp File creation failed", osl::FileBase::E_None, err);
//now attempt to open with Create flag an existing file, should get E_EXIST
File tmp_file(aTmpFile);
@@ -50,7 +50,7 @@ public:
rtl::OString sErrorMsg = "Expected that '";
sErrorMsg += rtl::OUStringToOString(aTmpFile, RTL_TEXTENCODING_ASCII_US);
sErrorMsg += "' would exist!";
- CPPUNIT_ASSERT_MESSAGE(sErrorMsg.getStr(), err == FileBase::E_EXIST);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(sErrorMsg.getStr(), FileBase::E_EXIST, err);
char buffer[1];
sal_uInt64 written = 0;
@@ -64,7 +64,7 @@ public:
CPPUNIT_ASSERT_MESSAGE("close on unconnected file should fail", err != FileBase::E_None);
err = ::osl::File::remove(aTmpFile);
- CPPUNIT_ASSERT_MESSAGE("temp file should have existed", err == FileBase::E_None);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("temp file should have existed", FileBase::E_None, err);
}
CPPUNIT_TEST_SUITE(test_osl_writeFile);
diff --git a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_tostring.cxx b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_tostring.cxx
index 70ed7548e4d9..13310768470c 100644
--- a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_tostring.cxx
+++ b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_tostring.cxx
@@ -42,12 +42,12 @@ CPPUNIT_TEST_SUITE_REGISTRATION(test::oustringbuffer::ToString);
void test::oustringbuffer::ToString::testToString() {
rtl::OUStringBuffer sb(rtl::OUString("test string"));
rtl::OUString str = sb.toString();
- CPPUNIT_ASSERT( str == "test string" );
+ CPPUNIT_ASSERT_EQUAL( rtl::OUString("test string"), str );
// returned OUString must be independent from sb
sb.append( (sal_Unicode)'a' );
- CPPUNIT_ASSERT( str == "test string" );
+ CPPUNIT_ASSERT_EQUAL( rtl::OUString("test string"), str );
sb.setLength(0);
- CPPUNIT_ASSERT( str == "test string" );
+ CPPUNIT_ASSERT_EQUAL( rtl::OUString("test string"), str );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx
index 2a18e35ec32c..d47fd5f0efc0 100644
--- a/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx
+++ b/sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx
@@ -90,14 +90,14 @@ void test::oustringbuffer::Utf32::appendUtf32() {
buf1.appendUtf32('d');
rtl::OUString res1(buf1.makeStringAndClear());
createMessage(message, res1, rtl::OUString(str2, str2Len));
- CPPUNIT_ASSERT_MESSAGE(
- message.getStr(), res1 == rtl::OUString(str2, str2Len));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ message.getStr(), rtl::OUString(str2, str2Len), res1);
rtl::OUStringBuffer buf2(rtl::OUString(str2, str2Len));
buf2.appendUtf32(0x10000);
rtl::OUString res2(buf2.makeStringAndClear());
createMessage(message, res2, rtl::OUString(str3, str3Len));
- CPPUNIT_ASSERT_MESSAGE(
- message.getStr(), res2 == rtl::OUString(str3, str3Len));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ message.getStr(), rtl::OUString(str3, str3Len), res2);
}
void test::oustringbuffer::Utf32::insertUtf32() {
@@ -112,14 +112,14 @@ void test::oustringbuffer::Utf32::insertUtf32() {
buf1.insertUtf32(2, 'd');
rtl::OUString res1(buf1.makeStringAndClear());
createMessage(message, res1, rtl::OUString(str2, str2Len));
- CPPUNIT_ASSERT_MESSAGE(
- message.getStr(), res1 == rtl::OUString(str2, str2Len));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ message.getStr(), rtl::OUString(str2, str2Len), res1);
rtl::OUStringBuffer buf2(rtl::OUString(str2, str2Len));
buf2.insertUtf32(2, 0x10FFFF);
rtl::OUString res2(buf2.makeStringAndClear());
createMessage(message, res2, rtl::OUString(str3, str3Len));
- CPPUNIT_ASSERT_MESSAGE(
- message.getStr(), res2 == rtl::OUString(str3, str3Len));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ message.getStr(), rtl::OUString(str3, str3Len), res2);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/rtl/ref/rtl_ref.cxx b/sal/qa/rtl/ref/rtl_ref.cxx
index 66d54e654dd6..415abafd554d 100644
--- a/sal/qa/rtl/ref/rtl_ref.cxx
+++ b/sal/qa/rtl/ref/rtl_ref.cxx
@@ -65,8 +65,8 @@ class TestReferenceRefCounting : public CppUnit::TestFixture
// move should not increment the reference count
rtl::Reference< MoveTestClass > test2( std::move(test1) );
- CPPUNIT_ASSERT_MESSAGE("test2.use_count() == 1",
- test2->use_count() == 1);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("test2.use_count() == 1",
+ static_cast<long>(1), test2->use_count());
// test1 now contains a null pointer
CPPUNIT_ASSERT_MESSAGE("!test1.is()",
@@ -74,19 +74,19 @@ class TestReferenceRefCounting : public CppUnit::TestFixture
// function return should move the reference
test2 = get_reference( &cTestClass );
- CPPUNIT_ASSERT_MESSAGE("test2.use_count() == 1",
- test2->use_count() == 1);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("test2.use_count() == 1",
+ static_cast<long>(1), test2->use_count());
// normal copy
test2->set_inc_flag();
test1 = test2;
- CPPUNIT_ASSERT_MESSAGE("test2.use_count() == 2",
- test2->use_count() == 2);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("test2.use_count() == 2",
+ static_cast<long>(2), test2->use_count());
// use count should decrement
test2 = rtl::Reference< MoveTestClass >(nullptr);
- CPPUNIT_ASSERT_MESSAGE("test1.use_count() == 1",
- test1->use_count() == 1);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("test1.use_count() == 1",
+ static_cast<long>(1), test1->use_count());
// move of a null pointer should not cause an error
test1 = std::move(test2);
@@ -96,8 +96,8 @@ class TestReferenceRefCounting : public CppUnit::TestFixture
CPPUNIT_ASSERT_MESSAGE("!test2.is()",
!test2.is());
- CPPUNIT_ASSERT_MESSAGE("cTestClass.use_count() == 0",
- cTestClass.use_count() == 0);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("cTestClass.use_count() == 0",
+ static_cast<long>(0), cTestClass.use_count());
}
CPPUNIT_TEST_SUITE(TestReferenceRefCounting);
diff --git a/sal/qa/rtl/strings/test_ostring_concat.cxx b/sal/qa/rtl/strings/test_ostring_concat.cxx
index ba46d9f76397..e3bdcc75c456 100644
--- a/sal/qa/rtl/strings/test_ostring_concat.cxx
+++ b/sal/qa/rtl/strings/test_ostring_concat.cxx
@@ -95,7 +95,7 @@ void test::ostring::StringConcat::checkEnsureCapacity()
rtl_string_ensureCapacity( &str, 4 ); // should be no-op
CPPUNIT_ASSERT_EQUAL( sal_Int32( 4 ), str->length );
CPPUNIT_ASSERT_EQUAL( 1, int( str->refCount ));
- CPPUNIT_ASSERT( oldStr == str );
+ CPPUNIT_ASSERT_EQUAL( str, oldStr );
rtl_string_acquire( oldStr );
CPPUNIT_ASSERT_EQUAL( 2, int( str->refCount ));
@@ -104,7 +104,7 @@ void test::ostring::StringConcat::checkEnsureCapacity()
CPPUNIT_ASSERT_EQUAL( 1, int( str->refCount ));
// a copy was forced because of refcount
CPPUNIT_ASSERT( oldStr != str );
- CPPUNIT_ASSERT( strcmp( oldStr->buffer, str->buffer ) == 0 );
+ CPPUNIT_ASSERT_EQUAL( 0, strcmp( oldStr->buffer, str->buffer ) );
CPPUNIT_ASSERT_EQUAL( 1, int( oldStr->refCount ));
rtl_string_release( str );
str = oldStr;
@@ -114,7 +114,7 @@ void test::ostring::StringConcat::checkEnsureCapacity()
CPPUNIT_ASSERT_EQUAL( sal_Int32( 4 ), str->length ); // size is still 4
CPPUNIT_ASSERT_EQUAL( 1, int( str->refCount ));
CPPUNIT_ASSERT( oldStr != str );
- CPPUNIT_ASSERT( strcmp( oldStr->buffer, str->buffer ) == 0 );
+ CPPUNIT_ASSERT_EQUAL( 0, strcmp( oldStr->buffer, str->buffer ) );
CPPUNIT_ASSERT_EQUAL( 1, int( oldStr->refCount ));
strcpy( str->buffer, "01234567890123456789" ); // but there should be extra capacity
str->length += 20;
diff --git a/sal/qa/rtl/strings/test_ostring_stringliterals.cxx b/sal/qa/rtl/strings/test_ostring_stringliterals.cxx
index d8acf446d804..2b08581d0712 100644
--- a/sal/qa/rtl/strings/test_ostring_stringliterals.cxx
+++ b/sal/qa/rtl/strings/test_ostring_stringliterals.cxx
@@ -88,12 +88,12 @@ void test::ostring::StringLiterals::checkCtors()
CPPUNIT_ASSERT( CONST_CTOR_USED( bad7[ 1 ] ));
// Check that contents are correct and equal to the case when const char* ctor is used.
- CPPUNIT_ASSERT( rtl::OString( static_cast<const char*>("") ) == rtl::OString( "" ));
- CPPUNIT_ASSERT( rtl::OString( static_cast<const char*>("ab") ) == rtl::OString( "ab" ));
+ CPPUNIT_ASSERT_EQUAL( rtl::OString( "" ), rtl::OString( static_cast<const char*>("") ) );
+ CPPUNIT_ASSERT_EQUAL( rtl::OString( "ab" ), rtl::OString( static_cast<const char*>("ab") ) );
// Check that contents are correct and equal to the case when RTL_CONSTASCII_STRINGPARAM is used.
- CPPUNIT_ASSERT( rtl::OString( RTL_CONSTASCII_STRINGPARAM( "" )) == rtl::OString( "" ));
- CPPUNIT_ASSERT( rtl::OString( RTL_CONSTASCII_STRINGPARAM( "ab" )) == rtl::OString( "ab" ));
+ CPPUNIT_ASSERT_EQUAL( rtl::OString( "" ), rtl::OString( RTL_CONSTASCII_STRINGPARAM( "" )) );
+ CPPUNIT_ASSERT_EQUAL( rtl::OString( "ab" ), rtl::OString( RTL_CONSTASCII_STRINGPARAM( "ab" )) );
}
const char test::ostring::StringLiterals::bad5[] = "test";
@@ -152,10 +152,10 @@ void test::ostring::StringLiterals::checkUsage()
// CPPUNIT_ASSERT( FooBaR.endsWithIgnoreAsciiCase( "bar" ));
// CPPUNIT_ASSERT( rtl_string_unittest_const_literal_function == true );
rtl_string_unittest_const_literal_function = false;
- CPPUNIT_ASSERT( foo == "foo" );
+ CPPUNIT_ASSERT( bool(foo == "foo") );
CPPUNIT_ASSERT( rtl_string_unittest_const_literal_function );
rtl_string_unittest_const_literal_function = false;
- CPPUNIT_ASSERT( "foo" == foo );
+ CPPUNIT_ASSERT( bool("foo" == foo) );
CPPUNIT_ASSERT( rtl_string_unittest_const_literal_function );
rtl_string_unittest_const_literal_function = false;
CPPUNIT_ASSERT( foo != "bar" );
@@ -164,7 +164,7 @@ void test::ostring::StringLiterals::checkUsage()
CPPUNIT_ASSERT( "foo" != bar );
CPPUNIT_ASSERT( rtl_string_unittest_const_literal_function );
rtl_string_unittest_const_literal_function = false;
- CPPUNIT_ASSERT( foobarfoo.indexOf( "foo", 1 ) == 6 );
+ CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(6), foobarfoo.indexOf( "foo", 1 ) );
CPPUNIT_ASSERT( rtl_string_unittest_const_literal_function );
// rtl_string_unittest_const_literal_function = false;
// CPPUNIT_ASSERT( foobarfoo.lastIndexOf( "foo" ) == 6 );
@@ -210,16 +210,16 @@ void test::ostring::StringLiterals::checkNonConstUsage()
CPPUNIT_ASSERT( foobar.endsWith( bar_c ));
// CPPUNIT_ASSERT( FooBaR.endsWithIgnoreAsciiCase( (const char*)bar_c ));
// CPPUNIT_ASSERT( FooBaR.endsWithIgnoreAsciiCase( bar_c ));
- CPPUNIT_ASSERT( foo == static_cast<const char*>(foo_c) );
- CPPUNIT_ASSERT( foo == foo_c );
- CPPUNIT_ASSERT( static_cast<const char*>(foo_c) == foo );
- CPPUNIT_ASSERT( foo_c == foo );
+ CPPUNIT_ASSERT( bool(foo == static_cast<const char*>(foo_c)) );
+ CPPUNIT_ASSERT( bool(foo == foo_c) );
+ CPPUNIT_ASSERT( bool(static_cast<const char*>(foo_c) == foo) );
+ CPPUNIT_ASSERT( bool(foo_c == foo) );
CPPUNIT_ASSERT( foo != static_cast<const char*>(bar_c) );
CPPUNIT_ASSERT( foo != bar_c );
CPPUNIT_ASSERT( static_cast<const char*>(foo_c) != bar );
CPPUNIT_ASSERT( foo_c != bar );
- CPPUNIT_ASSERT( foobarfoo.indexOf( static_cast<const char*>(foo_c), 1 ) == 6 );
- CPPUNIT_ASSERT( foobarfoo.indexOf( foo_c, 1 ) == 6 );
+ CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(6), foobarfoo.indexOf( static_cast<const char*>(foo_c), 1 ) );
+ CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(6), foobarfoo.indexOf( foo_c, 1 ) );
// CPPUNIT_ASSERT( foobarfoo.lastIndexOf( (const char*)foo_c ) == 6 );
// CPPUNIT_ASSERT( foobarfoo.lastIndexOf( foo_c ) == 6 );
// if this is not true, some of the calls above used const variants
diff --git a/sal/qa/rtl/strings/test_oustring_concat.cxx b/sal/qa/rtl/strings/test_oustring_concat.cxx
index b319c089d35f..356c6013e7fb 100644
--- a/sal/qa/rtl/strings/test_oustring_concat.cxx
+++ b/sal/qa/rtl/strings/test_oustring_concat.cxx
@@ -96,7 +96,7 @@ void test::oustring::StringConcat::checkEnsureCapacity()
rtl_uString_ensureCapacity( &str, 4 ); // should be no-op
CPPUNIT_ASSERT_EQUAL( sal_Int32( 4 ), str->length );
CPPUNIT_ASSERT_EQUAL( 1, int( str->refCount ));
- CPPUNIT_ASSERT( oldStr == str );
+ CPPUNIT_ASSERT_EQUAL( str, oldStr );
rtl_uString_acquire( oldStr );
CPPUNIT_ASSERT_EQUAL( 2, int( str->refCount ));
@@ -105,7 +105,7 @@ void test::oustring::StringConcat::checkEnsureCapacity()
CPPUNIT_ASSERT_EQUAL( 1, int( str->refCount ));
// a copy was forced because of refcount
CPPUNIT_ASSERT( oldStr != str );
- CPPUNIT_ASSERT( rtl_ustr_compare( oldStr->buffer, str->buffer ) == 0 );
+ CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(0), rtl_ustr_compare( oldStr->buffer, str->buffer ) );
CPPUNIT_ASSERT_EQUAL( 1, int( oldStr->refCount ));
rtl_uString_release( str );
str = oldStr;
@@ -115,7 +115,7 @@ void test::oustring::StringConcat::checkEnsureCapacity()
CPPUNIT_ASSERT_EQUAL( sal_Int32( 4 ), str->length ); // size is still 4
CPPUNIT_ASSERT_EQUAL( 1, int( str->refCount ));
CPPUNIT_ASSERT( oldStr != str );
- CPPUNIT_ASSERT( rtl_ustr_compare( oldStr->buffer, str->buffer ) == 0 );
+ CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(0), rtl_ustr_compare( oldStr->buffer, str->buffer ) );
CPPUNIT_ASSERT_EQUAL( 1, int( oldStr->refCount ));
// but there should be extra capacity
for( int i = 0;
diff --git a/sal/qa/rtl/strings/test_oustring_endswith.cxx b/sal/qa/rtl/strings/test_oustring_endswith.cxx
index dfdeebcc797c..37d5c608c127 100644
--- a/sal/qa/rtl/strings/test_oustring_endswith.cxx
+++ b/sal/qa/rtl/strings/test_oustring_endswith.cxx
@@ -101,13 +101,13 @@ void test::oustring::EndsWith::endsWith()
appendString(msg, rtl::OString(data[i].str2, data[i].str2Len));
msg.append(RTL_CONSTASCII_STRINGPARAM(") == "));
msg.append(data[i].endsWith);
- CPPUNIT_ASSERT_MESSAGE(
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
msg.getStr(),
+ data[i].endsWith,
rtl::OUString(
data[i].str1, data[i].str1Len,
RTL_TEXTENCODING_ASCII_US).endsWithIgnoreAsciiCaseAsciiL(
- data[i].str2, data[i].str2Len)
- == data[i].endsWith);
+ data[i].str2, data[i].str2Len));
}
}
diff --git a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
index ff4300052f1e..961c2de72997 100644
--- a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
+++ b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
@@ -133,17 +133,17 @@ void test::oustring::StringLiterals::checkUsage()
CPPUNIT_ASSERT( FooBaR.startsWithIgnoreAsciiCase( "foo" ));
CPPUNIT_ASSERT( foobar.endsWith( "bar" ));
CPPUNIT_ASSERT( FooBaR.endsWithIgnoreAsciiCase( "bar" ));
- CPPUNIT_ASSERT( foo == "foo" );
- CPPUNIT_ASSERT( "foo" == foo );
+ CPPUNIT_ASSERT( bool(foo == "foo") );
+ CPPUNIT_ASSERT( bool("foo" == foo) );
CPPUNIT_ASSERT( foo != "bar" );
CPPUNIT_ASSERT( "foo" != bar );
- CPPUNIT_ASSERT( foobarfoo.indexOf( "foo", 1 ) == 6 );
- CPPUNIT_ASSERT( foobarfoo.lastIndexOf( "foo" ) == 6 );
- CPPUNIT_ASSERT( foobarfoo.replaceFirst( "foo", test ) == "testbarfoo" );
- CPPUNIT_ASSERT( foobarfoo.replaceFirst( "foo", "test" ) == "testbarfoo" );
- CPPUNIT_ASSERT( foobarfoo.replaceAll( "foo", test ) == "testbartest" );
- CPPUNIT_ASSERT( foobarfoo.replaceAll( "foo", "test" ) == "testbartest" );
- CPPUNIT_ASSERT( foo.reverseCompareTo( "foo" ) == 0 );
+ CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(6), foobarfoo.indexOf( "foo", 1 ) );
+ CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(6), foobarfoo.lastIndexOf( "foo" ) );
+ CPPUNIT_ASSERT( bool(foobarfoo.replaceFirst( "foo", test ) == "testbarfoo") );
+ CPPUNIT_ASSERT( bool(foobarfoo.replaceFirst( "foo", "test" ) == "testbarfoo") );
+ CPPUNIT_ASSERT( bool(foobarfoo.replaceAll( "foo", test ) == "testbartest") );
+ CPPUNIT_ASSERT( bool(foobarfoo.replaceAll( "foo", "test" ) == "testbartest") );
+ CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(0), foo.reverseCompareTo( "foo" ) );
// if this is not true, some of the calls above converted to OUString
CPPUNIT_ASSERT( !rtl_string_unittest_const_literal );
}
@@ -179,7 +179,7 @@ void test::oustring::StringLiterals::checkNonconstChar()
!VALID_CONVERSION(
[&test, &constbar]() {
return rtl::OUString("footest").replaceAll(test, constbar); }));
- CPPUNIT_ASSERT( rtl::OUString( "foobar" ) == rtl::OUString( "footest" ).replaceAll( consttest, constbar ));
+ CPPUNIT_ASSERT_EQUAL( rtl::OUString( "foobar" ), rtl::OUString( "footest" ).replaceAll( consttest, constbar ));
}
void test::oustring::StringLiterals::checkBuffer()
@@ -208,8 +208,8 @@ rtl::OUString conditional(bool flag) {
void test::oustring::StringLiterals::checkOUStringLiteral()
{
- CPPUNIT_ASSERT(conditional(true) == "a");
- CPPUNIT_ASSERT(conditional(false) == "bb");
+ CPPUNIT_ASSERT(bool(conditional(true) == "a"));
+ CPPUNIT_ASSERT(bool(conditional(false) == "bb"));
}
void test::oustring::StringLiterals::checkOUStringLiteral1()
diff --git a/sal/qa/rtl/textenc/rtl_tencinfo.cxx b/sal/qa/rtl/textenc/rtl_tencinfo.cxx
index b0f2dbda0fbf..a6adf0cbabb3 100644
--- a/sal/qa/rtl/textenc/rtl_tencinfo.cxx
+++ b/sal/qa/rtl/textenc/rtl_tencinfo.cxx
@@ -37,7 +37,7 @@ namespace
{
const sal_Char *pCharSet = rtl_getBestMimeCharsetFromTextEncoding(eIn);
rtl_TextEncoding eTextEnc = rtl_getTextEncodingFromMimeCharset(pCharSet);
- CPPUNIT_ASSERT_MESSAGE("rtl_getBestMimeCharsetFromTextEncoding && rtl_getTextEncodingFromMimeCharset differdiffer", eTextEnc == eOut);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("rtl_getBestMimeCharsetFromTextEncoding && rtl_getTextEncodingFromMimeCharset differdiffer", eOut, eTextEnc );
}
// the defines for the follows test could be found in file inc/rtl/textenc.h
@@ -485,7 +485,7 @@ namespace
{
const sal_Char *pCharSet = rtl_getBestUnixCharsetFromTextEncoding(eIn);
rtl_TextEncoding eTextEnc = rtl_getTextEncodingFromUnixCharset(pCharSet);
- CPPUNIT_ASSERT_MESSAGE("rtl_getBestUnixCharsetFromTextEncoding && rtl_getTextEncodingFromUnixCharset", eTextEnc == eOut);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("rtl_getBestUnixCharsetFromTextEncoding && rtl_getTextEncodingFromUnixCharset", eOut, eTextEnc );
}
void UnixCharsetFromTextEncoding_MS_1252()
@@ -1013,7 +1013,7 @@ namespace
{
const sal_uInt8 nCharSet = rtl_getBestWindowsCharsetFromTextEncoding(nIn);
rtl_TextEncoding eTextEnc = rtl_getTextEncodingFromWindowsCharset(nCharSet);
- CPPUNIT_ASSERT_MESSAGE("rtl_getBestWindowsCharsetFromTextEncoding && rtl_getTextEncodingFromWindowsCharset differ", eTextEnc == nOut);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("rtl_getBestWindowsCharsetFromTextEncoding && rtl_getTextEncodingFromWindowsCharset differ", static_cast<rtl_TextEncoding>(nOut), eTextEnc );
}
void WindowsCharsetFromTextEncoding_MS_1252()
diff --git a/sal/qa/rtl/textenc/rtl_textcvt.cxx b/sal/qa/rtl/textenc/rtl_textcvt.cxx
index 8a6b4837b39d..bb85141b8052 100644
--- a/sal/qa/rtl/textenc/rtl_textcvt.cxx
+++ b/sal/qa/rtl/textenc/rtl_textcvt.cxx
@@ -80,16 +80,16 @@ void testSingleByteCharSet(SingleByteCharSet const & rSet) {
int j = 0;
for (int i = 0; i < 256; ++i) {
if (rSet.m_aMap[i] != 0xFFFF && aUnicode[j] != rSet.m_aMap[i]) {
- CPPUNIT_ASSERT_MESSAGE(OUStringToOString(OUString("rSet.m_aMap[" + OUString::number(i) + "] == " +
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(OUStringToOString(OUString("rSet.m_aMap[" + OUString::number(i) + "] == " +
OUString::number(rSet.m_aMap[i], 16)),
RTL_TEXTENCODING_UTF8).getStr(),
- rSet.m_aMap[i] == 0xFFFF);
- CPPUNIT_ASSERT_MESSAGE(OUStringToOString(OUString("aUnicode[" + OUString::number(j) + "] == " +
+ static_cast<sal_Unicode>(0xFFFF), rSet.m_aMap[i]);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(OUStringToOString(OUString("aUnicode[" + OUString::number(j) + "] == " +
OUString::number(aUnicode[j], 16) +
", rSet.m_aMap[" + OUString::number(i) + "] == " +
OUString::number(rSet.m_aMap[i], 16)),
RTL_TEXTENCODING_UTF8).getStr(),
- aUnicode[j] == rSet.m_aMap[i]);
+ static_cast<sal_Unicode>(rSet.m_aMap[i]), aUnicode[j]);
}
if (rSet.m_aMap[i] != 0xFFFF)
j++;
@@ -127,14 +127,14 @@ void testSingleByteCharSet(SingleByteCharSet const & rSet) {
if (rSet.m_aMap[i] != 0xFFFF
&& aText[j] != static_cast< sal_Char >(i))
{
- CPPUNIT_ASSERT_MESSAGE(OUStringToOString(OUString("rSet.m_aMap[" + OUString::number(i) + "] == " +
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(OUStringToOString(OUString("rSet.m_aMap[" + OUString::number(i) + "] == " +
OUString::number(rSet.m_aMap[i], 16)),
RTL_TEXTENCODING_UTF8).getStr(),
- rSet.m_aMap[i] == 0xFFFF);
- CPPUNIT_ASSERT_MESSAGE(OUStringToOString(OUString("aText[" + OUString::number(j) + "] == " +
+ static_cast<sal_Unicode>(0xFFFF), rSet.m_aMap[i]);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(OUStringToOString(OUString("aText[" + OUString::number(j) + "] == " +
OUString::number(i, 16)),
RTL_TEXTENCODING_UTF8).getStr(),
- aText[j] == static_cast< sal_Char >(i));
+ static_cast< sal_Char >(i), aText[j]);
}
if (rSet.m_aMap[i] != 0xFFFF)
j++;
@@ -221,12 +221,12 @@ void doComplexCharSetTest(ComplexCharSetTest const & rTest) {
rtl_destroyTextToUnicodeConverter(aConverter);
for (sal_Size i = 0; i < rTest.m_nUnicodeSize; ++i) {
- CPPUNIT_ASSERT_MESSAGE(OUStringToOString(OUString("aUnicode[" + OUString::number(i) + "] == " +
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(OUStringToOString(OUString("aUnicode[" + OUString::number(i) + "] == " +
OUString::number(aUnicode[i], 16) +
", rTest.m_aUnicode[" + OUString::number(i) + "] == " +
OUString::number(rTest.m_aUnicode[i], 16)),
RTL_TEXTENCODING_UTF8).getStr(),
- aUnicode[i] == rTest.m_aUnicode[i]);
+ rTest.m_aUnicode[i], aUnicode[i]);
}
}
if (rTest.m_bForward) {
@@ -271,12 +271,12 @@ void doComplexCharSetTest(ComplexCharSetTest const & rTest) {
CPPUNIT_ASSERT_EQUAL(rTest.m_nTextSize, nInput);
for (sal_Size i = 0; i < rTest.m_nUnicodeSize; ++i) {
- CPPUNIT_ASSERT_MESSAGE(OUStringToOString(OUString("aUnicode[" + OUString::number(i) + "] == " +
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(OUStringToOString(OUString("aUnicode[" + OUString::number(i) + "] == " +
OUString::number(aUnicode[i], 16) +
", rTest.m_aUnicode[" + OUString::number(i) + "] == " +
OUString::number(rTest.m_aUnicode[i], 16)),
RTL_TEXTENCODING_UTF8).getStr(),
- aUnicode[i] == rTest.m_aUnicode[i]);
+ rTest.m_aUnicode[i], aUnicode[i]);
}
}
rtl_destroyTextToUnicodeContext(aConverter, aContext);
@@ -356,12 +356,12 @@ void doComplexCharSetTest(ComplexCharSetTest const & rTest) {
done:
rtl_destroyTextToUnicodeConverter(aConverter);
for (sal_Size i = 0; i < rTest.m_nUnicodeSize; ++i) {
- CPPUNIT_ASSERT_MESSAGE(OUStringToOString(OUString("aUnicode[" + OUString::number(i) + "] == " +
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(OUStringToOString(OUString("aUnicode[" + OUString::number(i) + "] == " +
OUString::number(aUnicode[i], 16) +
", rTest.m_aUnicode[" + OUString::number(i) + "] == " +
OUString::number(rTest.m_aUnicode[i], 16)),
RTL_TEXTENCODING_UTF8).getStr(),
- aUnicode[i] == rTest.m_aUnicode[i]);
+ rTest.m_aUnicode[i], aUnicode[i]);
}
}
if (rTest.m_bReverse) {
@@ -396,12 +396,12 @@ void doComplexCharSetTest(ComplexCharSetTest const & rTest) {
rtl_destroyUnicodeToTextContext(aConverter, aContext);
rtl_destroyUnicodeToTextConverter(aConverter);
for (sal_Size i = 0; i < rTest.m_nTextSize; ++i) {
- CPPUNIT_ASSERT_MESSAGE(OUStringToOString(OUString("aText[" + OUString::number(i) + "] == " +
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(OUStringToOString(OUString("aText[" + OUString::number(i) + "] == " +
OUString::number(aText[i], 16) +
", rTest.m_pText[" + OUString::number(i) + "] == " +
OUString::number(rTest.m_pText[i], 16)),
RTL_TEXTENCODING_UTF8).getStr(),
- aText[i] == rTest.m_pText[i]);
+ rTest.m_pText[i], aText[i]);
}
}
}
@@ -435,12 +435,12 @@ void doComplexCharSetCutTest(ComplexCharSetTest const & rTest) {
rtl_destroyTextToUnicodeConverter(aConverter);
for (sal_Size i = 0; i < nSize; ++i) {
- CPPUNIT_ASSERT_MESSAGE(OUStringToOString(OUString("aUnicode[" + OUString::number(i) + "] == " +
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(OUStringToOString(OUString("aUnicode[" + OUString::number(i) + "] == " +
OUString::number(aUnicode[i], 16) +
", rTest.m_aUnicode[" + OUString::number(i) + "] == " +
OUString::number(rTest.m_aUnicode[i], 16)),
RTL_TEXTENCODING_UTF8).getStr(),
- aUnicode[i] == rTest.m_aUnicode[i]);
+ rTest.m_aUnicode[i], aUnicode[i]);
}
}
}
diff --git a/sal/qa/sal/test_types.cxx b/sal/qa/sal/test_types.cxx
index 5cb3b11970c4..f863247b60fc 100644
--- a/sal/qa/sal/test_types.cxx
+++ b/sal/qa/sal/test_types.cxx
@@ -35,7 +35,7 @@ template< typename T > void testPrintf(
char buf[bufsize];
int n = snprintf(buf, bufsize, format, argument);
CPPUNIT_ASSERT(n >= 0 && sal::static_int_cast< unsigned int >(n) < bufsize);
- CPPUNIT_ASSERT(strcmp(buf, result) == 0);
+ CPPUNIT_ASSERT_EQUAL(0, strcmp(buf, result));
}
class Test: public CppUnit::TestFixture {