[Libreoffice-commits] core.git: sal/qa

Miklos Vajna vmiklos at collabora.co.uk
Wed Jul 13 08:47:13 UTC 2016


 sal/qa/osl/file/test_cpy_wrt_file.cxx                      |    6 +-
 sal/qa/rtl/oustringbuffer/test_oustringbuffer_tostring.cxx |    6 +-
 sal/qa/rtl/oustringbuffer/test_oustringbuffer_utf32.cxx    |   16 ++---
 sal/qa/rtl/ref/rtl_ref.cxx                                 |   20 +++----
 sal/qa/rtl/strings/test_ostring_concat.cxx                 |    6 +-
 sal/qa/rtl/strings/test_ostring_stringliterals.cxx         |   26 ++++-----
 sal/qa/rtl/strings/test_oustring_concat.cxx                |    6 +-
 sal/qa/rtl/strings/test_oustring_endswith.cxx              |    6 +-
 sal/qa/rtl/strings/test_oustring_stringliterals.cxx        |   24 ++++----
 sal/qa/rtl/textenc/rtl_tencinfo.cxx                        |    6 +-
 sal/qa/rtl/textenc/rtl_textcvt.cxx                         |   36 ++++++-------
 sal/qa/sal/test_types.cxx                                  |    2 
 12 files changed, 80 insertions(+), 80 deletions(-)

New commits:
commit f4719c4959ac2cd5ebef5bc3e617385639fd5ba4
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Jul 13 09:18:07 2016 +0200

    sal: fix remaining loplugin:cppunitassertequals warnings
    
    Change-Id: I9f9b647ed73e06a5e926eff8f95dda92fec134c0
    Reviewed-on: https://gerrit.libreoffice.org/27177
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sal/qa/osl/file/test_cpy_wrt_file.cxx b/sal/qa/osl/file/test_cpy_wrt_file.cxx
index 2addac8..3c7c0e3 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 70ed754..1331076 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 2a18e35..d47fd5f 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 66d54e6..415abaf 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 ba46d9f..e3bdcc7 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 d8acf44..2b08581 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 b319c08..356c601 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 dfdeebcc..37d5c60 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 ff43000..961c2de 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 b0f2dbd..a6adf0c 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 8a6b483..bb85141 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 5cb3b11..f863247 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 {


More information about the Libreoffice-commits mailing list