]>
Commit | Line | Data |
---|---|---|
f3c0d7a5 A |
1 | // © 2016 and later: Unicode, Inc. and others. |
2 | // License & terms of use: http://www.unicode.org/copyright.html | |
b75a7d8f A |
3 | /******************************************************************** |
4 | * COPYRIGHT: | |
b331163b | 5 | * Copyright (c) 1997-2015, International Business Machines Corporation and |
b75a7d8f A |
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); | |
374ca955 A |
74 | |
75 | /* Test getting keyword enumeratin */ | |
76 | void TestKeywordVariants(void); | |
77 | ||
78 | /* Test getting keyword values */ | |
79 | void TestKeywordVariantParsing(void); | |
80 | ||
729e4ab9 A |
81 | /* Test setting keyword values */ |
82 | void TestSetKeywordValue(void); | |
83 | ||
374ca955 A |
84 | /* Test getting the locale base name */ |
85 | void TestGetBaseName(void); | |
b75a7d8f A |
86 | |
87 | #if !UCONFIG_NO_FORMATTING | |
88 | void Test4105828(void) ; | |
89 | #endif | |
90 | ||
91 | void TestSetIsBogus(void); | |
92 | ||
374ca955 A |
93 | void TestGetLocale(void); |
94 | ||
95 | void TestVariantWithOutCountry(void); | |
96 | ||
97 | void TestCanonicalization(void); | |
98 | ||
b75a7d8f A |
99 | #if !UCONFIG_NO_FORMATTING |
100 | static UDate date(int32_t y, int32_t m, int32_t d, int32_t hr = 0, int32_t min = 0, int32_t sec = 0); | |
101 | #endif | |
102 | ||
46f4442e A |
103 | void TestCurrencyByDate(void); |
104 | ||
729e4ab9 | 105 | void TestGetVariantWithKeywords(void); |
b331163b A |
106 | void TestIsRightToLeft(); |
107 | void TestBug11421(); | |
0f5d89e8 A |
108 | void TestBug13277(); |
109 | void TestBug13554(); | |
729e4ab9 | 110 | |
b75a7d8f | 111 | private: |
374ca955 A |
112 | void _checklocs(const char* label, |
113 | const char* req, | |
114 | const Locale& validLoc, | |
115 | const Locale& actualLoc, | |
116 | const char* expReqValid="gt", | |
117 | const char* expValidActual="ge"); | |
118 | ||
b75a7d8f A |
119 | /** |
120 | * routine to perform subtests, used by TestDisplayNames | |
121 | **/ | |
122 | void doTestDisplayNames(Locale& inLocale, int32_t compareIndex); | |
123 | /** | |
124 | * additional intialization for datatables storing expected values | |
125 | **/ | |
126 | void setUpDataTable(void); | |
127 | ||
128 | UnicodeString** dataTable; | |
129 | ||
130 | enum { | |
131 | ENGLISH = 0, | |
132 | FRENCH = 1, | |
133 | CROATIAN = 2, | |
134 | GREEK = 3, | |
135 | NORWEGIAN = 4, | |
374ca955 A |
136 | ITALIAN = 5, |
137 | XX = 6, | |
138 | CHINESE = 7, | |
139 | MAX_LOCALES = 7 | |
b75a7d8f A |
140 | }; |
141 | ||
142 | enum { | |
143 | LANG = 0, | |
374ca955 A |
144 | SCRIPT, |
145 | CTRY, | |
146 | VAR, | |
147 | NAME, | |
148 | LANG3, | |
149 | CTRY3, | |
150 | LCID, | |
151 | DLANG_EN, | |
152 | DSCRIPT_EN, | |
153 | DCTRY_EN, | |
154 | DVAR_EN, | |
155 | DNAME_EN, | |
156 | DLANG_FR, | |
157 | DSCRIPT_FR, | |
158 | DCTRY_FR, | |
159 | DVAR_FR, | |
160 | DNAME_FR, | |
161 | DLANG_CA, | |
162 | DSCRIPT_CA, | |
163 | DCTRY_CA, | |
164 | DVAR_CA, | |
165 | DNAME_CA, | |
166 | DLANG_EL, | |
167 | DSCRIPT_EL, | |
168 | DCTRY_EL, | |
169 | DVAR_EL, | |
170 | DNAME_EL, | |
171 | DLANG_NO, | |
172 | DSCRIPT_NO, | |
173 | DCTRY_NO, | |
174 | DVAR_NO, | |
175 | DNAME_NO | |
b75a7d8f | 176 | }; |
b75a7d8f | 177 | |
b331163b A |
178 | #if !UCONFIG_NO_COLLATION |
179 | /** | |
180 | * Check on registered collators. | |
181 | * @param expectExtra if non-null, the locale ID of an 'extra' locale that is registered. | |
182 | */ | |
183 | void checkRegisteredCollators(const char *expectExtra = NULL); | |
184 | #endif | |
185 | }; |