ICU-1811 Increase the code coverage of Locale:get methods

X-SVN-Rev: 8255
This commit is contained in:
George Rhoten 2002-03-26 23:18:57 +00:00
parent f5f1fca9aa
commit 7bc5d45c83
18 changed files with 161 additions and 96 deletions

View File

@ -152,11 +152,11 @@ CollationAPITest::TestProperty(/* char* par */)
UnicodeString name;
logln("Get display name for the US English collation in German : ");
logln(Collator::getDisplayName(Locale::US, Locale::GERMAN, name));
logln(Collator::getDisplayName(Locale::getUS(), Locale::getGerman(), name));
doAssert((name == UnicodeString("Englisch (Vereinigte Staaten)")), "getDisplayName failed");
logln("Get display name for the US English collation in English : ");
logln(Collator::getDisplayName(Locale::US, Locale::ENGLISH, name));
logln(Collator::getDisplayName(Locale::getUS(), Locale::getEnglish(), name));
doAssert((name == UnicodeString("English (United States)")), "getDisplayName failed");
#if 0
// weiv : this test is bogus if we're running on any machine that has different default locale than English.
@ -213,7 +213,7 @@ CollationAPITest::TestProperty(/* char* par */)
doAssert(((RuleBasedCollator *)col)->getRules() == ((RuleBasedCollator *)junk)->getRules(),
"The default collation should be returned.");
Collator *frCol = Collator::createInstance(Locale::FRANCE, success);
Collator *frCol = Collator::createInstance(Locale::getFrance(), success);
if (U_FAILURE(success))
{
errln("Creating French collator failed.");
@ -1247,8 +1247,8 @@ void CollationAPITest::TestDisplayName()
}
UnicodeString name;
UnicodeString result;
coll->getDisplayName(Locale::CANADA_FRENCH, result);
Locale::CANADA_FRENCH.getDisplayName(name);
coll->getDisplayName(Locale::getCanadaFrench(), result);
Locale::getCanadaFrench().getDisplayName(name);
if (result.compare(name)) {
errln("Failure getting the correct name for locale en_US");
}

View File

