]>
Commit | Line | Data |
---|---|---|
b75a7d8f A |
1 | /******************************************************************** |
2 | * COPYRIGHT: | |
374ca955 | 3 | * Copyright (c) 1997-2004, International Business Machines Corporation and |
b75a7d8f A |
4 | * others. All Rights Reserved. |
5 | ********************************************************************/ | |
6 | ||
7 | #include "intltest.h" | |
8 | #include "unicode/locid.h" | |
9 | ||
10 | /** | |
11 | * Tests for the Locale class | |
12 | **/ | |
13 | class LocaleTest: public IntlTest { | |
14 | public: | |
15 | LocaleTest(); | |
16 | virtual ~LocaleTest(); | |
17 | ||
18 | void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ); | |
19 | ||
20 | /** | |
21 | * Test methods to set and get data fields | |
22 | **/ | |
23 | void TestBasicGetters(void); | |
24 | /** | |
25 | * Test methods to set and get data fields | |
26 | **/ | |
27 | void TestParallelAPIValues(void); | |
28 | /** | |
29 | * Use Locale to access Resource file data and compare against expected values | |
30 | **/ | |
31 | void TestSimpleResourceInfo(void); | |
32 | /** | |
33 | * Use Locale to access Resource file display names and compare against expected values | |
34 | **/ | |
35 | void TestDisplayNames(void); | |
36 | /** | |
37 | * Test methods for basic object behaviour | |
38 | **/ | |
39 | void TestSimpleObjectStuff(void); | |
40 | /** | |
41 | * Test methods for POSIX parsing behavior | |
42 | **/ | |
43 | void TestPOSIXParsing(void); | |
44 | /** | |
45 | * Test Locale::getAvailableLocales | |
46 | **/ | |
47 | void TestGetAvailableLocales(void); | |
48 | /** | |
49 | * Test methods to set and access a custom data directory | |
50 | **/ | |
51 | void TestDataDirectory(void); | |
52 | ||
53 | void TestISO3Fallback(void); | |
54 | void TestGetLangsAndCountries(void); | |
55 | void TestSimpleDisplayNames(void); | |
56 | void TestUninstalledISO3Names(void); | |
57 | void TestAtypicalLocales(void); | |
58 | #if !UCONFIG_NO_FORMATTING | |
59 | void TestThaiCurrencyFormat(void); | |
60 | void TestEuroSupport(void); | |
61 | #endif | |
62 | void TestToString(void); | |
63 | #if !UCONFIG_NO_FORMATTING | |
64 | void Test4139940(void); | |
65 | void Test4143951(void); | |
66 | #endif | |
67 | void Test4147315(void); | |
68 | void Test4147317(void); | |
69 | void Test4147552(void); | |
70 | ||
71 | void TestVariantParsing(void); | |
374ca955 A |
72 | |
73 | /* Test getting keyword enumeratin */ | |
74 | void TestKeywordVariants(void); | |
75 | ||
76 | /* Test getting keyword values */ | |
77 | void TestKeywordVariantParsing(void); | |
78 | ||
79 | /* Test getting the locale base name */ | |
80 | void TestGetBaseName(void); | |
b75a7d8f A |
81 | |
82 | #if !UCONFIG_NO_FORMATTING | |
83 | void Test4105828(void) ; | |
84 | #endif | |
85 | ||
86 | void TestSetIsBogus(void); | |
87 | ||
374ca955 A |
88 | void TestGetLocale(void); |
89 | ||
90 | void TestVariantWithOutCountry(void); | |
91 | ||
92 | void TestCanonicalization(void); | |
93 | ||
b75a7d8f A |
94 | #if !UCONFIG_NO_FORMATTING |
95 | static UDate date(int32_t y, int32_t m, int32_t d, int32_t hr = 0, int32_t min = 0, int32_t sec = 0); | |
96 | #endif | |
97 | ||
98 | private: | |
374ca955 A |
99 | void _checklocs(const char* label, |
100 | const char* req, | |
101 | const Locale& validLoc, | |
102 | const Locale& actualLoc, | |
103 | const char* expReqValid="gt", | |
104 | const char* expValidActual="ge"); | |
105 | ||
b75a7d8f A |
106 | /** |
107 | * routine to perform subtests, used by TestDisplayNames | |
108 | **/ | |
109 | void doTestDisplayNames(Locale& inLocale, int32_t compareIndex); | |
110 | /** | |
111 | * additional intialization for datatables storing expected values | |
112 | **/ | |
113 | void setUpDataTable(void); | |
114 | ||
115 | UnicodeString** dataTable; | |
116 | ||
117 | enum { | |
118 | ENGLISH = 0, | |
119 | FRENCH = 1, | |
120 | CROATIAN = 2, | |
121 | GREEK = 3, | |
122 | NORWEGIAN = 4, | |
374ca955 A |
123 | ITALIAN = 5, |
124 | XX = 6, | |
125 | CHINESE = 7, | |
126 | MAX_LOCALES = 7 | |
b75a7d8f A |
127 | }; |
128 | ||
129 | enum { | |
130 | LANG = 0, | |
374ca955 A |
131 | SCRIPT, |
132 | CTRY, | |
133 | VAR, | |
134 | NAME, | |
135 | LANG3, | |
136 | CTRY3, | |
137 | LCID, | |
138 | DLANG_EN, | |
139 | DSCRIPT_EN, | |
140 | DCTRY_EN, | |
141 | DVAR_EN, | |
142 | DNAME_EN, | |
143 | DLANG_FR, | |
144 | DSCRIPT_FR, | |
145 | DCTRY_FR, | |
146 | DVAR_FR, | |
147 | DNAME_FR, | |
148 | DLANG_CA, | |
149 | DSCRIPT_CA, | |
150 | DCTRY_CA, | |
151 | DVAR_CA, | |
152 | DNAME_CA, | |
153 | DLANG_EL, | |
154 | DSCRIPT_EL, | |
155 | DCTRY_EL, | |
156 | DVAR_EL, | |
157 | DNAME_EL, | |
158 | DLANG_NO, | |
159 | DSCRIPT_NO, | |
160 | DCTRY_NO, | |
161 | DVAR_NO, | |
162 | DNAME_NO | |
b75a7d8f A |
163 | }; |
164 | }; | |
165 | ||
166 | ||
167 |