]> git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/loctest.h
ICU-64252.0.1.tar.gz
[apple/icu.git] / icuSources / test / intltest / loctest.h
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 #include "intltest.h"
10 #include "unicode/locid.h"
11
12 /**
13 * Tests for the Locale class
14 **/
15 class LocaleTest: public IntlTest {
16 public:
17 LocaleTest();
18 virtual ~LocaleTest();
19
20 void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
21
22 /**
23 * Test methods to set and get data fields
24 **/
25 void TestBasicGetters(void);
26 /**
27 * Test methods to set and get data fields
28 **/
29 void TestParallelAPIValues(void);
30 /**
31 * Use Locale to access Resource file data and compare against expected values
32 **/
33 void TestSimpleResourceInfo(void);
34 /**
35 * Use Locale to access Resource file display names and compare against expected values
36 **/
37 void TestDisplayNames(void);
38 /**
39 * Test methods for basic object behaviour
40 **/
41 void TestSimpleObjectStuff(void);
42 /**
43 * Test methods for POSIX parsing behavior
44 **/
45 void TestPOSIXParsing(void);
46 /**
47 * Test Locale::getAvailableLocales
48 **/
49 void TestGetAvailableLocales(void);
50 /**
51 * Test methods to set and access a custom data directory
52 **/
53 void TestDataDirectory(void);
54
55 void TestISO3Fallback(void);
56 void TestGetLangsAndCountries(void);
57 void TestSimpleDisplayNames(void);
58 void TestUninstalledISO3Names(void);
59 void TestAtypicalLocales(void);
60 #if !UCONFIG_NO_FORMATTING
61 void TestThaiCurrencyFormat(void);
62 void TestEuroSupport(void);
63 #endif
64 void TestToString(void);
65 #if !UCONFIG_NO_FORMATTING
66 void Test4139940(void);
67 void Test4143951(void);
68 #endif
69 void Test4147315(void);
70 void Test4147317(void);
71 void Test4147552(void);
72
73 void TestVariantParsing(void);
74
75 /* Test getting keyword enumeration */
76 void TestKeywordVariants(void);
77 void TestCreateUnicodeKeywords(void);
78
79 /* Test getting keyword values */
80 void TestKeywordVariantParsing(void);
81 void TestCreateKeywordSet(void);
82 void TestCreateUnicodeKeywordSet(void);
83 void TestGetKeywordValueStdString(void);
84 void TestGetUnicodeKeywordValueStdString(void);
85
86 /* Test setting keyword values */
87 void TestSetKeywordValue(void);
88 void TestSetKeywordValueStringPiece(void);
89 void TestSetUnicodeKeywordValueStringPiece(void);
90
91 /* Test getting the locale base name */
92 void TestGetBaseName(void);
93
94 #if !UCONFIG_NO_FORMATTING
95 void Test4105828(void) ;
96 #endif
97
98 void TestSetIsBogus(void);
99
100 void TestGetLocale(void);
101
102 void TestVariantWithOutCountry(void);
103
104 void TestCanonicalization(void);
105
106 #if !UCONFIG_NO_FORMATTING
107 static UDate date(int32_t y, int32_t m, int32_t d, int32_t hr = 0, int32_t min = 0, int32_t sec = 0);
108 #endif
109
110 void TestCurrencyByDate(void);
111
112 void TestGetVariantWithKeywords(void);
113 void TestIsRightToLeft();
114 void TestBug11421();
115 void TestBug13277();
116 void TestBug13554();
117 void TestBug20410();
118
119 void TestAddLikelySubtags();
120 void TestMinimizeSubtags();
121 void TestAddLikelyAndMinimizeSubtags();
122
123 void TestForLanguageTag();
124 void TestToLanguageTag();
125
126 void TestMoveAssign();
127 void TestMoveCtor();
128
129 void TestBug20407iVariantPreferredValue();
130
131 void TestBug13417VeryLongLanguageTag();
132
133 void TestBug11053UnderlineTimeZone();
134
135 void TestUnd();
136 void TestUndScript();
137 void TestUndRegion();
138 void TestUndCAPI();
139
140 private:
141 void _checklocs(const char* label,
142 const char* req,
143 const Locale& validLoc,
144 const Locale& actualLoc,
145 const char* expReqValid="gt",
146 const char* expValidActual="ge");
147
148 /**
149 * routine to perform subtests, used by TestDisplayNames
150 **/
151 void doTestDisplayNames(Locale& inLocale, int32_t compareIndex);
152 /**
153 * additional intialization for datatables storing expected values
154 **/
155 void setUpDataTable(void);
156
157 UnicodeString** dataTable;
158
159 enum {
160 ENGLISH = 0,
161 FRENCH = 1,
162 CROATIAN = 2,
163 GREEK = 3,
164 NORWEGIAN = 4,
165 ITALIAN = 5,
166 XX = 6,
167 CHINESE = 7,
168 MAX_LOCALES = 7
169 };
170
171 enum {
172 LANG = 0,
173 SCRIPT,
174 CTRY,
175 VAR,
176 NAME,
177 LANG3,
178 CTRY3,
179 LCID,
180 DLANG_EN,
181 DSCRIPT_EN,
182 DCTRY_EN,
183 DVAR_EN,
184 DNAME_EN,
185 DLANG_FR,
186 DSCRIPT_FR,
187 DCTRY_FR,
188 DVAR_FR,
189 DNAME_FR,
190 DLANG_CA,
191 DSCRIPT_CA,
192 DCTRY_CA,
193 DVAR_CA,
194 DNAME_CA,
195 DLANG_EL,
196 DSCRIPT_EL,
197 DCTRY_EL,
198 DVAR_EL,
199 DNAME_EL,
200 DLANG_NO,
201 DSCRIPT_NO,
202 DCTRY_NO,
203 DVAR_NO,
204 DNAME_NO
205 };
206
207 #if !UCONFIG_NO_COLLATION
208 /**
209 * Check on registered collators.
210 * @param expectExtra if non-null, the locale ID of an 'extra' locale that is registered.
211 */
212 void checkRegisteredCollators(const char *expectExtra = NULL);
213 #endif
214 };