2000-01-15 02:00:06 +00:00
|
|
|
/********************************************************************
|
|
|
|
* COPYRIGHT:
|
2001-03-21 20:09:56 +00:00
|
|
|
* Copyright (c) 1997-2001, International Business Machines Corporation and
|
2000-01-15 02:00:06 +00:00
|
|
|
* others. All Rights Reserved.
|
|
|
|
********************************************************************/
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
#include "intltest.h"
|
1999-12-28 23:57:50 +00:00
|
|
|
#include "unicode/locid.h"
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Tests for the Locale class
|
|
|
|
**/
|
|
|
|
class LocaleTest: public IntlTest {
|
|
|
|
public:
|
|
|
|
LocaleTest();
|
2000-12-09 03:17:45 +00:00
|
|
|
virtual ~LocaleTest();
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2000-08-14 21:42:36 +00:00
|
|
|
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test methods to set and get data fields
|
|
|
|
**/
|
|
|
|
void TestBasicGetters(void);
|
2002-03-26 23:18:57 +00:00
|
|
|
/**
|
|
|
|
* Test methods to set and get data fields
|
|
|
|
**/
|
|
|
|
void TestParallelAPIValues(void);
|
1999-08-16 21:50:52 +00:00
|
|
|
/**
|
|
|
|
* Use Locale to access Resource file data and compare against expected values
|
|
|
|
**/
|
|
|
|
void TestSimpleResourceInfo(void);
|
|
|
|
/**
|
|
|
|
* Use Locale to access Resource file display names and compare against expected values
|
|
|
|
**/
|
|
|
|
void TestDisplayNames(void);
|
|
|
|
/**
|
|
|
|
* Test methods for basic object behaviour
|
|
|
|
**/
|
|
|
|
void TestSimpleObjectStuff(void);
|
|
|
|
/**
|
|
|
|
* Test methods for POSIX parsing behavior
|
|
|
|
**/
|
|
|
|
void TestPOSIXParsing(void);
|
|
|
|
/**
|
|
|
|
* Test Locale::getAvailableLocales
|
|
|
|
**/
|
|
|
|
void TestGetAvailableLocales(void);
|
|
|
|
/**
|
|
|
|
* Test methods to set and access a custom data directory
|
|
|
|
**/
|
|
|
|
void TestDataDirectory(void);
|
|
|
|
|
|
|
|
void TestISO3Fallback(void);
|
|
|
|
void TestGetLangsAndCountries(void);
|
|
|
|
void Test4126880(void);
|
|
|
|
void TestBug4135316(void);
|
|
|
|
void TestSimpleDisplayNames(void);
|
|
|
|
void TestUninstalledISO3Names(void);
|
|
|
|
void TestAtypicalLocales(void);
|
|
|
|
void TestNullDefault(void);
|
2002-09-21 00:43:14 +00:00
|
|
|
#if !UCONFIG_NO_FORMATTING
|
1999-08-16 21:50:52 +00:00
|
|
|
void TestThaiCurrencyFormat(void);
|
|
|
|
void TestEuroSupport(void);
|
2002-09-21 00:43:14 +00:00
|
|
|
#endif
|
1999-08-16 21:50:52 +00:00
|
|
|
void TestToString(void);
|
2002-09-21 00:43:14 +00:00
|
|
|
#if !UCONFIG_NO_FORMATTING
|
1999-08-16 21:50:52 +00:00
|
|
|
void Test4139940(void);
|
|
|
|
void Test4143951(void);
|
2002-09-21 00:43:14 +00:00
|
|
|
#endif
|
1999-08-16 21:50:52 +00:00
|
|
|
void Test4147315(void);
|
|
|
|
void Test4147317(void);
|
|
|
|
void Test4147552(void);
|
|
|
|
|
|
|
|
void TestVariantParsing(void);
|
|
|
|
|
2002-09-21 00:43:14 +00:00
|
|
|
#if !UCONFIG_NO_FORMATTING
|
1999-08-16 21:50:52 +00:00
|
|
|
void Test4105828(void) ;
|
2002-09-21 00:43:14 +00:00
|
|
|
#endif
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2002-02-28 21:32:28 +00:00
|
|
|
void TestSetIsBogus(void);
|
|
|
|
|
2002-09-21 00:43:14 +00:00
|
|
|
#if !UCONFIG_NO_FORMATTING
|
1999-08-16 21:50:52 +00:00
|
|
|
static UDate date(int32_t y, int32_t m, int32_t d, int32_t hr = 0, int32_t min = 0, int32_t sec = 0);
|
2002-09-21 00:43:14 +00:00
|
|
|
#endif
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* routine to perform subtests, used by TestDisplayNames
|
|
|
|
**/
|
2000-05-18 22:08:39 +00:00
|
|
|
void doTestDisplayNames(Locale& inLocale, int32_t compareIndex, UBool defaultIsFrench);
|
1999-08-16 21:50:52 +00:00
|
|
|
/**
|
|
|
|
* additional intialization for datatables storing expected values
|
|
|
|
**/
|
|
|
|
void setUpDataTable(void);
|
|
|
|
|
2001-10-04 16:36:32 +00:00
|
|
|
UnicodeString** dataTable;
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
enum {
|
|
|
|
ENGLISH = 0,
|
|
|
|
FRENCH = 1,
|
|
|
|
CROATIAN = 2,
|
|
|
|
GREEK = 3,
|
|
|
|
NORWEGIAN = 4,
|
|
|
|
MAX_LOCALES = 4
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
LANG = 0,
|
|
|
|
CTRY = 1,
|
|
|
|
VAR = 2,
|
|
|
|
NAME = 3,
|
|
|
|
LANG3 = 4,
|
|
|
|
CTRY3 = 5,
|
|
|
|
LCID = 6,
|
|
|
|
DLANG_EN = 7,
|
|
|
|
DCTRY_EN = 8,
|
|
|
|
DVAR_EN = 9,
|
|
|
|
DNAME_EN = 10,
|
|
|
|
DLANG_FR = 11,
|
|
|
|
DCTRY_FR = 12,
|
|
|
|
DVAR_FR = 13,
|
|
|
|
DNAME_FR = 14,
|
|
|
|
DLANG_HR = 15,
|
|
|
|
DCTRY_HR = 16,
|
|
|
|
DVAR_HR = 17,
|
|
|
|
DNAME_HR = 18,
|
|
|
|
DLANG_EL = 19,
|
|
|
|
DCTRY_EL = 20,
|
|
|
|
DVAR_EL = 21,
|
|
|
|
DNAME_EL = 22,
|
|
|
|
DLANG_RT = 23,
|
|
|
|
DCTRY_RT = 24,
|
|
|
|
DVAR_RT = 25,
|
|
|
|
DNAME_RT = 26
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|