OLD | NEW |
1 | 1 |
2 /******************************************************************** | 2 /******************************************************************** |
3 * COPYRIGHT: | 3 * COPYRIGHT: |
4 * Copyright (c) 1997-2007, International Business Machines Corporation and | 4 * Copyright (c) 1997-2015, International Business Machines Corporation and |
5 * others. All Rights Reserved. | 5 * others. All Rights Reserved. |
6 ******************************************************************** | 6 ******************************************************************** |
7 ********************************************************************** | 7 ********************************************************************** |
8 * Date Name Description | 8 * Date Name Description |
9 * 10/20/99 alan Creation. | 9 * 10/20/99 alan Creation. |
10 * 03/22/2000 Madhu Added additional tests | 10 * 03/22/2000 Madhu Added additional tests |
11 ********************************************************************** | 11 ********************************************************************** |
12 */ | 12 */ |
13 | 13 |
14 #ifndef _TESTUNISET | 14 #ifndef _TESTUNISET |
15 #define _TESTUNISET | 15 #define _TESTUNISET |
16 | 16 |
17 #include "unicode/unistr.h" | 17 #include "unicode/unistr.h" |
18 #include "unicode/uniset.h" | 18 #include "unicode/uniset.h" |
19 #include "unicode/ucnv_err.h" | 19 #include "unicode/ucnv_err.h" |
20 #include "intltest.h" | 20 #include "intltest.h" |
| 21 #include "cmemory.h" |
21 | 22 |
22 class UnicodeSetWithStrings; | 23 class UnicodeSetWithStrings; |
23 | 24 |
24 /** | 25 /** |
25 * UnicodeSet test | 26 * UnicodeSet test |
26 */ | 27 */ |
27 class UnicodeSetTest: public IntlTest { | 28 class UnicodeSetTest: public IntlTest { |
28 public: | 29 public: |
29 UnicodeSetTest(); | 30 UnicodeSetTest(); |
30 ~UnicodeSetTest(); | 31 ~UnicodeSetTest(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 void TestSurrogate(); | 81 void TestSurrogate(); |
81 | 82 |
82 void TestPosixClasses(); | 83 void TestPosixClasses(); |
83 | 84 |
84 void TestFreezable(); | 85 void TestFreezable(); |
85 | 86 |
86 void TestSpan(); | 87 void TestSpan(); |
87 | 88 |
88 void TestStringSpan(); | 89 void TestStringSpan(); |
89 | 90 |
| 91 void TestUCAUnsafeBackwards(); |
| 92 |
90 private: | 93 private: |
91 | 94 |
92 UBool toPatternAux(UChar32 start, UChar32 end); | 95 UBool toPatternAux(UChar32 start, UChar32 end); |
93 | 96 |
94 UBool checkPat(const UnicodeString& source, | 97 UBool checkPat(const UnicodeString& source, |
95 const UnicodeSet& testSet); | 98 const UnicodeSet& testSet); |
96 | 99 |
97 UBool checkPat(const UnicodeString& source, const UnicodeSet& testSet, const
UnicodeString& pat); | 100 UBool checkPat(const UnicodeString& source, const UnicodeSet& testSet, const
UnicodeString& pat); |
98 | 101 |
99 void _testComplement(int32_t a, UnicodeSet&, UnicodeSet&); | 102 void _testComplement(int32_t a, UnicodeSet&, UnicodeSet&); |
(...skipping 29 matching lines...) Expand all Loading... |
129 * For example, the set [a-zA-M3] is represented as "33AMaz". | 132 * For example, the set [a-zA-M3] is represented as "33AMaz". |
130 */ | 133 */ |
131 static UnicodeString getPairs(const UnicodeSet& set); | 134 static UnicodeString getPairs(const UnicodeSet& set); |
132 | 135 |
133 /** | 136 /** |
134 * Basic consistency check for a few items. | 137 * Basic consistency check for a few items. |
135 * That the iterator works, and that we can create a pattern and | 138 * That the iterator works, and that we can create a pattern and |
136 * get the same thing back | 139 * get the same thing back |
137 */ | 140 */ |
138 void checkRoundTrip(const UnicodeSet& s); | 141 void checkRoundTrip(const UnicodeSet& s); |
| 142 |
| 143 void checkSerializeRoundTrip(const UnicodeSet& s, UErrorCode &ec); |
139 | 144 |
140 void copyWithIterator(UnicodeSet& t, const UnicodeSet& s, UBool withRange); | 145 void copyWithIterator(UnicodeSet& t, const UnicodeSet& s, UBool withRange); |
141 | 146 |
142 UBool checkEqual(const UnicodeSet& s, const UnicodeSet& t, const char* messa
ge); | 147 UBool checkEqual(const UnicodeSet& s, const UnicodeSet& t, const char* messa
ge); |
143 | 148 |
144 void expectContainment(const UnicodeString& pat, | 149 void expectContainment(const UnicodeString& pat, |
145 const UnicodeString& charsIn, | 150 const UnicodeString& charsIn, |
146 const UnicodeString& charsOut); | 151 const UnicodeString& charsOut); |
147 void expectContainment(const UnicodeSet& set, | 152 void expectContainment(const UnicodeSet& set, |
148 const UnicodeString& charsIn, | 153 const UnicodeString& charsIn, |
(...skipping 27 matching lines...) Expand all Loading... |
176 uint32_t whichSpans, | 181 uint32_t whichSpans, |
177 const char *testName, int32_t index); | 182 const char *testName, int32_t index); |
178 void testSpanContents(const UnicodeSetWithStrings *sets[4], uint32_t whichSp
ans, const char *testName); | 183 void testSpanContents(const UnicodeSetWithStrings *sets[4], uint32_t whichSp
ans, const char *testName); |
179 void testSpanUTF16String(const UnicodeSetWithStrings *sets[4], uint32_t whic
hSpans, const char *testName); | 184 void testSpanUTF16String(const UnicodeSetWithStrings *sets[4], uint32_t whic
hSpans, const char *testName); |
180 void testSpanUTF8String(const UnicodeSetWithStrings *sets[4], uint32_t which
Spans, const char *testName); | 185 void testSpanUTF8String(const UnicodeSetWithStrings *sets[4], uint32_t which
Spans, const char *testName); |
181 | 186 |
182 UConverter *openUTF8Converter(); | 187 UConverter *openUTF8Converter(); |
183 | 188 |
184 UConverter *utf8Cnv; | 189 UConverter *utf8Cnv; |
185 | 190 |
| 191 MaybeStackArray<uint16_t, 16> serializeBuffer; |
| 192 |
186 public: | 193 public: |
187 static UnicodeString escape(const UnicodeString& s); | 194 static UnicodeString escape(const UnicodeString& s); |
188 }; | 195 }; |
189 | 196 |
190 #endif | 197 #endif |
OLD | NEW |