@ -997,7 +997,7 @@ CalendarRegressionTest::test4031502()
UErrorCode status = U_ZERO_ERROR;
Locale saveLocale = Locale::getDefault();
//try {
Locale locales [] = { Locale::CHINESE, Locale::CHINA };
Locale locales [] = { Locale::getChinese(), Locale::getChina() };
for (int32_t i=0; i<2; ++i) {
Locale::setDefault(locales[i], status);
failure(status, "Locale::setDefault");

View File

@ -1199,9 +1199,9 @@ CalendarTest::TestDOW_LOCALandYEAR_WOY()
* to loop_addroll. - aliu */
UErrorCode status = U_ZERO_ERROR;
int32_t times = 20;
Calendar *cal=Calendar::createInstance(Locale::GERMANY, status);
Calendar *cal=Calendar::createInstance(Locale::getGermany(), status);
if (U_FAILURE(status)) { errln("Couldn't create GregorianCalendar"); return; }
SimpleDateFormat *sdf=new SimpleDateFormat(UnicodeString("YYYY'-W'ww-ee"), Locale::GERMANY, status);
SimpleDateFormat *sdf=new SimpleDateFormat(UnicodeString("YYYY'-W'ww-ee"), Locale::getGermany(), status);
if (U_FAILURE(status)) { errln("Couldn't create SimpleDateFormat"); return; }
sdf->applyLocalizedPattern(UnicodeString("JJJJ'-W'ww-ee"), status);
if (U_FAILURE(status)) { errln("Couldn't apply localized pattern"); return; }
@ -1345,7 +1345,7 @@ CalendarTest::doYEAR_WOYLoop(Calendar *cal, SimpleDateFormat *sdf,
UnicodeString us;
UDate tst, original;
Calendar *tstres = new GregorianCalendar(Locale::GERMANY, errorCode);
Calendar *tstres = new GregorianCalendar(Locale::getGermany(), errorCode);
for(int i=0; i<times; ++i) {
sdf->format(Formattable(cal->getTime(errorCode),Formattable::kIsDate), us, errorCode);
//logln("expected: "+us);

View File

@ -127,7 +127,7 @@ void ConvertTest::TestConvert()
const Locale CodePagesLocale[NUM_CODEPAGE] =
{
Locale::KOREAN
Locale::getKorean()
};
UConverterFromUCallback fromUAction = NULL;

View File

@ -31,12 +31,12 @@ CollationGermanTest::CollationGermanTest()
: myCollation(0)
{
UErrorCode status = U_ZERO_ERROR;
myCollation = Collator::createInstance(Locale::GERMANY, status);
myCollation = Collator::createInstance(Locale::getGermany(), status);
if(!myCollation || U_FAILURE(status)) {
errln(__FILE__ "failed to create! err " + UnicodeString(u_errorName(status)));
/* if it wasn't already: */
delete myCollation;
myCollation = NULL;
errln(__FILE__ "failed to create! err " + UnicodeString(u_errorName(status)));
/* if it wasn't already: */
delete myCollation;
myCollation = NULL;
}
}
@ -96,10 +96,10 @@ const Collator::EComparisonResult CollationGermanTest::results[][2] =
void CollationGermanTest::doTest( UnicodeString source, UnicodeString target, Collator::EComparisonResult result)
{
if(myCollation == NULL ) {
errln("decoll: cannot start test, collator is null\n");
return;
}
if(myCollation == NULL ) {
errln("decoll: cannot start test, collator is null\n");
return;
}
Collator::EComparisonResult compareResult = myCollation->compare(source, target);
CollationKey sortKey1, sortKey2;
UErrorCode key1status = U_ZERO_ERROR, key2status = U_ZERO_ERROR; //nos
@ -117,10 +117,10 @@ void CollationGermanTest::doTest( UnicodeString source, UnicodeString target, Co
void CollationGermanTest::TestTertiary(/* char* par */)
{
if(myCollation == NULL ) {
errln("decoll: cannot start test, collator is null\n");
return;
}
if(myCollation == NULL ) {
errln("decoll: cannot start test, collator is null\n");
return;
}
int32_t i = 0;
myCollation->setStrength(Collator::TERTIARY);
@ -132,10 +132,10 @@ void CollationGermanTest::TestTertiary(/* char* par */)
}
void CollationGermanTest::TestPrimary(/* char* par */)
{
if(myCollation == NULL ) {
errln("decoll: cannot start test, collator is null\n");
return;
}
if(myCollation == NULL ) {
errln("decoll: cannot start test, collator is null\n");
return;
}
int32_t i;
myCollation->setStrength(Collator::PRIMARY);
myCollation->setDecomposition(Normalizer::DECOMP);

View File

@ -96,7 +96,7 @@ void IntlTestDateFormatAPI::testAPI(/* char* par */)
DateFormat *def = DateFormat::createInstance();
DateFormat *fr = DateFormat::createTimeInstance(DateFormat::FULL, Locale::FRENCH);
DateFormat *it = DateFormat::createDateInstance(DateFormat::MEDIUM, Locale::ITALIAN);
DateFormat *de = DateFormat::createDateTimeInstance(DateFormat::LONG, DateFormat::LONG, Locale::GERMAN);
DateFormat *de = DateFormat::createDateTimeInstance(DateFormat::LONG, DateFormat::LONG, Locale::getGerman());
// ======= Test equality

View File

@ -277,8 +277,8 @@ DateFormatTest::TestFieldPosition(void)
UDate someDate = 871508052513.0;
int32_t j, exp;
dateFormats[0] = DateFormat::createDateTimeInstance(DateFormat::FULL, DateFormat::FULL, Locale::US);
dateFormats[1] = DateFormat::createDateTimeInstance(DateFormat::FULL, DateFormat::FULL, Locale::FRANCE);
dateFormats[0] = DateFormat::createDateTimeInstance(DateFormat::FULL, DateFormat::FULL, Locale::getUS());
dateFormats[1] = DateFormat::createDateTimeInstance(DateFormat::FULL, DateFormat::FULL, Locale::getFrance());
dateFormats[2] = new SimpleDateFormat((UnicodeString)"G, y, M, d, k, H, m, s, S, E, D, F, w, W, a, h, K, z, Y, e", status);
dateFormats[3] = new SimpleDateFormat((UnicodeString)"GGGG, yyyy, MMMM, dddd, kkkk, HHHH, mmmm, ssss, SSSS, EEEE, DDDD, FFFF, wwww, WWWW, aaaa, hhhh, KKKK, zzzz, YYYY, eeee", status);
for (j = 0, exp = 0; j < dateFormats_length;++j) {

View File

@ -23,7 +23,7 @@ CollationFrenchTest::CollationFrenchTest()
: myCollation(0)
{
UErrorCode status = U_ZERO_ERROR;
myCollation = Collator::createInstance(Locale::FRANCE, status);
myCollation = Collator::createInstance(Locale::getFrance(), status);
if(!myCollation || U_FAILURE(status)) {
errln(__FILE__ "failed to create! err " + UnicodeString(u_errorName(status)));
/* if it wasn't already: */

View File

@ -1071,7 +1071,7 @@ IntlTestRBNF::TestFrenchSpellout()
{
UErrorCode status = U_ZERO_ERROR;
RuleBasedNumberFormat* formatter
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale::FRANCE, status);
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale::getFrance(), status);
if (U_FAILURE(status)) {
errln("FAIL: could not construct formatter");

View File

@ -111,7 +111,7 @@ RbnfRoundTripTest::TestFrenchSpelloutRT()
{
UErrorCode status = U_ZERO_ERROR;
RuleBasedNumberFormat* formatter
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale::FRANCE, status);
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale::getFrance(), status);
if (U_FAILURE(status)) {
errln("failed to construct formatter");
@ -165,7 +165,7 @@ RbnfRoundTripTest::TestGermanSpelloutRT()
{
UErrorCode status = U_ZERO_ERROR;
RuleBasedNumberFormat* formatter
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale::GERMANY, status);
= new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale::getGermany(), status);
if (U_FAILURE(status)) {
errln("failed to construct formatter");

View File

@ -1038,12 +1038,12 @@ void IntlTestTextBoundary::TestGetDisplayName()
{
UnicodeString result;
BreakIterator::getDisplayName(Locale::US, result);
if (Locale::getDefault() == Locale::US && result != "English (United States)")
BreakIterator::getDisplayName(Locale::getUS(), result);
if (Locale::getDefault() == Locale::getUS() && result != "English (United States)")
errln("BreakIterator::getDisplayName() failed: expected \"English (United States)\", got \""
+ result);
BreakIterator::getDisplayName(Locale::FRANCE, Locale::US, result);
BreakIterator::getDisplayName(Locale::getFrance(), Locale::getUS(), result);
if (result != "French (France)")
errln("BreakIterator::getDisplayName() failed: expected \"French (France)\", got \""
+ result);

View File

@ -3,25 +3,11 @@
* Copyright (c) 1997-2001, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
#ifndef _COLL
#include "unicode/coll.h"
#endif
#ifndef _TBLCOLL
#include "unicode/tblcoll.h"
#endif
#ifndef _UNISTR
#include "unicode/unistr.h"
#endif
#ifndef _SORTKEY
#include "unicode/sortkey.h"
#endif
#ifndef _JACOLL
#include "jacoll.h"
#endif
#include "sfwdchit.h"
@ -29,13 +15,13 @@ CollationKanaTest::CollationKanaTest()
: myCollation(0)
{
UErrorCode status = U_ZERO_ERROR;
myCollation = Collator::createInstance(Locale::JAPAN, status);
myCollation = Collator::createInstance(Locale::getJapan(), status);
if(!myCollation || U_FAILURE(status)) {
errln(__FILE__ "failed to create! err " + UnicodeString(u_errorName(status)));
/* if it wasn't already: */
delete myCollation;
myCollation = NULL;
return;
errln(__FILE__ "failed to create! err " + UnicodeString(u_errorName(status)));
/* if it wasn't already: */
delete myCollation;
myCollation = NULL;
return;
}
myCollation->setDecomposition(Normalizer::DECOMP);

View File

@ -184,6 +184,7 @@ void LocaleTest::runIndexedTest( int32_t index, UBool exec, const char* &name, c
CASE(22, TestVariantParsing)
CASE(23, Test4105828)
CASE(24, TestSetIsBogus)
CASE(25, TestParallelAPIValues)
default: name = ""; break; //needed to end loop
}
@ -225,7 +226,7 @@ void LocaleTest::TestBasicGetters() {
if (testLocale.getVariant()[0] != 0)
errln(" Variant code mismatch: something versus \"\"");
}
/*tests for the depracted API*/
#ifdef ICU_LOCID_USE_DEPRECATES
for (i = 0; i <= MAX_LOCALES; i++) {
@ -287,6 +288,76 @@ void LocaleTest::TestBasicGetters() {
// country code, so we no longer support this feature.
}
void LocaleTest::TestParallelAPIValues() {
logln("Test synchronization between C and C++ API");
if (strcmp(Locale::getChinese().getName(), ULOC_CHINESE) != 0) {
errln("Differences for ULOC_CHINESE Locale");
}
if (strcmp(Locale::getEnglish().getName(), ULOC_ENGLISH) != 0) {
errln("Differences for ULOC_ENGLISH Locale");
}
if (strcmp(Locale::getFrench().getName(), ULOC_FRENCH) != 0) {
errln("Differences for ULOC_FRENCH Locale");
}
if (strcmp(Locale::getGerman().getName(), ULOC_GERMAN) != 0) {
errln("Differences for ULOC_GERMAN Locale");
}
if (strcmp(Locale::getItalian().getName(), ULOC_ITALIAN) != 0) {
errln("Differences for ULOC_ITALIAN Locale");
}
if (strcmp(Locale::getJapanese().getName(), ULOC_JAPANESE) != 0) {
errln("Differences for ULOC_JAPANESE Locale");
}
if (strcmp(Locale::getKorean().getName(), ULOC_KOREAN) != 0) {
errln("Differences for ULOC_KOREAN Locale");
}
if (strcmp(Locale::getSimplifiedChinese().getName(), ULOC_SIMPLIFIED_CHINESE) != 0) {
errln("Differences for ULOC_SIMPLIFIED_CHINESE Locale");
}
if (strcmp(Locale::getTraditionalChinese().getName(), ULOC_TRADITIONAL_CHINESE) != 0) {
errln("Differences for ULOC_TRADITIONAL_CHINESE Locale");
}
if (strcmp(Locale::getCanada().getName(), ULOC_CANADA) != 0) {
errln("Differences for ULOC_CANADA Locale");
}
if (strcmp(Locale::getCanadaFrench().getName(), ULOC_CANADA_FRENCH) != 0) {
errln("Differences for ULOC_CANADA_FRENCH Locale");
}
if (strcmp(Locale::getChina().getName(), ULOC_CHINA) != 0) {
errln("Differences for ULOC_CHINA Locale");
}
if (strcmp(Locale::getPRC().getName(), ULOC_PRC) != 0) {
errln("Differences for ULOC_PRC Locale");
}
if (strcmp(Locale::getFrance().getName(), ULOC_FRANCE) != 0) {
errln("Differences for ULOC_FRANCE Locale");
}
if (strcmp(Locale::getGermany().getName(), ULOC_GERMANY) != 0) {
errln("Differences for ULOC_GERMANY Locale");
}
if (strcmp(Locale::getItaly().getName(), ULOC_ITALY) != 0) {
errln("Differences for ULOC_ITALY Locale");
}
if (strcmp(Locale::getJapan().getName(), ULOC_JAPAN) != 0) {
errln("Differences for ULOC_JAPAN Locale");
}
if (strcmp(Locale::getKorea().getName(), ULOC_KOREA) != 0) {
errln("Differences for ULOC_KOREA Locale");
}
if (strcmp(Locale::getTaiwan().getName(), ULOC_TAIWAN) != 0) {
errln("Differences for ULOC_TAIWAN Locale");
}
if (strcmp(Locale::getUK().getName(), ULOC_UK) != 0) {
errln("Differences for ULOC_UK Locale");
}
if (strcmp(Locale::getUS().getName(), ULOC_US) != 0) {
errln("Differences for ULOC_US Locale");
}
}
void LocaleTest::TestSimpleResourceInfo() {
UnicodeString temp;
char temp2[20];
@ -1088,10 +1159,10 @@ LocaleTest::TestAtypicalLocales()
int32_t i;
UErrorCode status = U_ZERO_ERROR;
Locale::setDefault(Locale::US, status);
Locale::setDefault(Locale::getUS(), status);
for (i = 0; i < 9; ++i) {
UnicodeString name;
localesToTest[i].getDisplayName(Locale::US, name);
localesToTest[i].getDisplayName(Locale::getUS(), name);
logln(name);
if (name != englishDisplayNames[i])
{
@ -1112,7 +1183,7 @@ LocaleTest::TestAtypicalLocales()
for (i = 0; i < 9; i++) {
UnicodeString name;
localesToTest[i].getDisplayName(Locale::FRANCE, name);
localesToTest[i].getDisplayName(Locale::getFrance(), name);
logln(name);
if (name != frenchDisplayNames[i])
errln("Lookup in French failed: expected \"" + frenchDisplayNames[i]
@ -1458,14 +1529,14 @@ LocaleTest::TestVariantParsing()
UnicodeString got;
en_US_custom.getDisplayVariant(Locale::US, got);
en_US_custom.getDisplayVariant(Locale::getUS(), got);
if(got != dispVar) {
errln("FAIL: getDisplayVariant()");
errln("Wanted: " + dispVar);
errln("Got : " + got);
}
en_US_custom.getDisplayName(Locale::US, got);
en_US_custom.getDisplayName(Locale::getUS(), got);
if(got != dispName) {
errln("FAIL: getDisplayName()");
errln("Wanted: " + dispName);
@ -1517,7 +1588,7 @@ LocaleTest::TestVariantParsing()
void
LocaleTest::Test4105828()
{
Locale LOC [] = { Locale::CHINESE, Locale("zh", "CN", ""),
Locale LOC [] = { Locale::getChinese(), Locale("zh", "CN", ""),
Locale("zh", "TW", ""), Locale("zh", "HK", "") };
UErrorCode status = U_ZERO_ERROR;
for (int32_t i = 0; i < 4; ++i) {

View File

@ -21,6 +21,10 @@ public:
* Test methods to set and get data fields
**/
void TestBasicGetters(void);
/**
* Test methods to set and get data fields
**/
void TestParallelAPIValues(void);
/**
* Use Locale to access Resource file data and compare against expected values
**/

View File

@ -87,7 +87,7 @@ void
NumberFormatTest::TestPatterns(void)
{
UErrorCode status = U_ZERO_ERROR;
DecimalFormatSymbols sym(Locale::US, status);
DecimalFormatSymbols sym(Locale::getUS(), status);
if (U_FAILURE(status)) { errln("FAIL: Could not construct DecimalFormatSymbols"); return; }
const char* pat[] = { "#.#", "#.", ".#", "#" };
@ -121,7 +121,7 @@ void
NumberFormatTest::TestExponential(void)
{
UErrorCode status = U_ZERO_ERROR;
DecimalFormatSymbols sym(Locale::US, status);
DecimalFormatSymbols sym(Locale::getUS(), status);
if (U_FAILURE(status)) { errln("FAIL: Bad status returned by DecimalFormatSymbols ct"); return; }
const char* pat[] = { "0.####E0", "00.000E00", "##0.######E000", "0.###E0;[0.###E0]" };
int32_t pat_length = (int32_t)(sizeof(pat) / sizeof(pat[0]));
@ -301,7 +301,7 @@ NumberFormatTest::TestQuotes(void)
{
UErrorCode status = U_ZERO_ERROR;
UnicodeString *pat;
DecimalFormatSymbols *sym = new DecimalFormatSymbols(Locale::US, status);
DecimalFormatSymbols *sym = new DecimalFormatSymbols(Locale::getUS(), status);
pat = new UnicodeString("a'fo''o'b#");
DecimalFormat *fmt = new DecimalFormat(*pat, *sym, status);
UnicodeString s;
@ -334,7 +334,7 @@ void
NumberFormatTest::TestCurrencySign(void)
{
UErrorCode status = U_ZERO_ERROR;
DecimalFormatSymbols* sym = new DecimalFormatSymbols(Locale::US, status);
DecimalFormatSymbols* sym = new DecimalFormatSymbols(Locale::getUS(), status);
UnicodeString pat;
UChar currency = 0x00A4;
// "\xA4#,##0.00;-\xA4#,##0.00"
@ -405,24 +405,28 @@ void
NumberFormatTest::TestCurrency(void)
{
UErrorCode status = U_ZERO_ERROR;
NumberFormat* currencyFmt = NumberFormat::createCurrencyInstance(Locale::CANADA_FRENCH, status);
NumberFormat* currencyFmt = NumberFormat::createCurrencyInstance(Locale::getCanadaFrench(), status);
UnicodeString s; currencyFmt->format(1.50, s);
logln((UnicodeString)"Un pauvre ici a..........." + s);
if (!(s=="1,50 $")) errln((UnicodeString)"FAIL: Expected 1,50 $");
if (!(s=="1,50 $"))
errln((UnicodeString)"FAIL: Expected 1,50 $");
delete currencyFmt;
s.truncate(0);
currencyFmt = NumberFormat::createCurrencyInstance(Locale("de_DE_PREEURO"),status);
currencyFmt->format(1.50, s);
logln((UnicodeString)"Un pauvre en Allemagne a.." + s);
if (!(s=="1,50 DM")) errln((UnicodeString)"FAIL: Expected 1,50 DM");
if (!(s=="1,50 DM"))
errln((UnicodeString)"FAIL: Expected 1,50 DM");
delete currencyFmt;
s.truncate(0);
currencyFmt = NumberFormat::createCurrencyInstance(Locale("fr_FR_PREEURO"), status);
currencyFmt->format(1.50, s);
logln((UnicodeString)"Un pauvre en France a....." + s);
if (!(s=="1,50 F")) errln((UnicodeString)"FAIL: Expected 1,50 F");
if (!(s=="1,50 F"))
errln((UnicodeString)"FAIL: Expected 1,50 F");
delete currencyFmt;
if (U_FAILURE(status)) errln((UnicodeString)"FAIL: Status " + (int32_t)status);
if (U_FAILURE(status))
errln((UnicodeString)"FAIL: Status " + (int32_t)status);
}
// -------------------------------------
@ -475,7 +479,7 @@ NumberFormatTest::TestRounding487(void)
*/
void NumberFormatTest::TestSecondaryGrouping(void) {
UErrorCode status = U_ZERO_ERROR;
DecimalFormatSymbols US(Locale::US, status);
DecimalFormatSymbols US(Locale::getUS(), status);
CHECK(status, "DecimalFormatSymbols ct");
DecimalFormat f("#,##,###", US, status);
@ -601,7 +605,7 @@ void NumberFormatTest::expect(NumberFormat* fmt, const Formattable& n,
*/
void NumberFormatTest::TestExponent(void) {
UErrorCode status = U_ZERO_ERROR;
DecimalFormatSymbols US(Locale::US, status);
DecimalFormatSymbols US(Locale::getUS(), status);
CHECK(status, "DecimalFormatSymbols constructor");
DecimalFormat fmt1(UnicodeString("0.###E0"), US, status);
CHECK(status, "DecimalFormat(0.###E0)");
@ -621,7 +625,7 @@ void NumberFormatTest::TestExponent(void) {
*/
void NumberFormatTest::TestScientific(void) {
UErrorCode status = U_ZERO_ERROR;
DecimalFormatSymbols US(Locale::US, status);
DecimalFormatSymbols US(Locale::getUS(), status);
CHECK(status, "DecimalFormatSymbols constructor");
// Test pattern round-trip
@ -675,7 +679,7 @@ void NumberFormatTest::TestScientific(void) {
// guarantee that the default locale has the same
// scientific format.
Locale def = Locale::getDefault();
Locale::setDefault(Locale::US, status);
Locale::setDefault(Locale::getUS(), status);
expect(NumberFormat::createScientificInstance(status),
12345.678901,
"1.2345678901E4", status);
@ -687,7 +691,7 @@ void NumberFormatTest::TestScientific(void) {
expect(new DecimalFormat("0E0", US, status),
12345.0,
"1E4", status);
expect(NumberFormat::createScientificInstance(Locale::US, status),
expect(NumberFormat::createScientificInstance(Locale::getUS(), status),
12345.678901,
"1.2345678901E4", status);
expect(new DecimalFormat("##0.###E0", US, status),
@ -699,7 +703,7 @@ void NumberFormatTest::TestScientific(void) {
expect(new DecimalFormat("##0.####E0", US, status),
(int32_t) 12345,
"12.345E3", status);
expect(NumberFormat::createScientificInstance(Locale::FRANCE, status),
expect(NumberFormat::createScientificInstance(Locale::getFrance(), status),
12345.678901,
"1,2345678901E4", status);
expect(new DecimalFormat("##0.####E0", US, status),
@ -801,7 +805,7 @@ void NumberFormatTest::TestScientific(void) {
*/
void NumberFormatTest::TestPad(void) {
UErrorCode status = U_ZERO_ERROR;
DecimalFormatSymbols US(Locale::US, status);
DecimalFormatSymbols US(Locale::getUS(), status);
CHECK(status, "DecimalFormatSymbols constructor");
expect(new DecimalFormat("*^##.##", US, status),
@ -917,7 +921,7 @@ void NumberFormatTest::TestPad(void) {
*/
void NumberFormatTest::TestPatterns2(void) {
UErrorCode status = U_ZERO_ERROR;
DecimalFormatSymbols US(Locale::US, status);
DecimalFormatSymbols US(Locale::getUS(), status);
CHECK(status, "DecimalFormatSymbols constructor");
DecimalFormat fmt("#", US, status);
@ -1022,7 +1026,7 @@ void NumberFormatTest::expectPat(DecimalFormat& fmt, const UnicodeString& exp) {
void NumberFormatTest::TestSurrogateSupport(void) {
UErrorCode status = U_ZERO_ERROR;
DecimalFormatSymbols custom(Locale::US, status);
DecimalFormatSymbols custom(Locale::getUS(), status);
CHECK(status, "DecimalFormatSymbols constructor");
custom.setSymbol(DecimalFormatSymbols::kDecimalSeparatorSymbol, "decimal");

View File

@ -366,7 +366,7 @@ void NumberFormatRegressionTest::Test4071492 (void)
void NumberFormatRegressionTest::Test4086575(void)
{
UErrorCode status = U_ZERO_ERROR;
NumberFormat *nf1 = NumberFormat::createInstance(Locale::FRANCE, status);
NumberFormat *nf1 = NumberFormat::createInstance(Locale::getFrance(), status);
failure(status, "NumberFormat::createInstance");
// C++ workaround to make sure cast works
@ -797,7 +797,7 @@ void NumberFormatRegressionTest::Test4071005 (void)
UnicodeString expectedPercent(chars3, 9, 9);
UErrorCode status = U_ZERO_ERROR;
formatter = NumberFormat::createInstance(Locale::CANADA_FRENCH, status);
formatter = NumberFormat::createInstance(Locale::getCanadaFrench(), status);
failure(status, "NumberFormat::createNumberInstance");
tempString = formatter->format (-5789.9876, tempString);
@ -810,7 +810,7 @@ void NumberFormatRegressionTest::Test4071005 (void)
}
delete formatter;
formatter = NumberFormat::createCurrencyInstance(Locale::CANADA_FRENCH, status);
formatter = NumberFormat::createCurrencyInstance(Locale::getCanadaFrench(), status);
failure(status, "NumberFormat::createCurrencyInstance");
tempString.remove();
tempString = formatter->format( 5789.9876, tempString );
@ -824,7 +824,7 @@ void NumberFormatRegressionTest::Test4071005 (void)
}
delete formatter;
formatter = NumberFormat::createPercentInstance(Locale::CANADA_FRENCH, status);
formatter = NumberFormat::createPercentInstance(Locale::getCanadaFrench(), status);
failure(status, "NumberFormat::createPercentInstance");
tempString.remove();
tempString = formatter->format (-5789.9876, tempString);
@ -885,7 +885,7 @@ void NumberFormatRegressionTest::Test4071014 (void)
}
delete formatter;
formatter = NumberFormat::createPercentInstance(Locale::GERMANY, status);
formatter = NumberFormat::createPercentInstance(Locale::getGermany(), status);
failure(status, "NumberFormat::createPercentInstance");
tempString.remove();
tempString = formatter->format (-5789.9876, tempString);

View File

@ -216,7 +216,7 @@ void CollationRegressionTest::Test4058613(/* char* par */)
Locale oldDefault = Locale::getDefault();
UErrorCode status = U_ZERO_ERROR;
Locale::setDefault(Locale::KOREAN, status);
Locale::setDefault(Locale::getKorean(), status);
if (U_FAILURE(status))
{
@ -358,11 +358,11 @@ void CollationRegressionTest::Test4062418(/* char* par */)
RuleBasedCollator *c = NULL;
c = (RuleBasedCollator *) Collator::createInstance(Locale::FRANCE, status);
c = (RuleBasedCollator *) Collator::createInstance(Locale::getFrance(), status);
if (c == NULL || U_FAILURE(status))
{
errln("Failed to create collator for Locale::FRANCE");
errln("Failed to create collator for Locale::getFrance()");
delete c;
return;
}
@ -437,11 +437,11 @@ void CollationRegressionTest::Test4066696(/* char* par */)
UErrorCode status = U_ZERO_ERROR;
RuleBasedCollator *c = NULL;
c = (RuleBasedCollator *)Collator::createInstance(Locale::FRANCE, status);
c = (RuleBasedCollator *)Collator::createInstance(Locale::getFrance(), status);
if (c == NULL || U_FAILURE(status))
{
errln("Failure creating collator for Locale::FRANCE");
errln("Failure creating collator for Locale::getFrance()");
delete c;
return;
}
@ -821,12 +821,12 @@ void CollationRegressionTest::Test4132736(/* char* par */)
Collator *c = NULL;
c = Collator::createInstance(Locale::FRANCE, status);
c = Collator::createInstance(Locale::getFrance(), status);
c->setStrength(Collator::TERTIARY);
if (c == NULL || U_FAILURE(status))
{
errln("Failed to create a collator for Locale::FRANCE");
errln("Failed to create a collator for Locale::getFrance()");
delete c;
}

View File

@ -627,14 +627,14 @@ void TestMessageFormat::testSetLocale()
errln("*** MSG format err.");
}
msg.setLocale(Locale::ENGLISH);
msg.setLocale(Locale::getEnglish());
UBool getLocale_ok = TRUE;
if (msg.getLocale() != Locale::ENGLISH) {
errln("*** MSG getLocal err.");
getLocale_ok = FALSE;
}
msg.setLocale(Locale::GERMAN);
msg.setLocale(Locale::getGerman());
if (msg.getLocale() != Locale::GERMAN) {
errln("*** MSG getLocal err.");