Imported Upstream version 58.1
[platform/upstream/icu.git] / source / test / intltest / ustrtest.h
1 // Copyright (C) 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:
27     UnicodeStringTest() {}
28     virtual ~UnicodeStringTest();
29     
30     void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
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
97 class StringCaseTest: public IntlTest {
98 public:
99     StringCaseTest();
100     virtual ~StringCaseTest();
101
102     void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=0);
103
104     void TestCaseConversion();
105
106     void TestCasingImpl(const UnicodeString &input,
107                         const UnicodeString &output,
108                         int32_t whichCase,
109                         void *iter, const char *localeID, uint32_t options);
110     void TestCasing();
111     void TestFullCaseFoldingIterator();
112     void TestGreekUpper();
113     void TestLongUpper();
114     void TestMalformedUTF8();
115
116 private:
117     void assertGreekUpper(const char *s, const char *expected);
118
119     Locale GREEK_LOCALE_;
120 };
121
122 #endif