1 /******************************************************************** 2 * COPYRIGHT: 3 * Copyright (c) 1997-2012, International Business Machines Corporation and 4 * others. All Rights Reserved. 5 ********************************************************************/ 6 7 #ifndef UNICODESTRINGTEST_H 8 #define UNICODESTRINGTEST_H 9 10 #include "unicode/unistr.h" 11 #include "intltest.h" 12 13 U_NAMESPACE_BEGIN 14 15 class Appendable; 16 17 U_NAMESPACE_END 18 19 /** 20 * Perform API and functionality tests for class UnicodeString 21 **/ 22 class UnicodeStringTest: public IntlTest { 23 public: 24 UnicodeStringTest() {} 25 virtual ~UnicodeStringTest(); 26 27 void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ); 28 29 /** 30 * Test some basic methods (insert, remove, replace, ...) 31 **/ 32 void TestBasicManipulation(void); 33 /** 34 * Test the methods for comparison 35 **/ 36 void TestCompare(void); 37 /** 38 * Test the methods for extracting 39 **/ 40 void TestExtract(void); 41 /** 42 * More extensively test methods for removing and replacing 43 **/ 44 void TestRemoveReplace(void); 45 /** 46 * Test language specific case conversions 47 **/ 48 void TestSearching(void); 49 /** 50 * Test methods for padding, trimmimg and truncating 51 **/ 52 void TestSpacePadding(void); 53 /** 54 * Test methods startsWith and endsWith 55 **/ 56 void TestPrefixAndSuffix(void); 57 void TestStartsWithAndEndsWithNulTerminated(); 58 /** 59 * Test method findAndReplace 60 **/ 61 void TestFindAndReplace(void); 62 /** 63 * Test method reverse 64 **/ 65 void TestReverse(void); 66 /** 67 * Test a few miscellaneous methods (isBogus, hashCode,...) 68 **/ 69 void TestMiscellaneous(void); 70 /** 71 * Test the functionality of allocating UnicodeStrings on the stack 72 **/ 73 void TestStackAllocation(void); 74 /** 75 * Test the unescape() function. 76 */ 77 void TestUnescape(void); 78 79 void _testUnicodeStringHasMoreChar32Than(const UnicodeString &s, int32_t start, int32_t length, int32_t number); 80 void TestCountChar32(); 81 void TestBogus(); 82 void TestStringEnumeration(); 83 void TestNameSpace(); 84 void TestUTF32(); 85 void TestUTF8(); 86 void TestReadOnlyAlias(); 87 void doTestAppendable(UnicodeString &dest, Appendable &app); 88 void TestAppendable(); 89 void TestUnicodeStringImplementsAppendable(); 90 void TestSizeofUnicodeString(); 91 }; 92 93 class StringCaseTest: public IntlTest { 94 public: 95 StringCaseTest() {} 96 virtual ~StringCaseTest(); 97 98 void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=0); 99 100 void TestCaseConversion(); 101 102 void TestCasingImpl(const UnicodeString &input, 103 const UnicodeString &output, 104 int32_t whichCase, 105 void *iter, const char *localeID, uint32_t options); 106 void TestCasing(); 107 void TestFullCaseFoldingIterator(); 108 }; 109 110 #endif 111