]> git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/loctest.h
ICU-59131.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 enumeratin */
76 void TestKeywordVariants(void);
77
78 /* Test getting keyword values */
79 void TestKeywordVariantParsing(void);
80
81 /* Test setting keyword values */
82 void TestSetKeywordValue(void);
83
84 /* Test getting the locale base name */
85 void TestGetBaseName(void);
86
87 #if !UCONFIG_NO_FORMATTING
88 void Test4105828(void) ;
89 #endif
90
91 void TestSetIsBogus(void);
92
93 void TestGetLocale(void);
94
95 void TestVariantWithOutCountry(void);
96
97 void TestCanonicalization(void);
98
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
103 void TestCurrencyByDate(void);
104
105 void TestGetVariantWithKeywords(void);
106 void TestIsRightToLeft();
107 void TestBug11421();
108
109 private:
110 void _checklocs(const char* label,
111 const char* req,
112 const Locale& validLoc,
113 const Locale& actualLoc,
114 const char* expReqValid="gt",
115 const char* expValidActual="ge");
116
117 /**
118 * routine to perform subtests, used by TestDisplayNames
119 **/
120 void doTestDisplayNames(Locale& inLocale, int32_t compareIndex);
121 /**
122 * additional intialization for datatables storing expected values
123 **/
124 void setUpDataTable(void);
125
126 UnicodeString** dataTable;
127
128 enum {
129 ENGLISH = 0,
130 FRENCH = 1,
131 CROATIAN = 2,
132 GREEK = 3,
133 NORWEGIAN = 4,
134 ITALIAN = 5,
135 XX = 6,
136 CHINESE = 7,
137 MAX_LOCALES = 7
138 };
139
140 enum {
141 LANG = 0,
142 SCRIPT,
143 CTRY,
144 VAR,
145 NAME,
146 LANG3,
147 CTRY3,
148 LCID,
149 DLANG_EN,
150 DSCRIPT_EN,
151 DCTRY_EN,
152 DVAR_EN,
153 DNAME_EN,
154 DLANG_FR,
155 DSCRIPT_FR,
156 DCTRY_FR,
157 DVAR_FR,
158 DNAME_FR,
159 DLANG_CA,
160 DSCRIPT_CA,
161 DCTRY_CA,
162 DVAR_CA,
163 DNAME_CA,
164 DLANG_EL,
165 DSCRIPT_EL,
166 DCTRY_EL,
167 DVAR_EL,
168 DNAME_EL,
169 DLANG_NO,
170 DSCRIPT_NO,
171 DCTRY_NO,
172 DVAR_NO,
173 DNAME_NO
174 };
175
176 #if !UCONFIG_NO_COLLATION
177 /**
178 * Check on registered collators.
179 * @param expectExtra if non-null, the locale ID of an 'extra' locale that is registered.
180 */
181 void checkRegisteredCollators(const char *expectExtra = NULL);
182 #endif
183 };