diff --git a/icu4c/source/test/intltest/strtest.cpp b/icu4c/source/test/intltest/strtest.cpp index e565e435a46..0926de1cc33 100644 --- a/icu4c/source/test/intltest/strtest.cpp +++ b/icu4c/source/test/intltest/strtest.cpp @@ -23,23 +23,55 @@ #include "intltest.h" #include "strtest.h" +void StringTest::TestEndian() { + union { + uint8_t byte; + uint16_t word; + } u; + u.word=0x0100; + if(U_IS_BIG_ENDIAN!=u.byte) { + errln("TestEndian: U_IS_BIG_ENDIAN needs to be fixed in platform.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::TestCharsetFamily() { + unsigned char c='A'; + if( U_CHARSET_FAMILY==U_ASCII_FAMILY && c!=0x41 || + U_CHARSET_FAMILY==U_EBCDIC_FAMILY && c!=0xc1 + ) { + errln("TestCharsetFamily: U_CHARSET_FAMILY 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="TestEndian"; + if(exec) { + TestEndian(); + } + break; + case 1: name="TestSizeofWCharT"; if(exec) { TestSizeofWCharT(); } break; + case 2: + name="TestCharsetFamily"; + if(exec) { + TestCharsetFamily(); + } + break; default: name=""; break; diff --git a/icu4c/source/test/intltest/strtest.h b/icu4c/source/test/intltest/strtest.h index e21a8cbc45e..7c50e80b7f9 100644 --- a/icu4c/source/test/intltest/strtest.h +++ b/icu4c/source/test/intltest/strtest.h @@ -36,7 +36,9 @@ public: void runIndexedTest(int32_t index, bool_t exec, char *&name, char *par=NULL); private: + void TestEndian(); void TestSizeofWCharT(); + void TestCharsetFamily(); }; #endif