Imported Upstream version 4.8
[platform/upstream/icu.git] / source / test / intltest / loctest.h
1 /********************************************************************
2  * COPYRIGHT: 
3  * Copyright (c) 1997-2010, International Business Machines Corporation and
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);
72
73    /* Test getting keyword enumeratin */
74    void TestKeywordVariants(void);
75
76    /* Test getting keyword values */
77    void TestKeywordVariantParsing(void);
78
79    /* Test setting keyword values */
80    void TestSetKeywordValue(void);
81
82    /* Test getting the locale base name */
83    void TestGetBaseName(void);
84     
85 #if !UCONFIG_NO_FORMATTING
86     void Test4105828(void) ;
87 #endif
88
89     void TestSetIsBogus(void);
90
91     void TestGetLocale(void);
92
93     void TestVariantWithOutCountry(void);
94
95     void TestCanonicalization(void);
96
97 #if !UCONFIG_NO_FORMATTING
98     static UDate date(int32_t y, int32_t m, int32_t d, int32_t hr = 0, int32_t min = 0, int32_t sec = 0);
99 #endif
100
101     void TestCurrencyByDate(void);
102
103     void TestGetVariantWithKeywords(void);
104
105 private:
106     void _checklocs(const char* label,
107                     const char* req,
108                     const Locale& validLoc,
109                     const Locale& actualLoc,
110                     const char* expReqValid="gt",
111                     const char* expValidActual="ge"); 
112
113     /**
114      * routine to perform subtests, used by TestDisplayNames
115      **/
116     void doTestDisplayNames(Locale& inLocale, int32_t compareIndex);
117     /**
118      * additional intialization for datatables storing expected values
119      **/
120     void setUpDataTable(void);
121
122     UnicodeString** dataTable;
123     
124     enum {
125         ENGLISH = 0,
126         FRENCH = 1,
127         CROATIAN = 2,
128         GREEK = 3,
129         NORWEGIAN = 4,
130         ITALIAN = 5,
131         XX = 6,
132         CHINESE = 7,
133         MAX_LOCALES = 7
134     };
135
136     enum {
137         LANG = 0,
138         SCRIPT,
139         CTRY,
140         VAR,
141         NAME,
142         LANG3,
143         CTRY3,
144         LCID,
145         DLANG_EN,
146         DSCRIPT_EN,
147         DCTRY_EN,
148         DVAR_EN,
149         DNAME_EN,
150         DLANG_FR,
151         DSCRIPT_FR,
152         DCTRY_FR,
153         DVAR_FR,
154         DNAME_FR,
155         DLANG_CA,
156         DSCRIPT_CA,
157         DCTRY_CA,
158         DVAR_CA,
159         DNAME_CA,
160         DLANG_EL,
161         DSCRIPT_EL,
162         DCTRY_EL,
163         DVAR_EL,
164         DNAME_EL,
165         DLANG_NO,
166         DSCRIPT_NO,
167         DCTRY_NO,
168         DVAR_NO,
169         DNAME_NO
170     };
171 };
172
173
174