sal/qa/rtl/cipher/makefile.mk | 29 sal/qa/rtl/cipher/rtl_cipher.cxx | 879 ++--- sal/qa/rtl/process/makefile.mk | 29 sal/qa/rtl/process/rtl_Process.cxx | 228 - sal/qa/rtl/random/makefile.mk | 27 sal/qa/rtl/random/rtl_random.cxx | 379 +- sal/qa/rtl/strings/makefile.mk | 23 sal/qa/rtl/strings/test_oustring_compare.cxx | 34 sal/qa/rtl/strings/test_oustring_convert.cxx | 37 sal/qa/rtl/strings/test_oustring_endswith.cxx | 33 sal/qa/rtl/strings/test_oustring_noadditional.cxx | 8 sal/qa/rtl/strings/test_oustringbuffer_utf32.cxx | 51 sal/qa/rtl/textenc/makefile.mk | 40 sal/qa/rtl/textenc/rtl_tencinfo.cxx | 3274 ++++++++++------------ sal/qa/rtl/textenc/rtl_textcvt.cxx | 138 15 files changed, 2340 insertions(+), 2869 deletions(-)
New commits: commit dfebf9b443ac5981136be78725ae6b74d3351ec2 Author: Damjan Jovanovic <dam...@apache.org> Date: Tue Sep 1 17:36:36 2015 +0000 #i125003# migrate main/sal/qa/rtl/process from cppunit to Google Test. diff --git a/sal/qa/rtl/process/makefile.mk b/sal/qa/rtl/process/makefile.mk index 6703f72..acb40ee 100644 --- a/sal/qa/rtl/process/makefile.mk +++ b/sal/qa/rtl/process/makefile.mk @@ -33,25 +33,26 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk +.IF "$(ENABLE_UNIT_TESTS)" != "YES" +all: + @echo unit tests are disabled. Nothing to do. + +.ELSE + + CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) -CFLAGSCXX += $(CPPUNIT_CFLAGS) - # BEGIN ---------------------------------------------------------------- # auto generated Target:joblist by codegen.pl -SHL1OBJS= \ +APP1OBJS= \ $(SLO)$/rtl_Process.obj -SHL1TARGET= rtl_Process -SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB) - -SHL1IMPLIB= i$(SHL1TARGET) -# SHL1DEF= $(MISC)$/$(SHL1TARGET).def +APP1TARGET= rtl_Process +APP1STDLIBS= $(SALLIB) $(GTESTLIB) $(TESTSHL2LIB) +APP1RPATH = NONE +APP1TEST = enabled -DEF1NAME =$(SHL1TARGET) -# DEF1EXPORTFILE= export.exp -SHL1VERSIONMAP= $(PRJ)$/qa$/export.map # END ------------------------------------------------------------------ OBJ3FILES=$(OBJ)$/child_process.obj @@ -78,12 +79,8 @@ APP4OBJS=$(OBJ4FILES) # .ENDIF APP4STDLIBS=$(SALLIB) -#------------------------------- All object files ------------------------------- -# do this here, so we get right dependencies -SLOFILES=$(SHL1OBJS) - # --- Targets ------------------------------------------------------ .INCLUDE : target.mk -.INCLUDE : _cppunit.mk +.ENDIF # "$(ENABLE_UNIT_TESTS)" != "YES" diff --git a/sal/qa/rtl/process/rtl_Process.cxx b/sal/qa/rtl/process/rtl_Process.cxx index e6d273c..f8883ae 100644 --- a/sal/qa/rtl/process/rtl_Process.cxx +++ b/sal/qa/rtl/process/rtl_Process.cxx @@ -29,7 +29,7 @@ #include <string.h> #include <sal/types.h> -#include <testshl/simpleheader.hxx> +#include "gtest/gtest.h" #include <rtl/ustring.hxx> #include <rtl/string.hxx> #include <rtl/process.h> @@ -47,11 +47,11 @@ inline void printUString( const ::rtl::OUString & str, const sal_Char * msg = NU { if ( msg != NULL ) { - t_print("#%s #printUString_u# ", msg ); + printf("#%s #printUString_u# ", msg ); } rtl::OString aString; aString = ::rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US ); - t_print("%s\n", (char *)aString.getStr( ) ); + printf("%s\n", (char *)aString.getStr( ) ); } // ----------------------------------------------------------------------------- @@ -72,90 +72,76 @@ inline ::rtl::OUString getModulePath( void ) namespace rtl_Process { -class getAppCommandArg : public CppUnit::TestFixture +class getAppCommandArg : public ::testing::Test { public: // initialise your test code values here. - void setUp() + void SetUp() { } - void tearDown() + void TearDown() { } +}; // class getAppCommandArg - void getAppCommandArg_001() - { +TEST_F(getAppCommandArg, getAppCommandArg_001) +{ #if defined(WNT) || defined(OS2) const rtl::OUString EXECUTABLE_NAME = rtl::OUString::createFromAscii("child_process.exe"); #else const rtl::OUString EXECUTABLE_NAME = rtl::OUString::createFromAscii("child_process"); #endif - rtl::OUString suCWD = getModulePath(); - // rtl::OUString suCWD2 = getExecutableDirectory(); - - printUString(suCWD, "path to the current module"); - // printUString(suCWD2, "suCWD2"); - - oslProcess hProcess = NULL; - - const int nParameterCount = 4; - rtl_uString* pParameters[ nParameterCount ]; - - pParameters[0] = suParam0.pData; - pParameters[1] = suParam1.pData; - pParameters[2] = suParam2.pData; - pParameters[3] = suParam3.pData; - - rtl::OUString suFileURL = suCWD; - suFileURL += rtl::OUString::createFromAscii("/"); - suFileURL += EXECUTABLE_NAME; - - oslProcessError osl_error = osl_executeProcess( - suFileURL.pData, - pParameters, - nParameterCount, - osl_Process_WAIT, - 0, /* osl_getCurrentSecurity() */ - suCWD.pData, - NULL, - 0, - &hProcess ); - - CPPUNIT_ASSERT_MESSAGE - ( - "osl_createProcess failed", - osl_error == osl_Process_E_None - ); + rtl::OUString suCWD = getModulePath(); + // rtl::OUString suCWD2 = getExecutableDirectory(); + + printUString(suCWD, "path to the current module"); + // printUString(suCWD2, "suCWD2"); + + oslProcess hProcess = NULL; + + const int nParameterCount = 4; + rtl_uString* pParameters[ nParameterCount ]; + + pParameters[0] = suParam0.pData; + pParameters[1] = suParam1.pData; + pParameters[2] = suParam2.pData; + pParameters[3] = suParam3.pData; + + rtl::OUString suFileURL = suCWD; + suFileURL += rtl::OUString::createFromAscii("/"); + suFileURL += EXECUTABLE_NAME; + + oslProcessError osl_error = osl_executeProcess( + suFileURL.pData, + pParameters, + nParameterCount, + osl_Process_WAIT, + 0, /* osl_getCurrentSecurity() */ + suCWD.pData, + NULL, + 0, + &hProcess ); + + ASSERT_TRUE(osl_error == osl_Process_E_None) << + "osl_createProcess failed"; //we could get return value only after the process terminated - osl_joinProcess(hProcess); - // CPPUNIT_ASSERT_MESSAGE - // ( - // "osl_joinProcess returned with failure", - // osl_Process_E_None == osl_error - // ); + osl_joinProcess(hProcess); + // ASSERT_TRUE(osl_Process_E_None == osl_error) + // << "osl_joinProcess returned with failure"; oslProcessInfo* pInfo = new oslProcessInfo; //please pay attention to initial the Size to sizeof(oslProcessInfo), or else //you will get unknow error when call osl_getProcessInfo pInfo->Size = sizeof(oslProcessInfo); osl_error = osl_getProcessInfo( hProcess, osl_Process_EXITCODE, pInfo ); - CPPUNIT_ASSERT_MESSAGE - ( - "osl_getProcessInfo returned with failure", - osl_Process_E_None == osl_error - ); - - t_print("the exit code is %d.\n", pInfo->Code ); - CPPUNIT_ASSERT_MESSAGE("rtl_getAppCommandArg or rtl_getAppCommandArgCount error.", pInfo->Code == 2); - delete pInfo; - } + ASSERT_TRUE(osl_Process_E_None == osl_error) + << "osl_getProcessInfo returned with failure"; + printf("the exit code is %d.\n", pInfo->Code ); + ASSERT_TRUE(pInfo->Code == 2) << "rtl_getAppCommandArg or rtl_getAppCommandArgCount error."; + delete pInfo; +} - CPPUNIT_TEST_SUITE(getAppCommandArg); - CPPUNIT_TEST(getAppCommandArg_001); - // CPPUNIT_TEST(getAppCommandArg_002); - CPPUNIT_TEST_SUITE_END(); -}; // class getAppCommandArg /************************************************************************ * For diagnostics( from sal/test/testuuid.cxx ) @@ -200,93 +186,83 @@ void printUuidtoBuffer( sal_uInt8 *pNode, sal_Char * pBuffer ) } } -class getGlobalProcessId : public CppUnit::TestFixture +class getGlobalProcessId : public ::testing::Test { public: // initialise your test code values here. - void setUp() + void SetUp() { } - void tearDown() + void TearDown() { } - //gets a 16-byte fixed size identifier which is guaranteed not to change during the current process. - void getGlobalProcessId_001() - { - sal_uInt8 pTargetUUID1[16]; - sal_uInt8 pTargetUUID2[16]; - rtl_getGlobalProcessId( pTargetUUID1 ); - rtl_getGlobalProcessId( pTargetUUID2 ); - CPPUNIT_ASSERT_MESSAGE("getGlobalProcessId: got two same ProcessIds.", !memcmp( pTargetUUID1 , pTargetUUID2 , 16 ) ); - } - //different processes different pids - void getGlobalProcessId_002() - { +}; // class getGlobalProcessId + +//gets a 16-byte fixed size identifier which is guaranteed not to change during the current process. +TEST_F(getGlobalProcessId, getGlobalProcessId_001) +{ + sal_uInt8 pTargetUUID1[16]; + sal_uInt8 pTargetUUID2[16]; + rtl_getGlobalProcessId( pTargetUUID1 ); + rtl_getGlobalProcessId( pTargetUUID2 ); + ASSERT_TRUE( !memcmp( pTargetUUID1 , pTargetUUID2 , 16 ) ) + << "getGlobalProcessId: got two same ProcessIds."; +} + +//different processes different pids +TEST_F(getGlobalProcessId, getGlobalProcessId_002) +{ #if defined(WNT) || defined(OS2) const rtl::OUString EXEC_NAME = rtl::OUString::createFromAscii("child_process_id.exe"); #else const rtl::OUString EXEC_NAME = rtl::OUString::createFromAscii("child_process_id"); #endif - sal_uInt8 pTargetUUID1[16]; - rtl_getGlobalProcessId( pTargetUUID1 ); - printUuid( pTargetUUID1 ); - sal_Char pUUID1[32]; - printUuidtoBuffer( pTargetUUID1, pUUID1 ); + sal_uInt8 pTargetUUID1[16]; + rtl_getGlobalProcessId( pTargetUUID1 ); + printUuid( pTargetUUID1 ); + sal_Char pUUID1[32]; + printUuidtoBuffer( pTargetUUID1, pUUID1 ); printf("# UUID to String is %s\n", pUUID1); rtl::OUString suCWD = getModulePath(); - oslProcess hProcess = NULL; - rtl::OUString suFileURL = suCWD; - suFileURL += rtl::OUString::createFromAscii("/"); - suFileURL += EXEC_NAME; + oslProcess hProcess = NULL; + rtl::OUString suFileURL = suCWD; + suFileURL += rtl::OUString::createFromAscii("/"); + suFileURL += EXEC_NAME; oslFileHandle* pChildOutputRead = new oslFileHandle(); - oslProcessError osl_error = osl_executeProcess_WithRedirectedIO( - suFileURL.pData, - NULL, - 0, - osl_Process_WAIT, - 0, - suCWD.pData, - NULL, - 0, - &hProcess, + oslProcessError osl_error = osl_executeProcess_WithRedirectedIO( + suFileURL.pData, + NULL, + 0, + osl_Process_WAIT, + 0, + suCWD.pData, + NULL, + 0, + &hProcess, NULL, pChildOutputRead, NULL); - CPPUNIT_ASSERT_MESSAGE - ( - "osl_createProcess failed", - osl_error == osl_Process_E_None - ); + ASSERT_TRUE(osl_error == osl_Process_E_None) + << "osl_createProcess failed"; //we could get return value only after the process terminated - osl_joinProcess(hProcess); + osl_joinProcess(hProcess); - sal_Char pUUID2[33]; - pUUID2[32] = '\0'; + sal_Char pUUID2[33]; + pUUID2[32] = '\0'; sal_uInt64 nRead = 0; osl_readFile( *pChildOutputRead, pUUID2, 32, &nRead ); - t_print("read buffer is %s, nRead is %d \n", pUUID2, nRead ); + printf("read buffer is %s, nRead is %lu \n", pUUID2, nRead ); OUString suUUID2 = OUString::createFromAscii( pUUID2 ); - CPPUNIT_ASSERT_MESSAGE("getGlobalProcessId: got two same ProcessIds.", suUUID2.equalsAsciiL( pUUID1, 32) == sal_False ); - } - - CPPUNIT_TEST_SUITE(getGlobalProcessId); - CPPUNIT_TEST(getGlobalProcessId_001); - CPPUNIT_TEST(getGlobalProcessId_002); - CPPUNIT_TEST_SUITE_END(); - -}; // class getGlobalProcessId + ASSERT_TRUE( suUUID2.equalsAsciiL( pUUID1, 32) == sal_False ) << "getGlobalProcessId: got two same ProcessIds."; +} } // namespace rtl_Process -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_Process::getAppCommandArg, "rtl_Process"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_Process::getGlobalProcessId, "rtl_Process"); - - -// ----------------------------------------------------------------------------- - -// this macro creates an empty function, which will called by the RegisterAllFunctions() -// to let the user the possibility to also register some functions by hand. -NOADDITIONAL; +int main(int argc, char **argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} commit e2e16c0763ef5acb3a5c585e317007d6a3bfaeab Author: Damjan Jovanovic <dam...@apache.org> Date: Tue Sep 1 17:33:30 2015 +0000 #i125003# migrate main/sal/qa/rtl/random from cppunit to Google Test. diff --git a/sal/qa/rtl/random/makefile.mk b/sal/qa/rtl/random/makefile.mk index 5b3396a..5350d7d 100644 --- a/sal/qa/rtl/random/makefile.mk +++ b/sal/qa/rtl/random/makefile.mk @@ -31,30 +31,31 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk +.IF "$(ENABLE_UNIT_TESTS)" != "YES" +all: + @echo unit tests are disabled. Nothing to do. + +.ELSE + + CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) -CFLAGSCXX += $(CPPUNIT_CFLAGS) - # BEGIN ---------------------------------------------------------------- # auto generated Target:job by codegen.pl -SHL1OBJS= \ +APP1OBJS= \ $(SLO)$/rtl_random.obj -SHL1TARGET= rtl_Random -SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB) +APP1TARGET= rtl_Random +APP1STDLIBS= $(SALLIB) $(GTESTLIB) $(TESTSHL2LIB) +APP1RPATH = NONE +APP1TEST = enabled -SHL1IMPLIB= i$(SHL1TARGET) -DEF1NAME =$(SHL1TARGET) -SHL1VERSIONMAP= $(PRJ)$/qa$/export.map # auto generated Target:job # END ------------------------------------------------------------------ -#------------------------------- All object files ------------------------------- -# do this here, so we get right dependencies -# SLOFILES=$(SHL1OBJS) - # --- Targets ------------------------------------------------------ .INCLUDE : target.mk -.INCLUDE : _cppunit.mk + +.ENDIF # "$(ENABLE_UNIT_TESTS)" != "YES" diff --git a/sal/qa/rtl/random/rtl_random.cxx b/sal/qa/rtl/random/rtl_random.cxx index d6d50ef..66d95a0 100644 --- a/sal/qa/rtl/random/rtl_random.cxx +++ b/sal/qa/rtl/random/rtl_random.cxx @@ -28,154 +28,120 @@ #include <algorithm> // STL -#include <testshl/simpleheader.hxx> +#include "gtest/gtest.h" #include <rtl/random.h> namespace rtl_random { -class createPool : public CppUnit::TestFixture +class createPool : public ::testing::Test { public: // initialise your test code values here. - void setUp() + void SetUp() { } - void tearDown() + void TearDown() { } +}; // class createPool - // insert your test code here. - // this is only demonstration code - void createPool_001() - { - // this is demonstration code - - rtlRandomPool aPool = rtl_random_createPool(); - - // LLA: seems to be that an other test is not possible for createPool() - CPPUNIT_ASSERT_MESSAGE("create failed", aPool != NULL); - - rtl_random_destroyPool(aPool); - } - - // Change the following lines only, if you add, remove or rename - // member functions of the current class, - // because these macros are need by auto register mechanism. +TEST_F(createPool, createPool_001) +{ + // this is demonstration code - CPPUNIT_TEST_SUITE(createPool); - CPPUNIT_TEST(createPool_001); - CPPUNIT_TEST_SUITE_END(); -}; // class createPool + rtlRandomPool aPool = rtl_random_createPool(); + // LLA: seems to be that an other test is not possible for createPool() + ASSERT_TRUE(aPool != NULL) << "create failed"; + rtl_random_destroyPool(aPool); +} -class destroyPool : public CppUnit::TestFixture +class destroyPool : public ::testing::Test { public: // initialise your test code values here. - void setUp() - { - } - - void tearDown() + void SetUp() { } - // insert your test code here. - void destroyPool_000() + void TearDown() { - // GPF, if failed - rtl_random_destroyPool(NULL); } +}; // class destroyPool - void destroyPool_001() - { - rtlRandomPool aPool = rtl_random_createPool(); +TEST_F(destroyPool, destroyPool_000) +{ + // GPF, if failed + rtl_random_destroyPool(NULL); +} - // LLA: seems to be that an other test is not possible for createPool() - CPPUNIT_ASSERT_MESSAGE("create failed", aPool != NULL); +TEST_F(destroyPool, destroyPool_001) +{ + rtlRandomPool aPool = rtl_random_createPool(); - rtl_random_destroyPool(aPool); - } - // Change the following lines only, if you add, remove or rename - // member functions of the current class, - // because these macros are need by auto register mechanism. - - CPPUNIT_TEST_SUITE(destroyPool); - CPPUNIT_TEST(destroyPool_000); - CPPUNIT_TEST(destroyPool_001); - CPPUNIT_TEST_SUITE_END(); -}; // class destroyPool + // LLA: seems to be that an other test is not possible for createPool() + ASSERT_TRUE(aPool != NULL) << "create failed"; + rtl_random_destroyPool(aPool); +} -class addBytes : public CppUnit::TestFixture +class addBytes : public ::testing::Test { public: // initialise your test code values here. - void setUp() + void SetUp() { } - void tearDown() + void TearDown() { } +}; // class addBytes - // insert your test code here. - // this is only demonstration code - void addBytes_000() - { - rtlRandomPool aPool = rtl_random_createPool(); - - sal_uInt32 nBufLen = 4; - sal_uInt8 *pBuffer = new sal_uInt8[ nBufLen ]; - memset(pBuffer, 0, nBufLen); - - rtlRandomError aError = rtl_random_addBytes(NULL, NULL, 0); - CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_Argument); - - /* rtlRandomError */ aError = rtl_random_addBytes(aPool, NULL, 0); - CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_Argument); - - /* rtlRandomError */ aError = rtl_random_addBytes(aPool, pBuffer, nBufLen); - CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_None); +TEST_F(addBytes, addBytes_000) +{ + rtlRandomPool aPool = rtl_random_createPool(); - rtl_random_destroyPool(aPool); - delete [] pBuffer; + sal_uInt32 nBufLen = 4; + sal_uInt8 *pBuffer = new sal_uInt8[ nBufLen ]; + memset(pBuffer, 0, nBufLen); - } + rtlRandomError aError = rtl_random_addBytes(NULL, NULL, 0); + ASSERT_TRUE(aError == rtl_Random_E_Argument) << "wrong parameter"; - void addBytes_001() - { - rtlRandomPool aPool = rtl_random_createPool(); + /* rtlRandomError */ aError = rtl_random_addBytes(aPool, NULL, 0); + ASSERT_TRUE(aError == rtl_Random_E_Argument) << "wrong parameter"; - sal_uInt32 nBufLen = 4; - sal_uInt8 *pBuffer = new sal_uInt8[ nBufLen ]; + /* rtlRandomError */ aError = rtl_random_addBytes(aPool, pBuffer, nBufLen); + ASSERT_TRUE(aError == rtl_Random_E_None) << "wrong parameter"; - memset(pBuffer, 0, nBufLen); + rtl_random_destroyPool(aPool); + delete [] pBuffer; - rtl_random_addBytes(aPool, pBuffer, nBufLen); +} - t_print("%2x %2x %2x %2x\n", pBuffer[0], pBuffer[1], pBuffer[2], pBuffer[3]); +TEST_F(addBytes, addBytes_001) +{ + rtlRandomPool aPool = rtl_random_createPool(); - rtl_random_destroyPool(aPool); - delete [] pBuffer; - } + sal_uInt32 nBufLen = 4; + sal_uInt8 *pBuffer = new sal_uInt8[ nBufLen ]; + memset(pBuffer, 0, nBufLen); - // Change the following lines only, if you add, remove or rename - // member functions of the current class, - // because these macros are need by auto register mechanism. + rtl_random_addBytes(aPool, pBuffer, nBufLen); - CPPUNIT_TEST_SUITE(addBytes); - CPPUNIT_TEST(addBytes_000); - CPPUNIT_TEST(addBytes_001); - CPPUNIT_TEST_SUITE_END(); -}; // class addBytes + printf("%2x %2x %2x %2x\n", pBuffer[0], pBuffer[1], pBuffer[2], pBuffer[3]); + rtl_random_destroyPool(aPool); + delete [] pBuffer; +} class Statistics { +protected: int m_nDispensation[256]; int m_nMin; @@ -200,7 +166,7 @@ public: void addValue(sal_Int16 _nIndex, sal_Int32 _nValue) { - OSL_ASSERT(_nIndex >= 0 && _nIndex < 256); + ASSERT_TRUE(_nIndex >= 0 && _nIndex < 256); m_nDispensation[_nIndex] += _nValue; } @@ -227,12 +193,12 @@ public: void print() { // LLA: these are only info values - t_print("\nSome statistics\n"); - t_print("Min: %d\n", m_nMin); - t_print("Max: %d\n", m_nMax); - t_print("Average: %d\n", m_nAverage); - t_print("Min abs deviation: %d\n", m_nMinDeviation); - t_print("Max abs deviation: %d\n", m_nMaxDeviation); + printf("\nSome statistics\n"); + printf("Min: %d\n", m_nMin); + printf("Max: %d\n", m_nMax); + printf("Average: %d\n", m_nAverage); + printf("Min abs deviation: %d\n", m_nMinDeviation); + printf("Max abs deviation: %d\n", m_nMaxDeviation); } sal_Int32 getAverage() {return m_nAverage;} @@ -240,169 +206,150 @@ public: }; -class getBytes : public CppUnit::TestFixture +class getBytes : public ::testing::Test { public: // initialise your test code values here. - void setUp() + void SetUp() { } - void tearDown() + void TearDown() { } +}; // class getBytes - // insert your test code here. - void getBytes_000() - { - rtlRandomPool aPool = rtl_random_createPool(); - - sal_uInt32 nBufLen = 4; - sal_uInt8 *pBuffer = new sal_uInt8[ nBufLen ]; - memset(pBuffer, 0, nBufLen); - - rtlRandomError aError = rtl_random_getBytes(NULL, NULL, 0); - CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_Argument); - - /* rtlRandomError */ aError = rtl_random_getBytes(aPool, NULL, 0); - CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_Argument); +TEST_F(getBytes, getBytes_000) +{ + rtlRandomPool aPool = rtl_random_createPool(); - /* rtlRandomError */ aError = rtl_random_getBytes(aPool, pBuffer, nBufLen); - CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_None); + sal_uInt32 nBufLen = 4; + sal_uInt8 *pBuffer = new sal_uInt8[ nBufLen ]; + memset(pBuffer, 0, nBufLen); - rtl_random_destroyPool(aPool); - delete [] pBuffer; - } + rtlRandomError aError = rtl_random_getBytes(NULL, NULL, 0); + ASSERT_TRUE(aError == rtl_Random_E_Argument) << "wrong parameter"; - void getBytes_001() - { - rtlRandomPool aPool = rtl_random_createPool(); + /* rtlRandomError */ aError = rtl_random_getBytes(aPool, NULL, 0); + ASSERT_TRUE(aError == rtl_Random_E_Argument) << "wrong parameter"; - sal_uInt32 nBufLen = 4; - sal_uInt8 *pBuffer = new sal_uInt8[ nBufLen ]; - memset(pBuffer, 0, nBufLen); + /* rtlRandomError */ aError = rtl_random_getBytes(aPool, pBuffer, nBufLen); + ASSERT_TRUE(aError == rtl_Random_E_None) << "wrong parameter"; - rtlRandomError aError = rtl_random_getBytes(aPool, pBuffer, nBufLen); - CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_None); + rtl_random_destroyPool(aPool); + delete [] pBuffer; +} - t_print("%2x %2x %2x %2x\n", pBuffer[0], pBuffer[1], pBuffer[2], pBuffer[3]); +TEST_F(getBytes, getBytes_001) +{ + rtlRandomPool aPool = rtl_random_createPool(); - rtl_random_destroyPool(aPool); - delete [] pBuffer; - } + sal_uInt32 nBufLen = 4; + sal_uInt8 *pBuffer = new sal_uInt8[ nBufLen ]; + memset(pBuffer, 0, nBufLen); - void getBytes_002() - { - rtlRandomPool aPool = rtl_random_createPool(); + rtlRandomError aError = rtl_random_getBytes(aPool, pBuffer, nBufLen); + ASSERT_TRUE(aError == rtl_Random_E_None) << "wrong parameter"; - sal_uInt32 nBufLen = 4; - sal_uInt8 *pBuffer = new sal_uInt8[ nBufLen << 1 ]; - memset(pBuffer, 0, nBufLen << 1); + printf("%2x %2x %2x %2x\n", pBuffer[0], pBuffer[1], pBuffer[2], pBuffer[3]); - CPPUNIT_ASSERT_MESSAGE("memset failed", pBuffer[4] == 0 && pBuffer[5] == 0 && pBuffer[6] == 0 && pBuffer[7] == 0); + rtl_random_destroyPool(aPool); + delete [] pBuffer; +} - rtlRandomError aError = rtl_random_getBytes(aPool, pBuffer, nBufLen); - CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_None); +TEST_F(getBytes, getBytes_002) +{ + rtlRandomPool aPool = rtl_random_createPool(); - t_print("%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]); + sal_uInt32 nBufLen = 4; + sal_uInt8 *pBuffer = new sal_uInt8[ nBufLen << 1 ]; + memset(pBuffer, 0, nBufLen << 1); - CPPUNIT_ASSERT_MESSAGE("internal memory overwrite", pBuffer[4] == 0 && pBuffer[5] == 0 && pBuffer[6] == 0 && pBuffer[7] == 0); + ASSERT_TRUE(pBuffer[4] == 0 && pBuffer[5] == 0 && pBuffer[6] == 0 && pBuffer[7] == 0) << "memset failed"; - rtl_random_destroyPool(aPool); - delete [] pBuffer; - } + rtlRandomError aError = rtl_random_getBytes(aPool, pBuffer, nBufLen); + ASSERT_TRUE(aError == rtl_Random_E_None) << "wrong parameter"; - void getBytes_003() - { - rtlRandomPool aPool = rtl_random_createPool(); + 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]); - sal_uInt32 nBufLen = 1; - sal_uInt8 *pBuffer = new sal_uInt8[ nBufLen ]; - memset(pBuffer, 0, nBufLen); + ASSERT_TRUE(pBuffer[4] == 0 && pBuffer[5] == 0 && pBuffer[6] == 0 && pBuffer[7] == 0) << "internal memory overwrite"; - Statistics aStat; + rtl_random_destroyPool(aPool); + delete [] pBuffer; +} - CPPUNIT_ASSERT_MESSAGE("memset failed", pBuffer[0] == 0); +TEST_F(getBytes, getBytes_003) +{ + rtlRandomPool aPool = rtl_random_createPool(); - int nCount = 0; + sal_uInt32 nBufLen = 1; + sal_uInt8 *pBuffer = new sal_uInt8[ nBufLen ]; + memset(pBuffer, 0, nBufLen); - int nCountMax = 1000000; - for(nCount = 0;nCount < nCountMax; nCount ++) // run 100000000 through getBytes(...) - { - /* rtlRandomError aError = */ rtl_random_getBytes(aPool, pBuffer, nBufLen); - /* CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_None); */ + Statistics aStat; - aStat.addValue(pBuffer[0], 1); - } + ASSERT_TRUE(pBuffer[0] == 0) << "memset failed"; - aStat.build(nCountMax); - aStat.print(); + int nCount = 0; - CPPUNIT_ASSERT_MESSAGE("deviation should be less average", aStat.getMaxDeviation() < aStat.getAverage()); + int nCountMax = 1000000; + for(nCount = 0;nCount < nCountMax; nCount ++) // run 100000000 through getBytes(...) + { + /* rtlRandomError aError = */ rtl_random_getBytes(aPool, pBuffer, nBufLen); + /* ASSERT_TRUE(aError == rtl_Random_E_None); << "wrong parameter" */ - rtl_random_destroyPool(aPool); - delete [] pBuffer; + aStat.addValue(pBuffer[0], 1); } - void getBytes_003_1() - { - rtlRandomPool aPool = rtl_random_createPool(); + aStat.build(nCountMax); + aStat.print(); - sal_uInt32 nBufLen = 256; - sal_uInt8 *pBuffer = new sal_uInt8[ nBufLen ]; - memset(pBuffer, 0, nBufLen); + ASSERT_TRUE(aStat.getMaxDeviation() < aStat.getAverage()) << "deviation should be less average"; - Statistics aStat; + rtl_random_destroyPool(aPool); + delete [] pBuffer; +} - CPPUNIT_ASSERT_MESSAGE("memset failed", pBuffer[0] == 0); +TEST_F(getBytes, getBytes_003_1) +{ + rtlRandomPool aPool = rtl_random_createPool(); - int nCount = 0; + sal_uInt32 nBufLen = 256; + sal_uInt8 *pBuffer = new sal_uInt8[ nBufLen ]; + memset(pBuffer, 0, nBufLen); - int nCountMax = 10000; - for(nCount = 0;nCount < nCountMax; nCount ++) // run 100000000 through getBytes(...) - { - /* rtlRandomError aError = */ rtl_random_getBytes(aPool, pBuffer, nBufLen); - // CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_None); + Statistics aStat; - for (sal_uInt32 i=0;i<nBufLen;i++) - { - aStat.addValue(pBuffer[i], 1); - } - } + ASSERT_TRUE(pBuffer[0] == 0) << "memset failed"; - aStat.build(nCountMax * nBufLen); - aStat.print(); + int nCount = 0; - CPPUNIT_ASSERT_MESSAGE("deviation should be less average", aStat.getMaxDeviation() < aStat.getAverage()); + int nCountMax = 10000; + for(nCount = 0;nCount < nCountMax; nCount ++) // run 100000000 through getBytes(...) + { + /* rtlRandomError aError = */ rtl_random_getBytes(aPool, pBuffer, nBufLen); + // ASSERT_TRUE(aError == rtl_Random_E_None) << "wrong parameter""; - rtl_random_destroyPool(aPool); - delete [] pBuffer; + for (sal_uInt32 i=0;i<nBufLen;i++) + { + aStat.addValue(pBuffer[i], 1); + } } - // Change the following lines only, if you add, remove or rename - // member functions of the current class, - // because these macros are need by auto register mechanism. - - CPPUNIT_TEST_SUITE(getBytes); - CPPUNIT_TEST(getBytes_000); - CPPUNIT_TEST(getBytes_001); - CPPUNIT_TEST(getBytes_002); - CPPUNIT_TEST(getBytes_003); - CPPUNIT_TEST(getBytes_003_1); - CPPUNIT_TEST_SUITE_END(); -}; // class getBytes + aStat.build(nCountMax * nBufLen); + aStat.print(); -// ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_random::createPool, "rtl_random"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_random::destroyPool, "rtl_random"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_random::addBytes, "rtl_random"); -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_random::getBytes, "rtl_random"); -} // namespace rtl_random + ASSERT_TRUE(aStat.getMaxDeviation() < aStat.getAverage()) << "deviation should be less average"; + rtl_random_destroyPool(aPool); + delete [] pBuffer; +} // ----------------------------------------------------------------------------- +} // namespace rtl_random -// this macro creates an empty function, which will called by the RegisterAllFunctions() -// to let the user the possibility to also register some functions by hand. -NOADDITIONAL; - +int main(int argc, char **argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} commit 55c58925d373604962704c843cbd876ed16df10a Author: Damjan Jovanovic <dam...@apache.org> Date: Tue Sep 1 16:55:04 2015 +0000 #i125003# migrate main/sal/qa/rtl/strings from cppunit to Google Test. Some tests fail, but they don't run during the build and there's no way they passed with cppunit either. diff --git a/sal/qa/rtl/strings/makefile.mk b/sal/qa/rtl/strings/makefile.mk index 927f5b1..e0d0cba 100644 --- a/sal/qa/rtl/strings/makefile.mk +++ b/sal/qa/rtl/strings/makefile.mk @@ -30,22 +30,27 @@ ENABLE_EXCEPTIONS := TRUE .INCLUDE: settings.mk +.IF "$(ENABLE_UNIT_TESTS)" != "YES" +all: + @echo unit tests are disabled. Nothing to do. + +.ELSE + + CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) -CFLAGSCXX += $(CPPUNIT_CFLAGS) - -SHL1TARGET := $(TARGET) -SHL1OBJS := \ +APP1TARGET := $(TARGET) +APP1OBJS := \ $(SLO)$/test_oustringbuffer_utf32.obj \ $(SLO)$/test_oustring_compare.obj \ $(SLO)$/test_oustring_convert.obj \ $(SLO)$/test_oustring_endswith.obj \ $(SLO)$/test_oustring_noadditional.obj -SHL1IMPLIB := i$(SHL1TARGET) -SHL1STDLIBS := $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB) -SHL1VERSIONMAP := $(PRJ)$/qa$/export.map -DEF1NAME := $(SHL1TARGET) +APP1STDLIBS := $(SALLIB) $(GTESTLIB) $(TESTSHL2LIB) +APP1RPATH = NONE +APP1TEST = enabled .INCLUDE: target.mk -.INCLUDE : _cppunit.mk + +.ENDIF # "$(ENABLE_UNIT_TESTS)" != "YES" diff --git a/sal/qa/rtl/strings/test_oustring_compare.cxx b/sal/qa/rtl/strings/test_oustring_compare.cxx index be0b22b..bffc1ef 100644 --- a/sal/qa/rtl/strings/test_oustring_compare.cxx +++ b/sal/qa/rtl/strings/test_oustring_compare.cxx @@ -24,40 +24,34 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sal.hxx" -#include "testshl/simpleheader.hxx" +#include "gtest/gtest.h" #include "rtl/string.h" #include "rtl/ustring.hxx" namespace test { namespace oustring { -class Compare: public CppUnit::TestFixture +class Compare: public ::testing::Test { -private: - void equalsIgnoreAsciiCaseAscii(); - - CPPUNIT_TEST_SUITE(Compare); - CPPUNIT_TEST(equalsIgnoreAsciiCaseAscii); - CPPUNIT_TEST_SUITE_END(); }; -} } - -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test::oustring::Compare, "alltest"); - -void test::oustring::Compare::equalsIgnoreAsciiCaseAscii() +TEST_F(Compare, equalsIgnoreAsciiCaseAscii) { - CPPUNIT_ASSERT(!rtl::OUString().equalsIgnoreAsciiCaseAscii("abc")); - CPPUNIT_ASSERT(!rtl::OUString().equalsIgnoreAsciiCaseAsciiL( + ASSERT_TRUE(!rtl::OUString().equalsIgnoreAsciiCaseAscii("abc")); + ASSERT_TRUE(!rtl::OUString().equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM("abc"))); - CPPUNIT_ASSERT(!rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("abc")). + ASSERT_TRUE(!rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("abc")). equalsIgnoreAsciiCaseAscii("")); - CPPUNIT_ASSERT(!rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("abc")). + ASSERT_TRUE(!rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("abc")). equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM(""))); - CPPUNIT_ASSERT(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("abc")). + ASSERT_TRUE(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("abc")). equalsIgnoreAsciiCaseAscii("abc")); - CPPUNIT_ASSERT(!rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("abcd")). + ASSERT_TRUE(!rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("abcd")). equalsIgnoreAsciiCaseAscii("abc")); - CPPUNIT_ASSERT(!rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("abc")). + ASSERT_TRUE(!rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("abc")). equalsIgnoreAsciiCaseAscii("abcd")); } + +} } + + diff --git a/sal/qa/rtl/strings/test_oustring_convert.cxx b/sal/qa/rtl/strings/test_oustring_convert.cxx index 76fdf9a..7e7ed19 100644 --- a/sal/qa/rtl/strings/test_oustring_convert.cxx +++ b/sal/qa/rtl/strings/test_oustring_convert.cxx @@ -24,26 +24,11 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sal.hxx" -#include "testshl/simpleheader.hxx" +#include "gtest/gtest.h" #include "rtl/strbuf.hxx" #include "rtl/string.hxx" #include "rtl/ustring.hxx" -namespace test { namespace oustring { - -class Convert: public CppUnit::TestFixture -{ -private: - void convertToString(); - - CPPUNIT_TEST_SUITE(Convert); - CPPUNIT_TEST(convertToString); - CPPUNIT_TEST_SUITE_END(); -}; - -} } - -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test::oustring::Convert, "alltest"); namespace { @@ -89,7 +74,7 @@ void testConvertToString(TestConvertToString const & rTest) aMessage.append(RTL_CONSTASCII_STRINGPARAM("strict = \"")); aMessage.append(aStrict); aMessage.append(RTL_CONSTASCII_STRINGPARAM("\"")); - CPPUNIT_ASSERT_MESSAGE(aMessage.getStr(), false); + FAIL() << aMessage.getStr(); } } else @@ -98,13 +83,13 @@ void testConvertToString(TestConvertToString const & rTest) { rtl::OStringBuffer aMessage(aPrefix); aMessage.append(RTL_CONSTASCII_STRINGPARAM("modified output")); - CPPUNIT_ASSERT_MESSAGE(aMessage.getStr(), false); + FAIL() << aMessage.getStr(); } if (rTest.pStrict != 0) { rtl::OStringBuffer aMessage(aPrefix); aMessage.append(RTL_CONSTASCII_STRINGPARAM("failed")); - CPPUNIT_ASSERT_MESSAGE(aMessage.getStr(), false); + FAIL() << aMessage.getStr(); } } if (!aRelaxed.equals(rTest.pRelaxed)) @@ -113,13 +98,20 @@ void testConvertToString(TestConvertToString const & rTest) aMessage.append(RTL_CONSTASCII_STRINGPARAM("relaxed = \"")); aMessage.append(aRelaxed); aMessage.append(RTL_CONSTASCII_STRINGPARAM("\"")); - CPPUNIT_ASSERT_MESSAGE(aMessage.getStr(), false); + FAIL() << aMessage.getStr(); } } } -void test::oustring::Convert::convertToString() + +namespace test { namespace oustring { + +class Convert: public ::testing::Test +{ +}; + +TEST_F(Convert, convertToString) { TestConvertToString const aTests[] = { { { 0 }, @@ -178,3 +170,6 @@ void test::oustring::Convert::convertToString() for (unsigned int i = 0; i < sizeof aTests / sizeof aTests[0]; ++i) testConvertToString(aTests[i]); } + +} } + diff --git a/sal/qa/rtl/strings/test_oustring_endswith.cxx b/sal/qa/rtl/strings/test_oustring_endswith.cxx index b2da1e6..0b5207f 100644 --- a/sal/qa/rtl/strings/test_oustring_endswith.cxx +++ b/sal/qa/rtl/strings/test_oustring_endswith.cxx @@ -24,7 +24,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sal.hxx" -#include "testshl/simpleheader.hxx" +#include "gtest/gtest.h" #include "rtl/strbuf.hxx" #include "rtl/string.h" #include "rtl/string.hxx" @@ -32,21 +32,7 @@ #include "rtl/ustring.hxx" #include "sal/types.h" -namespace test { namespace oustring { - -class EndsWith: public CppUnit::TestFixture -{ -private: - void endsWith(); - - CPPUNIT_TEST_SUITE(EndsWith); - CPPUNIT_TEST(endsWith); - CPPUNIT_TEST_SUITE_END(); -}; - -} } -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test::oustring::EndsWith, "alltest"); namespace { @@ -72,7 +58,15 @@ void appendString(rtl::OStringBuffer & buffer, rtl::OString const & string) } -void test::oustring::EndsWith::endsWith() + + +namespace test { namespace oustring { + +class EndsWith: public ::testing::Test +{ +}; + +TEST_F(EndsWith, endsWith) { struct Data { char const * str1; @@ -106,12 +100,13 @@ void test::oustring::EndsWith::endsWith() appendString(msg, rtl::OString(data[i].str2, data[i].str2Len)); msg.append(RTL_CONSTASCII_STRINGPARAM(") == ")); msg.append(static_cast< sal_Bool >(data[i].endsWith)); - CPPUNIT_ASSERT_MESSAGE( - msg.getStr(), + ASSERT_TRUE( rtl::OUString( data[i].str1, data[i].str1Len, RTL_TEXTENCODING_ASCII_US).endsWithIgnoreAsciiCaseAsciiL( data[i].str2, data[i].str2Len) - == data[i].endsWith); + == data[i].endsWith) << msg.getStr(); } } + +} } diff --git a/sal/qa/rtl/strings/test_oustring_noadditional.cxx b/sal/qa/rtl/strings/test_oustring_noadditional.cxx index a20cd68..942f641 100644 --- a/sal/qa/rtl/strings/test_oustring_noadditional.cxx +++ b/sal/qa/rtl/strings/test_oustring_noadditional.cxx @@ -24,6 +24,10 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sal.hxx" -#include "testshl/simpleheader.hxx" +#include "gtest/gtest.h" -NOADDITIONAL; +int main(int argc, char **argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/sal/qa/rtl/strings/test_oustringbuffer_utf32.cxx b/sal/qa/rtl/strings/test_oustringbuffer_utf32.cxx index 5955efa..2a01d4f 100644 --- a/sal/qa/rtl/strings/test_oustringbuffer_utf32.cxx +++ b/sal/qa/rtl/strings/test_oustringbuffer_utf32.cxx @@ -24,29 +24,11 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sal.hxx" -#include "testshl/simpleheader.hxx" +#include "gtest/gtest.h" #include "rtl/ustrbuf.hxx" #include "rtl/ustring.h" #include "rtl/ustring.hxx" -namespace test { namespace oustringbuffer { - -class Utf32: public CppUnit::TestFixture { -private: - void appendUtf32(); - - void insertUtf32(); - - CPPUNIT_TEST_SUITE(Utf32); - CPPUNIT_TEST(appendUtf32); - CPPUNIT_TEST(insertUtf32); - CPPUNIT_TEST_SUITE_END(); -}; - -} } - -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(test::oustringbuffer::Utf32, "alltest"); - namespace { void appendString(rtl::OUStringBuffer & buffer, rtl::OUString const & string) { @@ -81,7 +63,13 @@ void createMessage( } -void test::oustringbuffer::Utf32::appendUtf32() { + +namespace test { namespace oustringbuffer { + +class Utf32: public ::testing::Test { +}; + +TEST_F(Utf32, appendUtf32) { int const str1Len = 3; sal_Unicode const str1[str1Len] = { 'a', 'b', 'c' }; int const str2Len = 4; @@ -93,17 +81,17 @@ 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)); + ASSERT_TRUE( + res1 == rtl::OUString(str2, str2Len)) << message.getStr(); 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)); + ASSERT_TRUE( + res2 == rtl::OUString(str3, str3Len)) << message.getStr(); } -void test::oustringbuffer::Utf32::insertUtf32() { +TEST_F(Utf32, insertUtf32) { int const str1Len = 3; sal_Unicode const str1[str1Len] = { 'a', 'b', 'c' }; int const str2Len = 4; @@ -115,12 +103,17 @@ 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)); + ASSERT_TRUE( + res1 == rtl::OUString(str2, str2Len)) << message.getStr(); 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)); + ASSERT_TRUE( + res2 == rtl::OUString(str3, str3Len)) << message.getStr(); } + +} } + + + commit 998b2312f36242d72c2ad8a1d020f28a392b63fa Author: Damjan Jovanovic <dam...@apache.org> Date: Tue Sep 1 16:48:24 2015 +0000 #i125003# migrate main/sal/qa/rtl/textenc from cppunit to Google Test. Some tests fail, but they don't run during the build, and there is no way they passed with cppunit either. diff --git a/sal/qa/rtl/textenc/makefile.mk b/sal/qa/rtl/textenc/makefile.mk index c5de5f0..88a4736 100644 --- a/sal/qa/rtl/textenc/makefile.mk +++ b/sal/qa/rtl/textenc/makefile.mk @@ -32,40 +32,38 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk +.IF "$(ENABLE_UNIT_TESTS)" != "YES" +all: + @echo unit tests are disabled. Nothing to do. + +.ELSE + + CFLAGS+= $(LFS_CFLAGS) CXXFLAGS+= $(LFS_CFLAGS) -CFLAGSCXX += $(CPPUNIT_CFLAGS) - # --- BEGIN -------------------------------------------------------- -SHL1OBJS= \ +APP1OBJS= \ $(SLO)$/rtl_textcvt.obj -SHL1TARGET= rtl_textcvt -SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB) - -SHL1IMPLIB= i$(SHL1TARGET) -DEF1NAME =$(SHL1TARGET) -SHL1VERSIONMAP = $(PRJ)$/qa$/export.map +APP1TARGET= rtl_textcvt +APP1STDLIBS= $(SALLIB) $(GTESTLIB) $(TESTSHL2LIB) +APP1RPATH = NONE +APP1TEST = enabled # END -------------------------------------------------------------- # --- BEGIN -------------------------------------------------------- -SHL2OBJS= \ +APP2OBJS= \ $(SLO)$/rtl_tencinfo.obj -SHL2TARGET= rtl_tencinfo -SHL2STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB) - -SHL2IMPLIB= i$(SHL2TARGET) -DEF2NAME =$(SHL2TARGET) -SHL2VERSIONMAP = $(PRJ)$/qa$/export.map +APP2TARGET= rtl_tencinfo +APP2STDLIBS= $(SALLIB) $(GTESTLIB) $(TESTSHL2LIB) +APP2RPATH = NONE +APP2TEST = enabled # END -------------------------------------------------------------- -#------------------------------- All object files ------------------------------- -# do this here, so we get right dependencies -# SLOFILES=$(SHL1OBJS) - # --- Targets ------------------------------------------------------ .INCLUDE : target.mk -.INCLUDE : _cppunit.mk + +.ENDIF # "$(ENABLE_UNIT_TESTS)" != "YES" diff --git a/sal/qa/rtl/textenc/rtl_tencinfo.cxx b/sal/qa/rtl/textenc/rtl_tencinfo.cxx index 7f1a226..179e6d0 100644 --- a/sal/qa/rtl/textenc/rtl_tencinfo.cxx +++ b/sal/qa/rtl/textenc/rtl_tencinfo.cxx @@ -29,16 +29,16 @@ #include <osl/thread.h> #include <rtl/tencinfo.h> -#include <testshl/simpleheader.hxx> +#include "gtest/gtest.h" // ----------------------------------------------------------------------------- namespace rtl_tencinfo { - class getBestMime : public CppUnit::TestFixture + class getBestMime : public ::testing::Test { public: - void setUp() + void SetUp() { } @@ -47,474 +47,27 @@ namespace rtl_tencinfo const sal_Char *pCharSet = rtl_getBestMimeCharsetFromTextEncoding( _aCurrentEncode ); if (pCharSet == 0) { - t_print("rtl_getBestMimeCharsetFromTextEncoding(%s) (%d) doesn't seem to exist.\n\n", _pRTL_TEXTENCODING, _aCurrentEncode); + printf("rtl_getBestMimeCharsetFromTextEncoding(%s) (%d) doesn't seem to exist.\n\n", _pRTL_TEXTENCODING, _aCurrentEncode); } else { - t_print(T_VERBOSE, "'%s' is charset: '%s'\n", _pRTL_TEXTENCODING, pCharSet); + printf("'%s' is charset: '%s'\n", _pRTL_TEXTENCODING, pCharSet); rtl_TextEncoding eTextEnc = rtl_getTextEncodingFromMimeCharset( pCharSet ); if (_aCurrentEncode != eTextEnc && eTextEnc != RTL_TEXTENCODING_DONTKNOW) { - t_print("rtl_getBestMimeCharsetFromTextEncoding(%s) is charset: %s\n", _pRTL_TEXTENCODING, pCharSet); - t_print("rtl_getTextEncodingFromMimeCharset() differ: %s %d -> %d\n\n", _pRTL_TEXTENCODING, _aCurrentEncode, eTextEnc ); + printf("rtl_getBestMimeCharsetFromTextEncoding(%s) is charset: %s\n", _pRTL_TEXTENCODING, pCharSet); + printf("rtl_getTextEncodingFromMimeCharset() differ: %s %d -> %d\n\n", _pRTL_TEXTENCODING, _aCurrentEncode, eTextEnc ); } // rtl::OString sError = "getTextEncodingFromMimeCharset("; // sError += pCharSet; // sError += ") returns null"; - // CPPUNIT_ASSERT_MESSAGE(sError.getStr(), eTextEnc != RTL_TEXTENCODING_DONTKNOW); - // CPPUNIT_ASSERT_MESSAGE("Does not realize itself", _aCurrentEncode == eTextEnc ); + // ASSERT_TRUE(eTextEnc != RTL_TEXTENCODING_DONTKNOW) << sError.getStr(); + // ASSERT_TRUE(_aCurrentEncode == eTextEnc) << "Does not realize itself"; } } - -// the defines for the follows test could be found in file inc/rtl/textenc.h - - // ---------------------------------------- - void MimeCharsetFromTextEncoding_MS_1252() - { - check( "RTL_TEXTENCODING_MS_1252", RTL_TEXTENCODING_MS_1252 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_APPLE_ROMAN() - { - check( "RTL_TEXTENCODING_APPLE_ROMAN", RTL_TEXTENCODING_APPLE_ROMAN ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_IBM_437() - { - check( "RTL_TEXTENCODING_IBM_437", RTL_TEXTENCODING_IBM_437 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_IBM_850() - { - check( "RTL_TEXTENCODING_IBM_850", RTL_TEXTENCODING_IBM_850 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_IBM_860() - { - check( "RTL_TEXTENCODING_IBM_860", RTL_TEXTENCODING_IBM_860 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_IBM_861() - { - check( "RTL_TEXTENCODING_IBM_861", RTL_TEXTENCODING_IBM_861 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_IBM_863() - { - check( "RTL_TEXTENCODING_IBM_863", RTL_TEXTENCODING_IBM_863 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_IBM_865() - { - check( "RTL_TEXTENCODING_IBM_865", RTL_TEXTENCODING_IBM_865 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_SYMBOL() - { - check( "RTL_TEXTENCODING_SYMBOL", RTL_TEXTENCODING_SYMBOL ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_ASCII_US() - { - check( "RTL_TEXTENCODING_ASCII_US", RTL_TEXTENCODING_ASCII_US ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_ISO_8859_1() - { - check( "RTL_TEXTENCODING_ISO_8859_1", RTL_TEXTENCODING_ISO_8859_1 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_ISO_8859_2() - { - check( "RTL_TEXTENCODING_ISO_8859_2", RTL_TEXTENCODING_ISO_8859_2 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_ISO_8859_3() - { - check( "RTL_TEXTENCODING_ISO_8859_3", RTL_TEXTENCODING_ISO_8859_3 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_ISO_8859_4() - { - check( "RTL_TEXTENCODING_ISO_8859_4", RTL_TEXTENCODING_ISO_8859_4 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_ISO_8859_5() - { - check( "RTL_TEXTENCODING_ISO_8859_5", RTL_TEXTENCODING_ISO_8859_5 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_ISO_8859_6() - { - check( "RTL_TEXTENCODING_ISO_8859_6", RTL_TEXTENCODING_ISO_8859_6 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_ISO_8859_7() - { - check( "RTL_TEXTENCODING_ISO_8859_7", RTL_TEXTENCODING_ISO_8859_7 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_ISO_8859_8() - { - check( "RTL_TEXTENCODING_ISO_8859_8", RTL_TEXTENCODING_ISO_8859_8 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_ISO_8859_9() - { - check( "RTL_TEXTENCODING_ISO_8859_9", RTL_TEXTENCODING_ISO_8859_9 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_ISO_8859_14() - { - check( "RTL_TEXTENCODING_ISO_8859_14", RTL_TEXTENCODING_ISO_8859_14 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_ISO_8859_15() - { - check( "RTL_TEXTENCODING_ISO_8859_15", RTL_TEXTENCODING_ISO_8859_15 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_IBM_737() - { - check( "RTL_TEXTENCODING_IBM_737", RTL_TEXTENCODING_IBM_737 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_IBM_775() - { - check( "RTL_TEXTENCODING_IBM_775", RTL_TEXTENCODING_IBM_775 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_IBM_852() - { - check( "RTL_TEXTENCODING_IBM_852", RTL_TEXTENCODING_IBM_852 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_IBM_855() - { - check( "RTL_TEXTENCODING_IBM_855", RTL_TEXTENCODING_IBM_855 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_IBM_857() - { - check( "RTL_TEXTENCODING_IBM_857", RTL_TEXTENCODING_IBM_857 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_IBM_862() - { - check( "RTL_TEXTENCODING_IBM_862", RTL_TEXTENCODING_IBM_862 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_IBM_864() - { - check( "RTL_TEXTENCODING_IBM_864", RTL_TEXTENCODING_IBM_864 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_IBM_866() - { - check( "RTL_TEXTENCODING_IBM_866", RTL_TEXTENCODING_IBM_866 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_IBM_869() - { - check( "RTL_TEXTENCODING_IBM_869", RTL_TEXTENCODING_IBM_869 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_MS_874() - { - check( "RTL_TEXTENCODING_MS_874", RTL_TEXTENCODING_MS_874 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_MS_1250() - { - check( "RTL_TEXTENCODING_MS_1250", RTL_TEXTENCODING_MS_1250 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_MS_1251() - { - check( "RTL_TEXTENCODING_MS_1251", RTL_TEXTENCODING_MS_1251 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_MS_1253() - { - check( "RTL_TEXTENCODING_MS_1253", RTL_TEXTENCODING_MS_1253 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_MS_1254() - { - check( "RTL_TEXTENCODING_MS_1254", RTL_TEXTENCODING_MS_1254 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_MS_1255() - { - check( "RTL_TEXTENCODING_MS_1255", RTL_TEXTENCODING_MS_1255 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_MS_1256() - { - check( "RTL_TEXTENCODING_MS_1256", RTL_TEXTENCODING_MS_1256 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_MS_1257() - { - check( "RTL_TEXTENCODING_MS_1257", RTL_TEXTENCODING_MS_1257 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_MS_1258() - { - check( "RTL_TEXTENCODING_MS_1258", RTL_TEXTENCODING_MS_1258 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_APPLE_ARABIC() - { - check( "RTL_TEXTENCODING_APPLE_ARABIC", RTL_TEXTENCODING_APPLE_ARABIC ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_APPLE_CENTEURO() - { - check( "RTL_TEXTENCODING_APPLE_CENTEURO", RTL_TEXTENCODING_APPLE_CENTEURO ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_APPLE_CROATIAN() - { - check( "RTL_TEXTENCODING_APPLE_CROATIAN", RTL_TEXTENCODING_APPLE_CROATIAN ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_APPLE_CYRILLIC() - { - check( "RTL_TEXTENCODING_APPLE_CYRILLIC", RTL_TEXTENCODING_APPLE_CYRILLIC ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_APPLE_DEVANAGARI() - { - check( "RTL_TEXTENCODING_APPLE_DEVANAGARI", RTL_TEXTENCODING_APPLE_DEVANAGARI ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_APPLE_FARSI() - { - check( "RTL_TEXTENCODING_APPLE_FARSI", RTL_TEXTENCODING_APPLE_FARSI ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_APPLE_GREEK() - { - check( "RTL_TEXTENCODING_APPLE_GREEK", RTL_TEXTENCODING_APPLE_GREEK ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_APPLE_GUJARATI() - { - check( "RTL_TEXTENCODING_APPLE_GUJARATI", RTL_TEXTENCODING_APPLE_GUJARATI ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_APPLE_GURMUKHI() - { - check( "RTL_TEXTENCODING_APPLE_GURMUKHI", RTL_TEXTENCODING_APPLE_GURMUKHI ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_APPLE_HEBREW() - { - check( "RTL_TEXTENCODING_APPLE_HEBREW", RTL_TEXTENCODING_APPLE_HEBREW ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_APPLE_ICELAND() - { - check( "RTL_TEXTENCODING_APPLE_ICELAND", RTL_TEXTENCODING_APPLE_ICELAND ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_APPLE_ROMANIAN() - { - check( "RTL_TEXTENCODING_APPLE_ROMANIAN", RTL_TEXTENCODING_APPLE_ROMANIAN ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_APPLE_THAI() - { - check( "RTL_TEXTENCODING_APPLE_THAI", RTL_TEXTENCODING_APPLE_THAI ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_APPLE_TURKISH() - { - check( "RTL_TEXTENCODING_APPLE_TURKISH", RTL_TEXTENCODING_APPLE_TURKISH ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_APPLE_UKRAINIAN() - { - check( "RTL_TEXTENCODING_APPLE_UKRAINIAN", RTL_TEXTENCODING_APPLE_UKRAINIAN ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_APPLE_CHINSIMP() - { - check( "RTL_TEXTENCODING_APPLE_CHINSIMP", RTL_TEXTENCODING_APPLE_CHINSIMP ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_APPLE_CHINTRAD() - { - check( "RTL_TEXTENCODING_APPLE_CHINTRAD", RTL_TEXTENCODING_APPLE_CHINTRAD ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_APPLE_JAPANESE() - { - check( "RTL_TEXTENCODING_APPLE_JAPANESE", RTL_TEXTENCODING_APPLE_JAPANESE ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_APPLE_KOREAN() - { - check( "RTL_TEXTENCODING_APPLE_KOREAN", RTL_TEXTENCODING_APPLE_KOREAN ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_MS_932() - { - check( "RTL_TEXTENCODING_MS_932", RTL_TEXTENCODING_MS_932 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_MS_936() - { - check( "RTL_TEXTENCODING_MS_936", RTL_TEXTENCODING_MS_936 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_MS_949() - { - check( "RTL_TEXTENCODING_MS_949", RTL_TEXTENCODING_MS_949 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_MS_950() - { - check( "RTL_TEXTENCODING_MS_950", RTL_TEXTENCODING_MS_950 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_SHIFT_JIS() - { - check( "RTL_TEXTENCODING_SHIFT_JIS", RTL_TEXTENCODING_SHIFT_JIS ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_GB_2312() - { - check( "RTL_TEXTENCODING_GB_2312", RTL_TEXTENCODING_GB_2312 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_GBT_12345() - { - check( "RTL_TEXTENCODING_GBT_12345", RTL_TEXTENCODING_GBT_12345 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_GBK() - { - check( "RTL_TEXTENCODING_GBK", RTL_TEXTENCODING_GBK ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_BIG5() - { - check( "RTL_TEXTENCODING_BIG5", RTL_TEXTENCODING_BIG5 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_EUC_JP() - { - check( "RTL_TEXTENCODING_EUC_JP", RTL_TEXTENCODING_EUC_JP ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_EUC_CN() - { - check( "RTL_TEXTENCODING_EUC_CN", RTL_TEXTENCODING_EUC_CN ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_EUC_TW() - { - check( "RTL_TEXTENCODING_EUC_TW", RTL_TEXTENCODING_EUC_TW ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_ISO_2022_JP() - { - check( "RTL_TEXTENCODING_ISO_2022_JP", RTL_TEXTENCODING_ISO_2022_JP ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_ISO_2022_CN() - { - check( "RTL_TEXTENCODING_ISO_2022_CN", RTL_TEXTENCODING_ISO_2022_CN ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_KOI8_R() - { - check( "RTL_TEXTENCODING_KOI8_R", RTL_TEXTENCODING_KOI8_R ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_UTF7() - { - check( "RTL_TEXTENCODING_UTF7", RTL_TEXTENCODING_UTF7 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_UTF8() - { - check( "RTL_TEXTENCODING_UTF8", RTL_TEXTENCODING_UTF8 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_ISO_8859_10() - { - check( "RTL_TEXTENCODING_ISO_8859_10", RTL_TEXTENCODING_ISO_8859_10 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_ISO_8859_13() - { - check( "RTL_TEXTENCODING_ISO_8859_13", RTL_TEXTENCODING_ISO_8859_13 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_EUC_KR() - { - check( "RTL_TEXTENCODING_EUC_KR", RTL_TEXTENCODING_EUC_KR ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_ISO_2022_KR() - { - check( "RTL_TEXTENCODING_ISO_2022_KR", RTL_TEXTENCODING_ISO_2022_KR ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_JIS_X_0201() - { - check( "RTL_TEXTENCODING_JIS_X_0201", RTL_TEXTENCODING_JIS_X_0201 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_JIS_X_0208() - { - check( "RTL_TEXTENCODING_JIS_X_0208", RTL_TEXTENCODING_JIS_X_0208 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_JIS_X_0212() - { - check( "RTL_TEXTENCODING_JIS_X_0212", RTL_TEXTENCODING_JIS_X_0212 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_MS_1361() - { - check( "RTL_TEXTENCODING_MS_1361", RTL_TEXTENCODING_MS_1361 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_GB_18030() - { - check( "RTL_TEXTENCODING_GB_18030", RTL_TEXTENCODING_GB_18030 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_BIG5_HKSCS() - { - check( "RTL_TEXTENCODING_BIG5_HKSCS", RTL_TEXTENCODING_BIG5_HKSCS ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_TIS_620() - { - check( "RTL_TEXTENCODING_TIS_620", RTL_TEXTENCODING_TIS_620 ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_KOI8_U() - { - check( "RTL_TEXTENCODING_KOI8_U", RTL_TEXTENCODING_KOI8_U ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_ISCII_DEVANAGARI() - { - check( "RTL_TEXTENCODING_ISCII_DEVANAGARI", RTL_TEXTENCODING_ISCII_DEVANAGARI ); - } - // ---------------------------------------- - void MimeCharsetFromTextEncoding_JAVA_UTF8() - { - check( "RTL_TEXTENCODING_JAVA_UTF8", RTL_TEXTENCODING_JAVA_UTF8 ); - } + }; /* ATTENTION! Whenever some encoding is added here, make sure to update * rtl_isOctetEncoding in tencinfo.c. @@ -527,1371 +80,1522 @@ namespace rtl_tencinfo // check( "RTL_TEXTENCODING_UCS2", RTL_TEXTENCODING_UCS2 ); // check( "RTL_TEXTENCODING_UNICODE", RTL_TEXTENCODING_UNICODE /* RTL_TEXTENCODING_UCS2 */ ); - CPPUNIT_TEST_SUITE( getBestMime ); - - CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1252 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_ROMAN ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_437 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_850 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_860 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_861 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_863 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_865 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_SYMBOL ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_ASCII_US ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_1 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_2 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_3 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_4 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_5 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_6 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_7 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_8 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_9 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_14 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_15 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_737 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_775 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_852 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_855 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_857 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_862 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_864 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_866 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_IBM_869 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_874 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1250 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1251 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1253 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1254 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1255 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1256 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1257 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1258 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_ARABIC ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CENTEURO ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CROATIAN ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CYRILLIC ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_DEVANAGARI ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_FARSI ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_GREEK ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_GUJARATI ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_GURMUKHI ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_HEBREW ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_ICELAND ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_ROMANIAN ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_THAI ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_TURKISH ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_UKRAINIAN ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CHINSIMP ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_CHINTRAD ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_JAPANESE ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_APPLE_KOREAN ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_932 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_936 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_949 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_950 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_SHIFT_JIS ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_GB_2312 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_GBT_12345 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_GBK ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_BIG5 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_EUC_JP ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_EUC_CN ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_EUC_TW ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_2022_JP ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_2022_CN ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_KOI8_R ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_UTF7 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_UTF8 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_10 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_8859_13 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_EUC_KR ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISO_2022_KR ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_JIS_X_0201 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_JIS_X_0208 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_JIS_X_0212 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_MS_1361 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_GB_18030 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_BIG5_HKSCS ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_TIS_620 ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_KOI8_U ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_ISCII_DEVANAGARI ); - CPPUNIT_TEST( MimeCharsetFromTextEncoding_JAVA_UTF8 ); - - CPPUNIT_TEST_SUITE_END( ); - }; - // ----------------------------------------------------------------------------- +// the defines for the follows test could be found in file inc/rtl/textenc.h - class getBestUnix : public CppUnit::TestFixture + TEST_F(getBestMime, MimeCharsetFromTextEncoding_MS_1252) { - public: - void setUp() - { - } - - void check( const sal_Char* _pRTL_TEXTENCODING, rtl_TextEncoding _aCurrentEncode ) - { - const sal_Char *pCharSet = rtl_getBestUnixCharsetFromTextEncoding( _aCurrentEncode ); - if (pCharSet == 0) - { - t_print("rtl_getBestUnixCharsetFromTextEncoding(%s) (%d) doesn't seem to exist.\n\n", _pRTL_TEXTENCODING, _aCurrentEncode); - } - else - { - t_print(T_VERBOSE, "'%s' is charset: '%s'\n", _pRTL_TEXTENCODING, pCharSet); - - rtl_TextEncoding eTextEnc = rtl_getTextEncodingFromUnixCharset( pCharSet ); - if (_aCurrentEncode != eTextEnc && - eTextEnc != RTL_TEXTENCODING_DONTKNOW) - { - t_print("rtl_getBestUnixCharsetFromTextEncoding(%s) is charset: %s\n", _pRTL_TEXTENCODING, pCharSet); - t_print("rtl_getTextEncodingFromUnixCharset() differ: %s %d -> %d\n\n", _pRTL_TEXTENCODING, _aCurrentEncode, eTextEnc ); - } - // rtl::OString sError = "getTextEncodingFromUnixCharset("; - // sError += pCharSet; - // sError += ") returns null"; - // CPPUNIT_ASSERT_MESSAGE(sError.getStr(), eTextEnc != RTL_TEXTENCODING_DONTKNOW); - // CPPUNIT_ASSERT_MESSAGE("Does not realize itself", _aCurrentEncode == eTextEnc ); - } - } - - - // ---------------------------------------- - void UnixCharsetFromTextEncoding_MS_1252() - { - check( "RTL_TEXTENCODING_MS_1252", RTL_TEXTENCODING_MS_1252 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_APPLE_ROMAN() - { - check( "RTL_TEXTENCODING_APPLE_ROMAN", RTL_TEXTENCODING_APPLE_ROMAN ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_IBM_437() - { - check( "RTL_TEXTENCODING_IBM_437", RTL_TEXTENCODING_IBM_437 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_IBM_850() - { - check( "RTL_TEXTENCODING_IBM_850", RTL_TEXTENCODING_IBM_850 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_IBM_860() - { - check( "RTL_TEXTENCODING_IBM_860", RTL_TEXTENCODING_IBM_860 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_IBM_861() - { - check( "RTL_TEXTENCODING_IBM_861", RTL_TEXTENCODING_IBM_861 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_IBM_863() - { - check( "RTL_TEXTENCODING_IBM_863", RTL_TEXTENCODING_IBM_863 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_IBM_865() - { - check( "RTL_TEXTENCODING_IBM_865", RTL_TEXTENCODING_IBM_865 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_SYMBOL() - { - check( "RTL_TEXTENCODING_SYMBOL", RTL_TEXTENCODING_SYMBOL ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_ASCII_US() - { - check( "RTL_TEXTENCODING_ASCII_US", RTL_TEXTENCODING_ASCII_US ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_ISO_8859_1() - { - check( "RTL_TEXTENCODING_ISO_8859_1", RTL_TEXTENCODING_ISO_8859_1 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_ISO_8859_2() - { - check( "RTL_TEXTENCODING_ISO_8859_2", RTL_TEXTENCODING_ISO_8859_2 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_ISO_8859_3() - { - check( "RTL_TEXTENCODING_ISO_8859_3", RTL_TEXTENCODING_ISO_8859_3 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_ISO_8859_4() - { - check( "RTL_TEXTENCODING_ISO_8859_4", RTL_TEXTENCODING_ISO_8859_4 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_ISO_8859_5() - { - check( "RTL_TEXTENCODING_ISO_8859_5", RTL_TEXTENCODING_ISO_8859_5 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_ISO_8859_6() - { - check( "RTL_TEXTENCODING_ISO_8859_6", RTL_TEXTENCODING_ISO_8859_6 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_ISO_8859_7() - { - check( "RTL_TEXTENCODING_ISO_8859_7", RTL_TEXTENCODING_ISO_8859_7 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_ISO_8859_8() - { - check( "RTL_TEXTENCODING_ISO_8859_8", RTL_TEXTENCODING_ISO_8859_8 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_ISO_8859_9() - { - check( "RTL_TEXTENCODING_ISO_8859_9", RTL_TEXTENCODING_ISO_8859_9 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_ISO_8859_14() - { - check( "RTL_TEXTENCODING_ISO_8859_14", RTL_TEXTENCODING_ISO_8859_14 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_ISO_8859_15() - { - check( "RTL_TEXTENCODING_ISO_8859_15", RTL_TEXTENCODING_ISO_8859_15 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_IBM_737() - { - check( "RTL_TEXTENCODING_IBM_737", RTL_TEXTENCODING_IBM_737 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_IBM_775() - { - check( "RTL_TEXTENCODING_IBM_775", RTL_TEXTENCODING_IBM_775 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_IBM_852() - { - check( "RTL_TEXTENCODING_IBM_852", RTL_TEXTENCODING_IBM_852 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_IBM_855() - { - check( "RTL_TEXTENCODING_IBM_855", RTL_TEXTENCODING_IBM_855 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_IBM_857() - { - check( "RTL_TEXTENCODING_IBM_857", RTL_TEXTENCODING_IBM_857 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_IBM_862() - { - check( "RTL_TEXTENCODING_IBM_862", RTL_TEXTENCODING_IBM_862 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_IBM_864() - { - check( "RTL_TEXTENCODING_IBM_864", RTL_TEXTENCODING_IBM_864 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_IBM_866() - { - check( "RTL_TEXTENCODING_IBM_866", RTL_TEXTENCODING_IBM_866 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_IBM_869() - { - check( "RTL_TEXTENCODING_IBM_869", RTL_TEXTENCODING_IBM_869 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_MS_874() - { - check( "RTL_TEXTENCODING_MS_874", RTL_TEXTENCODING_MS_874 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_MS_1250() - { - check( "RTL_TEXTENCODING_MS_1250", RTL_TEXTENCODING_MS_1250 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_MS_1251() - { - check( "RTL_TEXTENCODING_MS_1251", RTL_TEXTENCODING_MS_1251 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_MS_1253() - { - check( "RTL_TEXTENCODING_MS_1253", RTL_TEXTENCODING_MS_1253 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_MS_1254() - { - check( "RTL_TEXTENCODING_MS_1254", RTL_TEXTENCODING_MS_1254 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_MS_1255() - { - check( "RTL_TEXTENCODING_MS_1255", RTL_TEXTENCODING_MS_1255 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_MS_1256() - { - check( "RTL_TEXTENCODING_MS_1256", RTL_TEXTENCODING_MS_1256 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_MS_1257() - { - check( "RTL_TEXTENCODING_MS_1257", RTL_TEXTENCODING_MS_1257 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_MS_1258() - { - check( "RTL_TEXTENCODING_MS_1258", RTL_TEXTENCODING_MS_1258 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_APPLE_ARABIC() - { - check( "RTL_TEXTENCODING_APPLE_ARABIC", RTL_TEXTENCODING_APPLE_ARABIC ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_APPLE_CENTEURO() - { - check( "RTL_TEXTENCODING_APPLE_CENTEURO", RTL_TEXTENCODING_APPLE_CENTEURO ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_APPLE_CROATIAN() - { - check( "RTL_TEXTENCODING_APPLE_CROATIAN", RTL_TEXTENCODING_APPLE_CROATIAN ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_APPLE_CYRILLIC() - { - check( "RTL_TEXTENCODING_APPLE_CYRILLIC", RTL_TEXTENCODING_APPLE_CYRILLIC ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_APPLE_DEVANAGARI() - { - check( "RTL_TEXTENCODING_APPLE_DEVANAGARI", RTL_TEXTENCODING_APPLE_DEVANAGARI ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_APPLE_FARSI() - { - check( "RTL_TEXTENCODING_APPLE_FARSI", RTL_TEXTENCODING_APPLE_FARSI ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_APPLE_GREEK() - { - check( "RTL_TEXTENCODING_APPLE_GREEK", RTL_TEXTENCODING_APPLE_GREEK ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_APPLE_GUJARATI() - { - check( "RTL_TEXTENCODING_APPLE_GUJARATI", RTL_TEXTENCODING_APPLE_GUJARATI ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_APPLE_GURMUKHI() - { - check( "RTL_TEXTENCODING_APPLE_GURMUKHI", RTL_TEXTENCODING_APPLE_GURMUKHI ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_APPLE_HEBREW() - { - check( "RTL_TEXTENCODING_APPLE_HEBREW", RTL_TEXTENCODING_APPLE_HEBREW ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_APPLE_ICELAND() - { - check( "RTL_TEXTENCODING_APPLE_ICELAND", RTL_TEXTENCODING_APPLE_ICELAND ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_APPLE_ROMANIAN() - { - check( "RTL_TEXTENCODING_APPLE_ROMANIAN", RTL_TEXTENCODING_APPLE_ROMANIAN ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_APPLE_THAI() - { - check( "RTL_TEXTENCODING_APPLE_THAI", RTL_TEXTENCODING_APPLE_THAI ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_APPLE_TURKISH() - { - check( "RTL_TEXTENCODING_APPLE_TURKISH", RTL_TEXTENCODING_APPLE_TURKISH ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_APPLE_UKRAINIAN() - { - check( "RTL_TEXTENCODING_APPLE_UKRAINIAN", RTL_TEXTENCODING_APPLE_UKRAINIAN ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_APPLE_CHINSIMP() - { - check( "RTL_TEXTENCODING_APPLE_CHINSIMP", RTL_TEXTENCODING_APPLE_CHINSIMP ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_APPLE_CHINTRAD() - { - check( "RTL_TEXTENCODING_APPLE_CHINTRAD", RTL_TEXTENCODING_APPLE_CHINTRAD ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_APPLE_JAPANESE() - { - check( "RTL_TEXTENCODING_APPLE_JAPANESE", RTL_TEXTENCODING_APPLE_JAPANESE ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_APPLE_KOREAN() - { - check( "RTL_TEXTENCODING_APPLE_KOREAN", RTL_TEXTENCODING_APPLE_KOREAN ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_MS_932() - { - check( "RTL_TEXTENCODING_MS_932", RTL_TEXTENCODING_MS_932 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_MS_936() - { - check( "RTL_TEXTENCODING_MS_936", RTL_TEXTENCODING_MS_936 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_MS_949() - { - check( "RTL_TEXTENCODING_MS_949", RTL_TEXTENCODING_MS_949 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_MS_950() - { - check( "RTL_TEXTENCODING_MS_950", RTL_TEXTENCODING_MS_950 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_SHIFT_JIS() - { - check( "RTL_TEXTENCODING_SHIFT_JIS", RTL_TEXTENCODING_SHIFT_JIS ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_GB_2312() - { - check( "RTL_TEXTENCODING_GB_2312", RTL_TEXTENCODING_GB_2312 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_GBT_12345() - { - check( "RTL_TEXTENCODING_GBT_12345", RTL_TEXTENCODING_GBT_12345 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_GBK() - { - check( "RTL_TEXTENCODING_GBK", RTL_TEXTENCODING_GBK ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_BIG5() - { - check( "RTL_TEXTENCODING_BIG5", RTL_TEXTENCODING_BIG5 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_EUC_JP() - { - check( "RTL_TEXTENCODING_EUC_JP", RTL_TEXTENCODING_EUC_JP ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_EUC_CN() - { - check( "RTL_TEXTENCODING_EUC_CN", RTL_TEXTENCODING_EUC_CN ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_EUC_TW() - { - check( "RTL_TEXTENCODING_EUC_TW", RTL_TEXTENCODING_EUC_TW ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_ISO_2022_JP() - { - check( "RTL_TEXTENCODING_ISO_2022_JP", RTL_TEXTENCODING_ISO_2022_JP ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_ISO_2022_CN() - { - check( "RTL_TEXTENCODING_ISO_2022_CN", RTL_TEXTENCODING_ISO_2022_CN ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_KOI8_R() - { - check( "RTL_TEXTENCODING_KOI8_R", RTL_TEXTENCODING_KOI8_R ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_UTF7() - { - check( "RTL_TEXTENCODING_UTF7", RTL_TEXTENCODING_UTF7 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_UTF8() - { - check( "RTL_TEXTENCODING_UTF8", RTL_TEXTENCODING_UTF8 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_ISO_8859_10() - { - check( "RTL_TEXTENCODING_ISO_8859_10", RTL_TEXTENCODING_ISO_8859_10 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_ISO_8859_13() - { - check( "RTL_TEXTENCODING_ISO_8859_13", RTL_TEXTENCODING_ISO_8859_13 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_EUC_KR() - { - check( "RTL_TEXTENCODING_EUC_KR", RTL_TEXTENCODING_EUC_KR ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_ISO_2022_KR() - { - check( "RTL_TEXTENCODING_ISO_2022_KR", RTL_TEXTENCODING_ISO_2022_KR ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_JIS_X_0201() - { - check( "RTL_TEXTENCODING_JIS_X_0201", RTL_TEXTENCODING_JIS_X_0201 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_JIS_X_0208() - { - check( "RTL_TEXTENCODING_JIS_X_0208", RTL_TEXTENCODING_JIS_X_0208 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_JIS_X_0212() - { - check( "RTL_TEXTENCODING_JIS_X_0212", RTL_TEXTENCODING_JIS_X_0212 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_MS_1361() - { - check( "RTL_TEXTENCODING_MS_1361", RTL_TEXTENCODING_MS_1361 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_GB_18030() - { - check( "RTL_TEXTENCODING_GB_18030", RTL_TEXTENCODING_GB_18030 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_BIG5_HKSCS() - { - check( "RTL_TEXTENCODING_BIG5_HKSCS", RTL_TEXTENCODING_BIG5_HKSCS ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_TIS_620() - { - check( "RTL_TEXTENCODING_TIS_620", RTL_TEXTENCODING_TIS_620 ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_KOI8_U() - { - check( "RTL_TEXTENCODING_KOI8_U", RTL_TEXTENCODING_KOI8_U ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_ISCII_DEVANAGARI() - { - check( "RTL_TEXTENCODING_ISCII_DEVANAGARI", RTL_TEXTENCODING_ISCII_DEVANAGARI ); - } - // ---------------------------------------- - void UnixCharsetFromTextEncoding_JAVA_UTF8() - { - check( "RTL_TEXTENCODING_JAVA_UTF8", RTL_TEXTENCODING_JAVA_UTF8 ); - } - // ---------------------------------------- - - CPPUNIT_TEST_SUITE( getBestUnix ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1252 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_ROMAN ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_437 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_850 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_860 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_861 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_863 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_865 ); - - CPPUNIT_TEST( UnixCharsetFromTextEncoding_SYMBOL ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_ASCII_US ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_1 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_2 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_3 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_4 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_5 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_6 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_7 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_8 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_9 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_14 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_15 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_737 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_775 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_852 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_855 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_857 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_862 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_864 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_866 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_IBM_869 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_874 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1250 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1251 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1253 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1254 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1255 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1256 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1257 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_1258 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_ARABIC ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CENTEURO ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CROATIAN ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CYRILLIC ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_DEVANAGARI ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_FARSI ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_GREEK ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_GUJARATI ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_GURMUKHI ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_HEBREW ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_ICELAND ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_ROMANIAN ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_THAI ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_TURKISH ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_UKRAINIAN ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CHINSIMP ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_CHINTRAD ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_JAPANESE ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_APPLE_KOREAN ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_932 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_936 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_949 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_MS_950 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_SHIFT_JIS ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_GB_2312 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_GBT_12345 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_GBK ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_BIG5 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_EUC_JP ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_EUC_CN ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_EUC_TW ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_2022_JP ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_2022_CN ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_KOI8_R ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_UTF7 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_UTF8 ); - CPPUNIT_TEST( UnixCharsetFromTextEncoding_ISO_8859_10 ); ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits