[Libreoffice-commits] core.git: sal/qa
Miklos Vajna
vmiklos at collabora.co.uk
Thu Jun 9 08:46:10 UTC 2016
sal/qa/osl/file/osl_old_test_file.cxx | 6 +++---
sal/qa/osl/process/osl_Thread.cxx | 12 ++++++------
sal/qa/osl/security/osl_Security.cxx | 10 +++++-----
sal/qa/rtl/crc32/rtl_crc32.cxx | 4 ++--
sal/qa/rtl/locale/rtl_locale.cxx | 12 ++++++------
sal/qa/rtl/process/rtl_Process.cxx | 14 +++++++-------
sal/qa/rtl/random/rtl_random.cxx | 20 ++++++++++----------
7 files changed, 39 insertions(+), 39 deletions(-)
New commits:
commit 87def0e248cef61e5be8acfb66c191f8552db344
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Jun 9 09:10:27 2016 +0200
CppunitTest_sal_osl_old_test_file: fix loplugin:cppunitassertequals warnings
Also in:
- CppunitTest_sal_osl_security
- CppunitTest_sal_rtl_crc32
- CppunitTest_sal_osl_thread
- CppunitTest_sal_rtl_locale
- CppunitTest_sal_rtl_process
- CppunitTest_sal_rtl_random
Change-Id: I853457f4ddc387728ea4fa201c278c361369a591
Reviewed-on: https://gerrit.libreoffice.org/26085
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/sal/qa/osl/file/osl_old_test_file.cxx b/sal/qa/osl/file/osl_old_test_file.cxx
index 4bbc70d..ea4f52f 100644
--- a/sal/qa/osl/file/osl_old_test_file.cxx
+++ b/sal/qa/osl/file/osl_old_test_file.cxx
@@ -90,7 +90,7 @@ void oldtestfile::test_file_001()
OUString target;
OUString rel = OUString::createFromAscii( aSource1[i] );
oslFileError e = osl_getAbsoluteFileURL( base1.pData, rel.pData , &target.pData );
- CPPUNIT_ASSERT_MESSAGE("failure #1", osl_File_E_None == e );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("failure #1", osl_File_E_None, e );
if( osl_File_E_None == e )
{
CPPUNIT_ASSERT_MESSAGE("failure #1.1", target.equalsAscii( aSource1[i+1] ) );
@@ -109,7 +109,7 @@ void oldtestfile::test_file_002()
OUString target;
OUString rel = OUString::createFromAscii( aSource2[i] );
oslFileError e = osl_getAbsoluteFileURL( base2.pData, rel.pData , &target.pData );
- CPPUNIT_ASSERT_MESSAGE("failure #2", osl_File_E_None == e );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("failure #2", osl_File_E_None, e );
if( osl_File_E_None == e )
{
CPPUNIT_ASSERT_MESSAGE("failure #2.1", target.equalsAscii( aSource2[i+1] ) );
@@ -128,7 +128,7 @@ void oldtestfile::test_file_004()
OUString target;
OUString rel = OUString::createFromAscii( aSource1[i] );
oslFileError e = osl_getAbsoluteFileURL( base4.pData, rel.pData , &target.pData );
- CPPUNIT_ASSERT_MESSAGE("failure #10", osl_File_E_None == e );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("failure #10", osl_File_E_None, e );
if( osl_File_E_None == e )
{
CPPUNIT_ASSERT_MESSAGE("failure #10.1", target.equalsAscii( aSource1[i+1] ) );
diff --git a/sal/qa/osl/process/osl_Thread.cxx b/sal/qa/osl/process/osl_Thread.cxx
index 1e3c12c..ebce318 100644
--- a/sal/qa/osl/process/osl_Thread.cxx
+++ b/sal/qa/osl/process/osl_Thread.cxx
@@ -1382,9 +1382,9 @@ namespace osl_Thread
#else
// LLA: Linux
// NO_PTHREAD_PRIORITY ???
- CPPUNIT_ASSERT_MESSAGE(
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
"getPriority",
- aPriority == osl_Thread_PriorityNormal
+ osl_Thread_PriorityNormal, aPriority
);
#endif
}
@@ -1538,9 +1538,9 @@ namespace osl_Thread
t_print("later value = %d\n", (int) nLaterValue);
// if value and latervalue not equal, than the thread would not suspended
- CPPUNIT_ASSERT_MESSAGE(
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Schedule: suspend works.",
- nLaterValue == nValue
+ nValue, nLaterValue
);
aThread->resume();
@@ -1611,9 +1611,9 @@ namespace osl_Thread
t_print(" value term = %d\n", (int) nValue_term);
- CPPUNIT_ASSERT_MESSAGE(
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Schedule: don't schedule in thread run method, terminate failed.",
- nValue_term == 10
+ static_cast<sal_Int32>(10), nValue_term
);
}
diff --git a/sal/qa/osl/security/osl_Security.cxx b/sal/qa/osl/security/osl_Security.cxx
index 33c093b..396959be 100644
--- a/sal/qa/osl/security/osl_Security.cxx
+++ b/sal/qa/osl/security/osl_Security.cxx
@@ -208,8 +208,8 @@ namespace osl_Security
::osl::Security aSec;
bRes = aSec.isAdministrator( );
- CPPUNIT_ASSERT_MESSAGE( "#test comment#: check if the user is administrator at beginning, compare here.",
- bRes == isAdmin );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "#test comment#: check if the user is administrator at beginning, compare here.",
+ isAdmin, bRes );
}
CPPUNIT_TEST_SUITE( isAdministrator );
@@ -278,7 +278,7 @@ namespace osl_Security
oslSecurityError erg = osl_loginUserOnFileServer(suUserName.pData, suPassword.pData, suFileServer.pData, &pSec);
- CPPUNIT_ASSERT_MESSAGE( "empty function.", erg == osl_Security_E_UserUnknown );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "empty function.", osl_Security_E_UserUnknown, erg );
}
CPPUNIT_TEST_SUITE( loginUserOnFileServer );
@@ -339,8 +339,8 @@ void MyTestPlugInImpl::initialize( CPPUNIT_NS::TestFactoryRegistry *,
char *pw_dir = pw->pw_dir;
if( getenv( "FAKEROOTKEY" ) )
pw_dir = getenv("HOME");
- CPPUNIT_ASSERT_MESSAGE( "#Convert from system path to URL failed.",
- ::osl::File::E_None == ::osl::File::getFileURLFromSystemPath( ::rtl::OUString::createFromAscii( pw_dir ), strHomeDirectory ) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "#Convert from system path to URL failed.",
+ ::osl::File::E_None, ::osl::File::getFileURLFromSystemPath( ::rtl::OUString::createFromAscii( pw_dir ), strHomeDirectory ) );
/// get config directory;
strConfigDirectory = strHomeDirectory.copy(0);
diff --git a/sal/qa/rtl/crc32/rtl_crc32.cxx b/sal/qa/rtl/crc32/rtl_crc32.cxx
index 03e1f98..398dc2d 100644
--- a/sal/qa/rtl/crc32/rtl_crc32.cxx
+++ b/sal/qa/rtl/crc32/rtl_crc32.cxx
@@ -44,7 +44,7 @@ public:
nCRC = rtl_crc32(nCRC, buf, num);
- CPPUNIT_ASSERT_MESSAGE("empty crc buffer", nCRC == 0);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("empty crc buffer", static_cast<sal_uInt32>(0), nCRC);
}
void rtl_crc32_002()
@@ -111,7 +111,7 @@ public:
nCRC2 = rtl_crc32(nCRC2, buf2, num2);
- CPPUNIT_ASSERT_MESSAGE("checksum leave it's bounds", nCRC1 == nCRC2);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("checksum leave it's bounds", nCRC2, nCRC1);
}
/** check if the crc32 differ at same content in reverse order
diff --git a/sal/qa/rtl/locale/rtl_locale.cxx b/sal/qa/rtl/locale/rtl_locale.cxx
index 0f7f2b2..7515719 100644
--- a/sal/qa/rtl/locale/rtl_locale.cxx
+++ b/sal/qa/rtl/locale/rtl_locale.cxx
@@ -108,13 +108,13 @@ public:
{
rtl_Locale* pData = rtl_locale_getDefault();
rtl::OUString suLanguage = pData->Language;
- CPPUNIT_ASSERT_MESSAGE( "locale language must be 'de'", suLanguage == "de" );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "locale language must be 'de'", OUString("de"), suLanguage );
}
void getLanguage_002()
{
rtl_Locale* pData = rtl_locale_getDefault();
rtl::OUString suLanguage(rtl_locale_getLanguage(pData), SAL_NO_ACQUIRE);
- CPPUNIT_ASSERT_MESSAGE( "locale language must be 'de'", suLanguage == "de" );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "locale language must be 'de'", OUString("de"), suLanguage );
}
// Change the following lines only, if you add, remove or rename
@@ -142,13 +142,13 @@ public:
{
rtl_Locale* pData = rtl_locale_getDefault();
rtl::OUString suCountry = pData->Country;
- CPPUNIT_ASSERT_MESSAGE( "locale country must be 'DE'", suCountry == "DE" );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "locale country must be 'DE'", OUString("DE"), suCountry );
}
void getCountry_002()
{
rtl_Locale* pData = rtl_locale_getDefault();
rtl::OUString suCountry(rtl_locale_getCountry(pData), SAL_NO_ACQUIRE);
- CPPUNIT_ASSERT_MESSAGE( "locale country must be 'DE'", suCountry == "DE" );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "locale country must be 'DE'", OUString("DE"), suCountry );
}
// Change the following lines only, if you add, remove or rename
@@ -176,13 +176,13 @@ public:
{
rtl_Locale* pData = rtl_locale_getDefault();
rtl::OUString suVariant = pData->Variant;
- CPPUNIT_ASSERT_MESSAGE( "locale variant must be 'hochdeutsch'", suVariant == "hochdeutsch" );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "locale variant must be 'hochdeutsch'", OUString("hochdeutsch"), suVariant );
}
void getVariant_002()
{
rtl_Locale* pData = rtl_locale_getDefault();
rtl::OUString suVariant(rtl_locale_getVariant(pData), SAL_NO_ACQUIRE);
- CPPUNIT_ASSERT_MESSAGE( "locale variant must be 'hochdeutsch'", suVariant == "hochdeutsch" );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "locale variant must be 'hochdeutsch'", OUString("hochdeutsch"), suVariant );
}
// Change the following lines only, if you add, remove or rename
diff --git a/sal/qa/rtl/process/rtl_Process.cxx b/sal/qa/rtl/process/rtl_Process.cxx
index c7a70ce..f2b39e5 100644
--- a/sal/qa/rtl/process/rtl_Process.cxx
+++ b/sal/qa/rtl/process/rtl_Process.cxx
@@ -107,10 +107,10 @@ public:
0,
&hProcess );
- CPPUNIT_ASSERT_MESSAGE
+ CPPUNIT_ASSERT_EQUAL_MESSAGE
(
"osl_createProcess failed",
- osl_error == osl_Process_E_None
+ osl_Process_E_None, osl_error
);
//we could get return value only after the process terminated
osl_joinProcess(hProcess);
@@ -124,14 +124,14 @@ public:
//you will get unknown error when call osl_getProcessInfo
pInfo->Size = sizeof(oslProcessInfo);
osl_error = osl_getProcessInfo( hProcess, osl_Process_EXITCODE, pInfo );
- CPPUNIT_ASSERT_MESSAGE
+ CPPUNIT_ASSERT_EQUAL_MESSAGE
(
"osl_getProcessInfo returned with failure",
- osl_Process_E_None == osl_error
+ osl_error, osl_Process_E_None
);
printf("the exit code is %" SAL_PRIuUINT32 ".\n", pInfo->Code );
- CPPUNIT_ASSERT_MESSAGE("rtl_getAppCommandArg or rtl_getAppCommandArgCount error.", pInfo->Code == 2);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("rtl_getAppCommandArg or rtl_getAppCommandArgCount error.", static_cast<oslProcessExitCode>(2), pInfo->Code);
delete pInfo;
}
@@ -229,10 +229,10 @@ public:
pChildOutputRead,
nullptr);
- CPPUNIT_ASSERT_MESSAGE
+ CPPUNIT_ASSERT_EQUAL_MESSAGE
(
"osl_createProcess failed",
- osl_error == osl_Process_E_None
+ osl_Process_E_None, osl_error
);
//we could get return value only after the process terminated
osl_joinProcess(hProcess);
diff --git a/sal/qa/rtl/random/rtl_random.cxx b/sal/qa/rtl/random/rtl_random.cxx
index 2adafa5..14421d6 100644
--- a/sal/qa/rtl/random/rtl_random.cxx
+++ b/sal/qa/rtl/random/rtl_random.cxx
@@ -102,13 +102,13 @@ public:
memset(pBuffer, 0, nBufLen);
rtlRandomError aError = rtl_random_addBytes(nullptr, nullptr, 0);
- CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_Argument);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong parameter", rtl_Random_E_Argument, aError);
/* rtlRandomError */ aError = rtl_random_addBytes(aPool, nullptr, 0);
- CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_Argument);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong parameter", rtl_Random_E_Argument, aError);
/* rtlRandomError */ aError = rtl_random_addBytes(aPool, pBuffer, nBufLen);
- CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_None);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong parameter", rtl_Random_E_None, aError);
rtl_random_destroyPool(aPool);
delete [] pBuffer;
@@ -225,13 +225,13 @@ public:
memset(pBuffer, 0, nBufLen);
rtlRandomError aError = rtl_random_getBytes(nullptr, nullptr, 0);
- CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_Argument);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong parameter", rtl_Random_E_Argument, aError);
/* rtlRandomError */ aError = rtl_random_getBytes(aPool, nullptr, 0);
- CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_Argument);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong parameter", rtl_Random_E_Argument, aError);
/* rtlRandomError */ aError = rtl_random_getBytes(aPool, pBuffer, nBufLen);
- CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_None);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong parameter", rtl_Random_E_None, aError);
rtl_random_destroyPool(aPool);
delete [] pBuffer;
@@ -246,7 +246,7 @@ public:
memset(pBuffer, 0, nBufLen);
rtlRandomError aError = rtl_random_getBytes(aPool, pBuffer, nBufLen);
- CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_None);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong parameter", rtl_Random_E_None, aError);
printf("%2x %2x %2x %2x\n", pBuffer[0], pBuffer[1], pBuffer[2], pBuffer[3]);
@@ -265,7 +265,7 @@ public:
CPPUNIT_ASSERT_MESSAGE("memset failed", pBuffer[4] == 0 && pBuffer[5] == 0 && pBuffer[6] == 0 && pBuffer[7] == 0);
rtlRandomError aError = rtl_random_getBytes(aPool, pBuffer, nBufLen);
- CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_None);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("wrong parameter", rtl_Random_E_None, aError);
printf("%2x %2x %2x %2x %2x %2x %2x %2x\n", pBuffer[0], pBuffer[1], pBuffer[2], pBuffer[3], pBuffer[4], pBuffer[5], pBuffer[6], pBuffer[7]);
@@ -285,7 +285,7 @@ public:
Statistics aStat;
- CPPUNIT_ASSERT_MESSAGE("memset failed", pBuffer[0] == 0);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("memset failed", static_cast<sal_uInt8>(0), pBuffer[0]);
int nCount = 0;
@@ -317,7 +317,7 @@ public:
Statistics aStat;
- CPPUNIT_ASSERT_MESSAGE("memset failed", pBuffer[0] == 0);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("memset failed", static_cast<sal_uInt8>(0), pBuffer[0]);
int nCount = 0;
More information about the Libreoffice-commits
mailing list