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