2000-01-15 02:00:06 +00:00
|
|
|
/********************************************************************
|
|
|
|
* COPYRIGHT:
|
|
|
|
* Copyright (c) 1997-1999, International Business Machines Corporation and
|
|
|
|
* 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();
|
|
|
|
~LocaleTest();
|
|
|
|
|
2000-05-18 22:08:39 +00:00
|
|
|
void runIndexedTest( int32_t index, UBool exec, char* &name, char* par = NULL );
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test methods to set and get data fields
|
|
|
|
**/
|
|
|
|
void TestBasicGetters(void);
|
|
|
|
/**
|
|
|
|
* 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);
|
|
|
|
void TestThaiCurrencyFormat(void);
|
|
|
|
void TestEuroSupport(void);
|
|
|
|
void TestToString(void);
|
|
|
|
void Test4139940(void);
|
|
|
|
void Test4143951(void);
|
|
|
|
void Test4147315(void);
|
|
|
|
void Test4147317(void);
|
|
|
|
void Test4147552(void);
|
|
|
|
|
|
|
|
void TestVariantParsing(void);
|
|
|
|
|
|
|
|
void Test4105828(void) ;
|
|
|
|
|
|
|
|
static UDate date(int32_t y, int32_t m, int32_t d, int32_t hr = 0, int32_t min = 0, int32_t sec = 0);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
static UnicodeString** dataTable;
|
|
|
|
|
|
|
|
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
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|