From ca34bad82bfd2a8f0c922be74e9310e80a203d4d Mon Sep 17 00:00:00 2001 From: Markus Scherer Date: Mon, 22 Nov 1999 20:29:44 +0000 Subject: [PATCH] ICU-157 add test for sizeof(wchar_t) X-SVN-Rev: 221 --- icu4c/source/test/intltest/intltest.dsp | 12 +++++-- icu4c/source/test/intltest/itutil.cpp | 42 +++++++++++++--------- icu4c/source/test/intltest/strtest.cpp | 47 +++++++++++++++++++++++++ icu4c/source/test/intltest/strtest.h | 42 ++++++++++++++++++++++ 4 files changed, 125 insertions(+), 18 deletions(-) create mode 100644 icu4c/source/test/intltest/strtest.cpp create mode 100644 icu4c/source/test/intltest/strtest.h diff --git a/icu4c/source/test/intltest/intltest.dsp b/icu4c/source/test/intltest/intltest.dsp index f4d87439755..943761dff71 100644 --- a/icu4c/source/test/intltest/intltest.dsp +++ b/icu4c/source/test/intltest/intltest.dsp @@ -42,7 +42,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /GX /I "..\..\..\include" /I "..\..\..\source\common" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /Z7 /I "..\..\..\include" /I "..\..\..\source\common" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -50,7 +50,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 ..\..\..\lib\release\icuuc.lib ..\..\..\lib\release\icui18n.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 ..\..\..\lib\release\icuuc.lib ..\..\..\lib\release\icui18n.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept !ELSEIF "$(CFG)" == "intltest - Win32 Debug" @@ -259,6 +259,10 @@ SOURCE=.\sdtfmtts.cpp # End Source File # Begin Source File +SOURCE=.\strtest.cpp +# End Source File +# Begin Source File + SOURCE=.\tchcfmt.cpp # End Source File # Begin Source File @@ -515,6 +519,10 @@ SOURCE=.\sdtfmtts.h # End Source File # Begin Source File +SOURCE=.\strtest.h +# End Source File +# Begin Source File + SOURCE=.\tchcfmt.h # End Source File # Begin Source File diff --git a/icu4c/source/test/intltest/itutil.cpp b/icu4c/source/test/intltest/itutil.cpp index 5ad2abe44d1..d51b6e4f337 100644 --- a/icu4c/source/test/intltest/itutil.cpp +++ b/icu4c/source/test/intltest/itutil.cpp @@ -17,6 +17,7 @@ #include "utypes.h" #include "itutil.h" +#include "strtest.h" #include "loctest.h" #include "citrtest.h" #include "ustrtest.h" @@ -36,24 +37,15 @@ void IntlTestUtilities::runIndexedTest( int32_t index, bool_t exec, char* &name, if (exec) logln("TestSuite Utilities: "); switch (index) { case 0: - name = "LocaleTest"; + name = "StringTest"; if (exec) { - logln("LocaleTest---"); logln(""); - LocaleTest test; + logln("StringTest---"); logln(""); + StringTest test; callTest( test, par ); } break; case 1: - name = "CharIterTest"; - if (exec) { - logln("CharIterTest---"); logln(""); - CharIterTest test; - callTest( test, par ); - } - break; - - case 2: name = "UnicodeStringTest"; if (exec) { logln("UnicodeStringTest---"); logln(""); @@ -62,7 +54,25 @@ void IntlTestUtilities::runIndexedTest( int32_t index, bool_t exec, char* &name, } break; + case 2: + name = "LocaleTest"; + if (exec) { + logln("LocaleTest---"); logln(""); + LocaleTest test; + callTest( test, par ); + } + break; + case 3: + name = "CharIterTest"; + if (exec) { + logln("CharIterTest---"); logln(""); + CharIterTest test; + callTest( test, par ); + } + break; + + case 4: name = "UnicodeTest"; if (exec) { logln("UnicodeTest---"); logln(""); @@ -71,7 +81,7 @@ void IntlTestUtilities::runIndexedTest( int32_t index, bool_t exec, char* &name, } break; - case 4: + case 5: name = "ResourceBundleTest"; if (exec) { logln("ResourceBundleTest---"); logln(""); @@ -80,7 +90,7 @@ void IntlTestUtilities::runIndexedTest( int32_t index, bool_t exec, char* &name, } break; - case 5: + case 6: name = "MutexTest"; if (exec) { logln("MutexTest---"); logln(""); @@ -89,7 +99,7 @@ void IntlTestUtilities::runIndexedTest( int32_t index, bool_t exec, char* &name, } break; - case 6: + case 7: name = "MultithreadTest"; if (exec) { logln("MultithreadTest---"); logln(""); @@ -98,7 +108,7 @@ void IntlTestUtilities::runIndexedTest( int32_t index, bool_t exec, char* &name, } break; - case 7: + case 8: name = "PUtilTest"; if (exec) { logln("PUtilTest---"); logln(""); diff --git a/icu4c/source/test/intltest/strtest.cpp b/icu4c/source/test/intltest/strtest.cpp new file mode 100644 index 00000000000..e565e435a46 --- /dev/null +++ b/icu4c/source/test/intltest/strtest.cpp @@ -0,0 +1,47 @@ +/* +******************************************************************************* +* * +* COPYRIGHT: * +* (C) Copyright International Business Machines Corporation, 1999 * +* Licensed Material - Program-Property of IBM - All Rights Reserved. * +* US Government Users Restricted Rights - Use, duplication, or disclosure * +* restricted by GSA ADP Schedule Contract with IBM Corp. * +* * +******************************************************************************* +* file name: strtest.cpp +* encoding: US-ASCII +* tab size: 8 (not used) +* indentation:4 +* +* created on: 1999nov22 +* created by: Markus W. Scherer +*/ + +#include +#include "utypes.h" +#include "putil.h" +#include "intltest.h" +#include "strtest.h" + +void StringTest::TestSizeofWCharT() { + if(U_SIZEOF_WCHAR_T!=sizeof(wchar_t)) { + errln("TestSizeofWCharT: U_SIZEOF_WCHAR_T!=sizeof(wchar_t) - U_SIZEOF_WCHAR_T needs to be fixed in platform.h"); + } +} + +void StringTest::runIndexedTest(int32_t index, bool_t exec, char *&name, char *par) { + if(exec) { + logln("TestSuite Character and String Test: "); + } + switch(index) { + case 0: + name="TestSizeofWCharT"; + if(exec) { + TestSizeofWCharT(); + } + break; + default: + name=""; + break; + } +} diff --git a/icu4c/source/test/intltest/strtest.h b/icu4c/source/test/intltest/strtest.h new file mode 100644 index 00000000000..e21a8cbc45e --- /dev/null +++ b/icu4c/source/test/intltest/strtest.h @@ -0,0 +1,42 @@ +/* +******************************************************************************* +* * +* COPYRIGHT: * +* (C) Copyright International Business Machines Corporation, 1999 * +* Licensed Material - Program-Property of IBM - All Rights Reserved. * +* US Government Users Restricted Rights - Use, duplication, or disclosure * +* restricted by GSA ADP Schedule Contract with IBM Corp. * +* * +******************************************************************************* +* file name: strtest.h +* encoding: US-ASCII +* tab size: 8 (not used) +* indentation:4 +* +* created on: 1999nov22 +* created by: Markus W. Scherer +*/ + +/* + * Test character- and string- related settings in utypes.h, + * macros in putil.h, and constructors in unistr.h . + */ + +#ifndef __STRTEST_H__ +#define __STRTEST_H__ + +#include "utypes.h" +#include "intltest.h" + +class StringTest : public IntlTest { +public: + StringTest() {} + ~StringTest() {} + + void runIndexedTest(int32_t index, bool_t exec, char *&name, char *par=NULL); + +private: + void TestSizeofWCharT(); +}; + +#endif