1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /********************************************************************
5 * Copyright (c) 1997-2015, International Business Machines Corporation and
6 * others. All Rights Reserved.
7 ********************************************************************/
9 #ifndef UNICODESTRINGTEST_H
10 #define UNICODESTRINGTEST_H
12 #include "unicode/locid.h"
13 #include "unicode/unistr.h"
23 * Perform API and functionality tests for class UnicodeString
25 class UnicodeStringTest: public IntlTest {
27 UnicodeStringTest() {}
28 virtual ~UnicodeStringTest();
30 void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
33 * Test some basic methods (insert, remove, replace, ...)
35 void TestBasicManipulation(void);
37 * Test the methods for comparison
39 void TestCompare(void);
41 * Test the methods for extracting
43 void TestExtract(void);
45 * More extensively test methods for removing and replacing
47 void TestRemoveReplace(void);
49 * Test language specific case conversions
51 void TestSearching(void);
53 * Test methods for padding, trimmimg and truncating
55 void TestSpacePadding(void);
57 * Test methods startsWith and endsWith
59 void TestPrefixAndSuffix(void);
60 void TestStartsWithAndEndsWithNulTerminated();
62 * Test method findAndReplace
64 void TestFindAndReplace(void);
68 void TestReverse(void);
70 * Test a few miscellaneous methods (isBogus, hashCode,...)
72 void TestMiscellaneous(void);
74 * Test the functionality of allocating UnicodeStrings on the stack
76 void TestStackAllocation(void);
78 * Test the unescape() function.
80 void TestUnescape(void);
82 void _testUnicodeStringHasMoreChar32Than(const UnicodeString &s, int32_t start, int32_t length, int32_t number);
83 void TestCountChar32();
85 void TestStringEnumeration();
89 void TestReadOnlyAlias();
90 void doTestAppendable(UnicodeString &dest, Appendable &app);
91 void TestAppendable();
92 void TestUnicodeStringImplementsAppendable();
93 void TestSizeofUnicodeString();
97 class StringCaseTest: public IntlTest {
100 virtual ~StringCaseTest();
102 void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=0);
104 void TestCaseConversion();
106 void TestCasingImpl(const UnicodeString &input,
107 const UnicodeString &output,
109 void *iter, const char *localeID, uint32_t options);
111 void TestFullCaseFoldingIterator();
112 void TestGreekUpper();
113 void TestLongUpper();
114 void TestMalformedUTF8();
117 void assertGreekUpper(const char *s, const char *expected);
119 Locale GREEK_LOCALE_;