1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /********************************************************************
5 * Copyright (c) 1997-2015, International Business Machines Corporation and
6 * others. All Rights Reserved.
7 ********************************************************************/
10 #include "unicode/locid.h"
13 * Tests for the Locale class
15 class LocaleTest: public IntlTest {
18 virtual ~LocaleTest();
20 void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
23 * Test methods to set and get data fields
25 void TestBasicGetters(void);
27 * Test methods to set and get data fields
29 void TestParallelAPIValues(void);
31 * Use Locale to access Resource file data and compare against expected values
33 void TestSimpleResourceInfo(void);
35 * Use Locale to access Resource file display names and compare against expected values
37 void TestDisplayNames(void);
39 * Test methods for basic object behaviour
41 void TestSimpleObjectStuff(void);
43 * Test methods for POSIX parsing behavior
45 void TestPOSIXParsing(void);
47 * Test Locale::getAvailableLocales
49 void TestGetAvailableLocales(void);
51 * Test methods to set and access a custom data directory
53 void TestDataDirectory(void);
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);
64 void TestToString(void);
65 #if !UCONFIG_NO_FORMATTING
66 void Test4139940(void);
67 void Test4143951(void);
69 void Test4147315(void);
70 void Test4147317(void);
71 void Test4147552(void);
73 void TestVariantParsing(void);
75 /* Test getting keyword enumeratin */
76 void TestKeywordVariants(void);
78 /* Test getting keyword values */
79 void TestKeywordVariantParsing(void);
81 /* Test setting keyword values */
82 void TestSetKeywordValue(void);
84 /* Test getting the locale base name */
85 void TestGetBaseName(void);
87 #if !UCONFIG_NO_FORMATTING
88 void Test4105828(void) ;
91 void TestSetIsBogus(void);
93 void TestGetLocale(void);
95 void TestVariantWithOutCountry(void);
97 void TestCanonicalization(void);
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);
103 void TestCurrencyByDate(void);
105 void TestGetVariantWithKeywords(void);
106 void TestIsRightToLeft();
110 void _checklocs(const char* label,
112 const Locale& validLoc,
113 const Locale& actualLoc,
114 const char* expReqValid="gt",
115 const char* expValidActual="ge");
118 * routine to perform subtests, used by TestDisplayNames
120 void doTestDisplayNames(Locale& inLocale, int32_t compareIndex);
122 * additional intialization for datatables storing expected values
124 void setUpDataTable(void);
126 UnicodeString** dataTable;
176 #if !UCONFIG_NO_COLLATION
178 * Check on registered collators.
179 * @param expectExtra if non-null, the locale ID of an 'extra' locale that is registered.
181 void checkRegisteredCollators(const char *expectExtra = NULL);