1 /******************************************************************** 2 * COPYRIGHT: 3 * Copyright (c) 1997-2012, International Business Machines 4 * Corporation and others. All Rights Reserved. 5 ********************************************************************/ 6 7 #include "unicode/utypes.h" 8 9 #if !UCONFIG_NO_FORMATTING 10 11 #include "dtfmttst.h" 12 #include "unicode/localpointer.h" 13 #include "unicode/timezone.h" 14 #include "unicode/gregocal.h" 15 #include "unicode/smpdtfmt.h" 16 #include "unicode/datefmt.h" 17 #include "unicode/dtptngen.h" 18 #include "unicode/simpletz.h" 19 #include "unicode/strenum.h" 20 #include "unicode/dtfmtsym.h" 21 #include "cmemory.h" 22 #include "cstring.h" 23 #include "caltest.h" // for fieldName 24 #include <stdio.h> // for sprintf 25 26 #if U_PLATFORM_HAS_WIN32_API 27 #include "windttst.h" 28 #endif 29 30 #define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0])) 31 32 #define ARRAY_SIZE(array) (sizeof array / sizeof array[0]) 33 34 #define ASSERT_OK(status) if(U_FAILURE(status)) {errcheckln(status, #status " = %s @ %s:%d", u_errorName(status), __FILE__, __LINE__); return; } 35 36 // ***************************************************************************** 37 // class DateFormatTest 38 // ***************************************************************************** 39 40 void DateFormatTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ ) 41 { 42 if(exec) { 43 logln("TestSuite DateFormatTest: "); 44 } 45 TESTCASE_AUTO_BEGIN; 46 TESTCASE_AUTO(TestPatterns); 47 TESTCASE_AUTO(TestEquals); 48 TESTCASE_AUTO(TestTwoDigitYearDSTParse); 49 TESTCASE_AUTO(TestFieldPosition); 50 TESTCASE_AUTO(TestPartialParse994); 51 TESTCASE_AUTO(TestRunTogetherPattern985); 52 TESTCASE_AUTO(TestRunTogetherPattern917); 53 TESTCASE_AUTO(TestCzechMonths459); 54 TESTCASE_AUTO(TestLetterDPattern212); 55 TESTCASE_AUTO(TestDayOfYearPattern195); 56 TESTCASE_AUTO(TestQuotePattern161); 57 TESTCASE_AUTO(TestBadInput135); 58 TESTCASE_AUTO(TestBadInput135a); 59 TESTCASE_AUTO(TestTwoDigitYear); 60 TESTCASE_AUTO(TestDateFormatZone061); 61 TESTCASE_AUTO(TestDateFormatZone146); 62 TESTCASE_AUTO(TestLocaleDateFormat); 63 TESTCASE_AUTO(TestWallyWedel); 64 TESTCASE_AUTO(TestDateFormatCalendar); 65 TESTCASE_AUTO(TestSpaceParsing); 66 TESTCASE_AUTO(TestExactCountFormat); 67 TESTCASE_AUTO(TestWhiteSpaceParsing); 68 TESTCASE_AUTO(TestInvalidPattern); 69 TESTCASE_AUTO(TestGeneral); 70 TESTCASE_AUTO(TestGreekMay); 71 TESTCASE_AUTO(TestGenericTime); 72 TESTCASE_AUTO(TestGenericTimeZoneOrder); 73 TESTCASE_AUTO(TestHost); 74 TESTCASE_AUTO(TestEras); 75 TESTCASE_AUTO(TestNarrowNames); 76 TESTCASE_AUTO(TestStandAloneDays); 77 TESTCASE_AUTO(TestStandAloneMonths); 78 TESTCASE_AUTO(TestQuarters); 79 TESTCASE_AUTO(TestZTimeZoneParsing); 80 TESTCASE_AUTO(TestRelative); 81 TESTCASE_AUTO(TestRelativeClone); 82 TESTCASE_AUTO(TestHostClone); 83 TESTCASE_AUTO(TestTimeZoneDisplayName); 84 TESTCASE_AUTO(TestRoundtripWithCalendar); 85 TESTCASE_AUTO(Test6338); 86 TESTCASE_AUTO(Test6726); 87 TESTCASE_AUTO(TestGMTParsing); 88 TESTCASE_AUTO(Test6880); 89 TESTCASE_AUTO(TestISOEra); 90 TESTCASE_AUTO(TestFormalChineseDate); 91 TESTCASE_AUTO(TestNumberAsStringParsing); 92 TESTCASE_AUTO(TestStandAloneGMTParse); 93 TESTCASE_AUTO(TestParsePosition); 94 TESTCASE_AUTO(TestMonthPatterns); 95 TESTCASE_AUTO(TestContext); 96 TESTCASE_AUTO(TestNonGregoFmtParse); 97 /* 98 TESTCASE_AUTO(TestRelativeError); 99 TESTCASE_AUTO(TestRelativeOther); 100 */ 101 TESTCASE_AUTO(TestDotAndAtLeniency); 102 TESTCASE_AUTO_END; 103 } 104 105 void DateFormatTest::TestPatterns() { 106 static const struct { 107 const char *actualPattern; 108 const char *expectedPattern; 109 const char *localeID; 110 const char *expectedLocalPattern; 111 } EXPECTED[] = { 112 {UDAT_YEAR, "y","en","y"}, 113 114 {UDAT_QUARTER, "QQQQ", "en", "QQQQ"}, 115 {UDAT_ABBR_QUARTER, "QQQ", "en", "QQQ"}, 116 {UDAT_YEAR_QUARTER, "yQQQQ", "en", "QQQQ y"}, 117 {UDAT_YEAR_ABBR_QUARTER, "yQQQ", "en", "QQQ y"}, 118 119 {UDAT_NUM_MONTH, "M", "en", "L"}, 120 {UDAT_ABBR_MONTH, "MMM", "en", "LLL"}, 121 {UDAT_MONTH, "MMMM", "en", "LLLL"}, 122 {UDAT_YEAR_NUM_MONTH, "yM","en","M/y"}, 123 {UDAT_YEAR_ABBR_MONTH, "yMMM","en","MMM y"}, 124 {UDAT_YEAR_MONTH, "yMMMM","en","MMMM y"}, 125 126 {UDAT_DAY, "d","en","d"}, 127 {UDAT_YEAR_NUM_MONTH_DAY, "yMd", "en", "M/d/y"}, 128 {UDAT_YEAR_ABBR_MONTH_DAY, "yMMMd", "en", "MMM d, y"}, 129 {UDAT_YEAR_MONTH_DAY, "yMMMMd", "en", "MMMM d, y"}, 130 {UDAT_YEAR_NUM_MONTH_WEEKDAY_DAY, "yMEd", "en", "EEE, M/d/y"}, 131 {UDAT_YEAR_ABBR_MONTH_WEEKDAY_DAY, "yMMMEd", "en", "EEE, MMM d, y"}, 132 {UDAT_YEAR_MONTH_WEEKDAY_DAY, "yMMMMEEEEd", "en", "EEEE, MMMM d, y"}, 133 134 {UDAT_NUM_MONTH_DAY, "Md","en","M/d"}, 135 {UDAT_ABBR_MONTH_DAY, "MMMd","en","MMM d"}, 136 {UDAT_MONTH_DAY, "MMMMd","en","MMMM d"}, 137 {UDAT_NUM_MONTH_WEEKDAY_DAY, "MEd","en","EEE, M/d"}, 138 {UDAT_ABBR_MONTH_WEEKDAY_DAY, "MMMEd","en","EEE, MMM d"}, 139 {UDAT_MONTH_WEEKDAY_DAY, "MMMMEEEEd","en","EEEE, MMMM d"}, 140 141 {UDAT_HOUR, "j", "en", "h a"}, // (fixed expected result per ticket 6872<-6626) 142 {UDAT_HOUR24, "H", "en", "HH"}, // (fixed expected result per ticket 6872<-6626 143 144 {UDAT_MINUTE, "m", "en", "m"}, 145 {UDAT_HOUR_MINUTE, "jm","en","h:mm a"}, // (fixed expected result per ticket 6872<-7180) 146 {UDAT_HOUR24_MINUTE, "Hm", "en", "HH:mm"}, // (fixed expected result per ticket 6872<-6626) 147 148 {UDAT_SECOND, "s", "en", "s"}, 149 {UDAT_HOUR_MINUTE_SECOND, "jms","en","h:mm:ss a"}, // (fixed expected result per ticket 6872<-7180) 150 {UDAT_HOUR24_MINUTE_SECOND, "Hms","en","HH:mm:ss"}, // (fixed expected result per ticket 6872<-6626) 151 {UDAT_MINUTE_SECOND, "ms", "en", "mm:ss"}, // (fixed expected result per ticket 6872<-6626) 152 153 {UDAT_LOCATION_TZ, "VVVV", "en", "VVVV"}, 154 {UDAT_GENERIC_TZ, "vvvv", "en", "vvvv"}, 155 {UDAT_ABBR_GENERIC_TZ, "v", "en", "v"}, 156 {UDAT_SPECIFIC_TZ, "zzzz", "en", "zzzz"}, 157 {UDAT_ABBR_SPECIFIC_TZ, "z", "en", "z"}, 158 {UDAT_ABBR_UTC_TZ, "ZZZZ", "en", "ZZZZ"}, 159 160 {UDAT_YEAR_NUM_MONTH_DAY UDAT_ABBR_UTC_TZ, "yMdZZZZ", "en", "M/d/y, ZZZZ"}, 161 {UDAT_MONTH_DAY UDAT_LOCATION_TZ, "MMMMdVVVV", "en", "MMMM d, VVVV"} 162 }; 163 164 IcuTestErrorCode errorCode(*this, "TestPatterns()"); 165 for (int32_t i = 0; i < LENGTHOF(EXPECTED); i++) { 166 // Verify that patterns have the correct values 167 UnicodeString actualPattern(EXPECTED[i].actualPattern, -1, US_INV); 168 UnicodeString expectedPattern(EXPECTED[i].expectedPattern, -1, US_INV); 169 Locale locale(EXPECTED[i].localeID); 170 if (actualPattern != expectedPattern) { 171 errln("FAILURE! Expected pattern: " + expectedPattern + 172 " but was: " + actualPattern); 173 } 174 175 // Verify that DataFormat instances produced contain the correct 176 // localized patterns 177 // TODO: use DateFormat::getInstanceForSkeleton(), ticket #9029 178 // Java test code: 179 // DateFormat date1 = DateFormat.getPatternInstance(actualPattern, 180 // locale); 181 // DateFormat date2 = DateFormat.getPatternInstance(Calendar.getInstance(locale), 182 // actualPattern, locale); 183 LocalPointer<DateTimePatternGenerator> generator( 184 DateTimePatternGenerator::createInstance(locale, errorCode)); 185 if(errorCode.logDataIfFailureAndReset("DateTimePatternGenerator::createInstance() failed for locale ID \"%s\"", EXPECTED[i].localeID)) { 186 continue; 187 } 188 UnicodeString pattern = generator->getBestPattern(actualPattern, errorCode); 189 SimpleDateFormat date1(pattern, locale, errorCode); 190 SimpleDateFormat date2(pattern, locale, errorCode); 191 date2.adoptCalendar(Calendar::createInstance(locale, errorCode)); 192 if(errorCode.logIfFailureAndReset("DateFormat::getInstanceForSkeleton() failed")) { 193 errln(" for actualPattern \"%s\" & locale ID \"%s\"", 194 EXPECTED[i].actualPattern, EXPECTED[i].localeID); 195 continue; 196 } 197 198 UnicodeString expectedLocalPattern(EXPECTED[i].expectedLocalPattern, -1, US_INV); 199 UnicodeString actualLocalPattern1; 200 UnicodeString actualLocalPattern2; 201 date1.toLocalizedPattern(actualLocalPattern1, errorCode); 202 date2.toLocalizedPattern(actualLocalPattern2, errorCode); 203 if (actualLocalPattern1 != expectedLocalPattern) { 204 errln("FAILURE! Expected local pattern: " + expectedLocalPattern 205 + " but was: " + actualLocalPattern1); 206 } 207 if (actualLocalPattern2 != expectedLocalPattern) { 208 errln("FAILURE! Expected local pattern: " + expectedLocalPattern 209 + " but was: " + actualLocalPattern2); 210 } 211 } 212 } 213 214 // Test written by Wally Wedel and emailed to me. 215 void DateFormatTest::TestWallyWedel() 216 { 217 UErrorCode status = U_ZERO_ERROR; 218 /* 219 * Instantiate a TimeZone so we can get the ids. 220 */ 221 TimeZone *tz = new SimpleTimeZone(7,""); 222 /* 223 * Computational variables. 224 */ 225 int32_t offset, hours, minutes, seconds; 226 /* 227 * Instantiate a SimpleDateFormat set up to produce a full time 228 zone name. 229 */ 230 SimpleDateFormat *sdf = new SimpleDateFormat((UnicodeString)"zzzz", status); 231 /* 232 * A String array for the time zone ids. 233 */ 234 int32_t ids_length; 235 StringEnumeration* ids = TimeZone::createEnumeration(); 236 if (ids == NULL) { 237 dataerrln("Unable to create TimeZone enumeration."); 238 if (sdf != NULL) { 239 delete sdf; 240 } 241 return; 242 } 243 ids_length = ids->count(status); 244 /* 245 * How many ids do we have? 246 */ 247 logln("Time Zone IDs size: %d", ids_length); 248 /* 249 * Column headings (sort of) 250 */ 251 logln("Ordinal ID offset(h:m) name"); 252 /* 253 * Loop through the tzs. 254 */ 255 UDate today = Calendar::getNow(); 256 Calendar *cal = Calendar::createInstance(status); 257 for (int32_t i = 0; i < ids_length; i++) { 258 // logln(i + " " + ids[i]); 259 const UnicodeString* id = ids->snext(status); 260 TimeZone *ttz = TimeZone::createTimeZone(*id); 261 // offset = ttz.getRawOffset(); 262 cal->setTimeZone(*ttz); 263 cal->setTime(today, status); 264 offset = cal->get(UCAL_ZONE_OFFSET, status) + cal->get(UCAL_DST_OFFSET, status); 265 // logln(i + " " + ids[i] + " offset " + offset); 266 const char* sign = "+"; 267 if (offset < 0) { 268 sign = "-"; 269 offset = -offset; 270 } 271 hours = offset/3600000; 272 minutes = (offset%3600000)/60000; 273 seconds = (offset%60000)/1000; 274 UnicodeString dstOffset = (UnicodeString)"" + sign + (hours < 10 ? "0" : "") + 275 (int32_t)hours + ":" + (minutes < 10 ? "0" : "") + (int32_t)minutes; 276 if (seconds != 0) { 277 dstOffset = dstOffset + ":" + (seconds < 10 ? "0" : "") + seconds; 278 } 279 /* 280 * Instantiate a date so we can display the time zone name. 281 */ 282 sdf->setTimeZone(*ttz); 283 /* 284 * Format the output. 285 */ 286 UnicodeString fmtOffset; 287 FieldPosition pos(0); 288 sdf->format(today,fmtOffset, pos); 289 // UnicodeString fmtOffset = tzS.toString(); 290 UnicodeString *fmtDstOffset = 0; 291 if (fmtOffset.startsWith("GMT") && fmtOffset.length() != 3) 292 { 293 //fmtDstOffset = fmtOffset->substring(3); 294 fmtDstOffset = new UnicodeString(); 295 fmtOffset.extract(3, fmtOffset.length(), *fmtDstOffset); 296 } 297 /* 298 * Show our result. 299 */ 300 UBool ok = fmtDstOffset == 0 || *fmtDstOffset == dstOffset; 301 if (ok) 302 { 303 logln(UnicodeString() + i + " " + *id + " " + dstOffset + 304 " " + fmtOffset + 305 (fmtDstOffset != 0 ? " ok" : " ?")); 306 } 307 else 308 { 309 errln(UnicodeString() + i + " " + *id + " " + dstOffset + 310 " " + fmtOffset + " *** FAIL ***"); 311 } 312 delete ttz; 313 delete fmtDstOffset; 314 } 315 delete cal; 316 // delete ids; // TODO: BAD API 317 delete ids; 318 delete sdf; 319 delete tz; 320 } 321 322 // ------------------------------------- 323 324 /** 325 * Test operator== 326 */ 327 void 328 DateFormatTest::TestEquals() 329 { 330 DateFormat* fmtA = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::FULL); 331 DateFormat* fmtB = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::FULL); 332 if ( fmtA == NULL || fmtB == NULL){ 333 dataerrln("Error calling DateFormat::createDateTimeInstance"); 334 delete fmtA; 335 delete fmtB; 336 return; 337 } 338 339 if (!(*fmtA == *fmtB)) errln((UnicodeString)"FAIL"); 340 delete fmtA; 341 delete fmtB; 342 343 TimeZone* test = TimeZone::createTimeZone("PDT"); 344 delete test; 345 } 346 347 // ------------------------------------- 348 349 /** 350 * Test the parsing of 2-digit years. 351 */ 352 void 353 DateFormatTest::TestTwoDigitYearDSTParse(void) 354 { 355 UErrorCode status = U_ZERO_ERROR; 356 SimpleDateFormat* fullFmt = new SimpleDateFormat((UnicodeString)"EEE MMM dd HH:mm:ss.SSS zzz yyyy G", status); 357 SimpleDateFormat *fmt = new SimpleDateFormat((UnicodeString)"dd-MMM-yy h:mm:ss 'o''clock' a z", Locale::getEnglish(), status); 358 //DateFormat* fmt = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::FULL, Locale::ENGLISH); 359 UnicodeString* s = new UnicodeString("03-Apr-04 2:20:47 o'clock AM PST", ""); 360 TimeZone* defaultTZ = TimeZone::createDefault(); 361 TimeZone* PST = TimeZone::createTimeZone("PST"); 362 int32_t defaultOffset = defaultTZ->getRawOffset(); 363 int32_t PSTOffset = PST->getRawOffset(); 364 int32_t hour = 2 + (defaultOffset - PSTOffset) / (60*60*1000); 365 // hour is the expected hour of day, in units of seconds 366 hour = ((hour < 0) ? hour + 24 : hour) * 60*60; 367 368 UnicodeString str; 369 370 if(U_FAILURE(status)) { 371 dataerrln("Could not set up test. exitting - %s", u_errorName(status)); 372 return; 373 } 374 375 UDate d = fmt->parse(*s, status); 376 logln(*s + " P> " + ((DateFormat*)fullFmt)->format(d, str)); 377 int32_t y, m, day, hr, min, sec; 378 dateToFields(d, y, m, day, hr, min, sec); 379 hour += defaultTZ->inDaylightTime(d, status) ? 1 : 0; 380 hr = hr*60*60; 381 if (hr != hour) 382 errln((UnicodeString)"FAIL: Should parse to hour " + hour + " but got " + hr); 383 384 if (U_FAILURE(status)) 385 errln((UnicodeString)"FAIL: " + (int32_t)status); 386 387 delete s; 388 delete fmt; 389 delete fullFmt; 390 delete PST; 391 delete defaultTZ; 392 } 393 394 // ------------------------------------- 395 396 UChar toHexString(int32_t i) { return (UChar)(i + (i < 10 ? 0x30 : (0x41 - 10))); } 397 398 UnicodeString& 399 DateFormatTest::escape(UnicodeString& s) 400 { 401 UnicodeString buf; 402 for (int32_t i=0; i<s.length(); ++i) 403 { 404 UChar c = s[(int32_t)i]; 405 if (c <= (UChar)0x7F) buf += c; 406 else { 407 buf += (UChar)0x5c; buf += (UChar)0x55; 408 buf += toHexString((c & 0xF000) >> 12); 409 buf += toHexString((c & 0x0F00) >> 8); 410 buf += toHexString((c & 0x00F0) >> 4); 411 buf += toHexString(c & 0x000F); 412 } 413 } 414 return (s = buf); 415 } 416 417 // ------------------------------------- 418 419 /** 420 * This MUST be kept in sync with DateFormatSymbols.gPatternChars. 421 */ 422 static const char* PATTERN_CHARS = "GyMdkHmsSEDFwWahKzYeugAZvcLQqVU"; 423 424 /** 425 * A list of the names of all the fields in DateFormat. 426 * This MUST be kept in sync with DateFormat. 427 */ 428 static const char* DATEFORMAT_FIELD_NAMES[] = { 429 "ERA_FIELD", 430 "YEAR_FIELD", 431 "MONTH_FIELD", 432 "DATE_FIELD", 433 "HOUR_OF_DAY1_FIELD", 434 "HOUR_OF_DAY0_FIELD", 435 "MINUTE_FIELD", 436 "SECOND_FIELD", 437 "MILLISECOND_FIELD", 438 "DAY_OF_WEEK_FIELD", 439 "DAY_OF_YEAR_FIELD", 440 "DAY_OF_WEEK_IN_MONTH_FIELD", 441 "WEEK_OF_YEAR_FIELD", 442 "WEEK_OF_MONTH_FIELD", 443 "AM_PM_FIELD", 444 "HOUR1_FIELD", 445 "HOUR0_FIELD", 446 "TIMEZONE_FIELD", 447 "YEAR_WOY_FIELD", 448 "DOW_LOCAL_FIELD", 449 "EXTENDED_YEAR_FIELD", 450 "JULIAN_DAY_FIELD", 451 "MILLISECONDS_IN_DAY_FIELD", 452 "TIMEZONE_RFC_FIELD", 453 "GENERIC_TIMEZONE_FIELD", 454 "STAND_ALONE_DAY_FIELD", 455 "STAND_ALONE_MONTH_FIELD", 456 "QUARTER_FIELD", 457 "STAND_ALONE_QUARTER_FIELD", 458 "TIMEZONE_SPECIAL_FIELD", 459 "YEAR_NAME_FIELD" 460 }; 461 462 static const int32_t DATEFORMAT_FIELD_NAMES_LENGTH = 463 sizeof(DATEFORMAT_FIELD_NAMES) / sizeof(DATEFORMAT_FIELD_NAMES[0]); 464 465 /** 466 * Verify that returned field position indices are correct. 467 */ 468 void DateFormatTest::TestFieldPosition() { 469 UErrorCode ec = U_ZERO_ERROR; 470 int32_t i, j, exp; 471 UnicodeString buf; 472 473 // Verify data 474 DateFormatSymbols rootSyms(Locale(""), ec); 475 if (U_FAILURE(ec)) { 476 dataerrln("Unable to create DateFormatSymbols - %s", u_errorName(ec)); 477 return; 478 } 479 480 // local pattern chars data is not longer loaded 481 // from icu locale bundle 482 assertEquals("patternChars", PATTERN_CHARS, rootSyms.getLocalPatternChars(buf)); 483 assertEquals("patternChars", PATTERN_CHARS, DateFormatSymbols::getPatternUChars()); 484 assertTrue("DATEFORMAT_FIELD_NAMES", DATEFORMAT_FIELD_NAMES_LENGTH == UDAT_FIELD_COUNT); 485 assertTrue("Data", UDAT_FIELD_COUNT == uprv_strlen(PATTERN_CHARS)); 486 487 // Create test formatters 488 const int32_t COUNT = 4; 489 DateFormat* dateFormats[COUNT]; 490 dateFormats[0] = DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, Locale::getUS()); 491 dateFormats[1] = DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, Locale::getFrance()); 492 // Make the pattern "G y M d..." 493 buf.remove().append(PATTERN_CHARS); 494 for (j=buf.length()-1; j>=0; --j) buf.insert(j, (UChar)32/*' '*/); 495 dateFormats[2] = new SimpleDateFormat(buf, Locale::getUS(), ec); 496 // Make the pattern "GGGG yyyy MMMM dddd..." 497 for (j=buf.length()-1; j>=0; j-=2) { 498 for (i=0; i<3; ++i) { 499 buf.insert(j, buf.charAt(j)); 500 } 501 } 502 dateFormats[3] = new SimpleDateFormat(buf, Locale::getUS(), ec); 503 if(U_FAILURE(ec)){ 504 errln(UnicodeString("Could not create SimpleDateFormat object for locale en_US. Error: " )+ UnicodeString(u_errorName(ec))); 505 return; 506 } 507 UDate aug13 = 871508052513.0; 508 509 // Expected output field values for above DateFormats on aug13 510 // Fields are given in order of DateFormat field number 511 const char* EXPECTED[] = { 512 "", "1997", "August", "13", "", "", "34", "12", "", 513 "Wednesday", "", "", "", "", "PM", "2", "", "Pacific Daylight Time", "", "", "", "", "", "", "", "", "", "", "","","", 514 515 "", "1997", "ao\\u00FBt", "13", "", "14", "34", "12", "", 516 "mercredi", "", "", "", "", "", "", "", "heure avanc\\u00e9e du Pacifique", "", "", "", "", "", "", "", "", "", "", "", "","", 517 518 "AD", "1997", "8", "13", "14", "14", "34", "12", "5", 519 "Wed", "225", "2", "33", "3", "PM", "2", "2", "PDT", "1997", "4", "1997", "2450674", "52452513", "-0700", "PT", "4", "8", "3", "3","PDT","1997", 520 521 "Anno Domini", "1997", "August", "0013", "0014", "0014", "0034", "0012", "5130", 522 "Wednesday", "0225", "0002", "0033", "0003", "PM", "0002", "0002", "Pacific Daylight Time", "1997", "Wednesday", "1997", "2450674", "52452513", "GMT-07:00", 523 "Pacific Time", "Wednesday", "August", "3rd quarter", "3rd quarter", "Los Angeles Time","1997" 524 }; 525 526 const int32_t EXPECTED_LENGTH = sizeof(EXPECTED)/sizeof(EXPECTED[0]); 527 528 assertTrue("data size", EXPECTED_LENGTH == COUNT * UDAT_FIELD_COUNT); 529 530 TimeZone* PT = TimeZone::createTimeZone("America/Los_Angeles"); 531 for (j = 0, exp = 0; j < COUNT; ++j) { 532 // String str; 533 DateFormat* df = dateFormats[j]; 534 df->setTimeZone(*PT); 535 SimpleDateFormat* sdtfmt = dynamic_cast<SimpleDateFormat*>(df); 536 if (sdtfmt != NULL) { 537 logln(" Pattern = " + sdtfmt->toPattern(buf.remove())); 538 } else { 539 logln(" Pattern = ? (not a SimpleDateFormat)"); 540 } 541 logln((UnicodeString)" Result = " + df->format(aug13, buf.remove())); 542 543 int32_t expBase = exp; // save for later 544 for (i = 0; i < UDAT_FIELD_COUNT; ++i, ++exp) { 545 FieldPosition pos(i); 546 buf.remove(); 547 df->format(aug13, buf, pos); 548 UnicodeString field; 549 buf.extractBetween(pos.getBeginIndex(), pos.getEndIndex(), field); 550 assertEquals((UnicodeString)"field #" + i + " " + DATEFORMAT_FIELD_NAMES[i], 551 ctou(EXPECTED[exp]), field); 552 } 553 554 // test FieldPositionIterator API 555 logln("FieldPositionIterator"); 556 { 557 UErrorCode status = U_ZERO_ERROR; 558 FieldPositionIterator posIter; 559 FieldPosition fp; 560 561 buf.remove(); 562 df->format(aug13, buf, &posIter, status); 563 while (posIter.next(fp)) { 564 int32_t i = fp.getField(); 565 UnicodeString field; 566 buf.extractBetween(fp.getBeginIndex(), fp.getEndIndex(), field); 567 assertEquals((UnicodeString)"field #" + i + " " + DATEFORMAT_FIELD_NAMES[i], 568 ctou(EXPECTED[expBase + i]), field); 569 } 570 571 } 572 } 573 574 575 // test null posIter 576 buf.remove(); 577 UErrorCode status = U_ZERO_ERROR; 578 dateFormats[0]->format(aug13, buf, NULL, status); 579 // if we didn't crash, we succeeded. 580 581 for (i=0; i<COUNT; ++i) { 582 delete dateFormats[i]; 583 } 584 delete PT; 585 } 586 587 // ------------------------------------- 588 589 /** 590 * General parse/format tests. Add test cases as needed. 591 */ 592 void DateFormatTest::TestGeneral() { 593 const char* DATA[] = { 594 "yyyy MM dd HH:mm:ss.SSS", 595 596 // Milliseconds are left-justified, since they format as fractions of a second 597 "y/M/d H:mm:ss.S", "fp", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.5", "2004 03 10 16:36:31.500", 598 "y/M/d H:mm:ss.SS", "fp", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.56", "2004 03 10 16:36:31.560", 599 "y/M/d H:mm:ss.SSS", "F", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.567", 600 "y/M/d H:mm:ss.SSSS", "pf", "2004/3/10 16:36:31.5679", "2004 03 10 16:36:31.568", "2004/3/10 16:36:31.5680", 601 }; 602 expect(DATA, ARRAY_SIZE(DATA), Locale("en", "", "")); 603 } 604 605 // ------------------------------------- 606 607 /** 608 * Verify that strings which contain incomplete specifications are parsed 609 * correctly. In some instances, this means not being parsed at all, and 610 * returning an appropriate error. 611 */ 612 void 613 DateFormatTest::TestPartialParse994() 614 { 615 UErrorCode status = U_ZERO_ERROR; 616 SimpleDateFormat* f = new SimpleDateFormat(status); 617 if (U_FAILURE(status)) { 618 dataerrln("Fail new SimpleDateFormat: %s", u_errorName(status)); 619 delete f; 620 return; 621 } 622 UDate null = 0; 623 tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17 10:11:42", date(97, 1 - 1, 17, 10, 11, 42)); 624 tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17 10:", null); 625 tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17 10", null); 626 tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17 ", null); 627 tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17", null); 628 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status); 629 delete f; 630 } 631 632 // ------------------------------------- 633 634 void 635 DateFormatTest::tryPat994(SimpleDateFormat* format, const char* pat, const char* str, UDate expected) 636 { 637 UErrorCode status = U_ZERO_ERROR; 638 UDate null = 0; 639 logln(UnicodeString("Pattern \"") + pat + "\" String \"" + str + "\""); 640 //try { 641 format->applyPattern(pat); 642 UDate date = format->parse(str, status); 643 if (U_FAILURE(status) || date == null) 644 { 645 logln((UnicodeString)"ParseException: " + (int32_t)status); 646 if (expected != null) errln((UnicodeString)"FAIL: Expected " + dateToString(expected)); 647 } 648 else 649 { 650 UnicodeString f; 651 ((DateFormat*)format)->format(date, f); 652 logln(UnicodeString(" parse(") + str + ") -> " + dateToString(date)); 653 logln((UnicodeString)" format -> " + f); 654 if (expected == null || 655 !(date == expected)) errln((UnicodeString)"FAIL: Expected null");//" + expected); 656 if (!(f == str)) errln(UnicodeString("FAIL: Expected ") + str); 657 } 658 //} 659 //catch(ParseException e) { 660 // logln((UnicodeString)"ParseException: " + e.getMessage()); 661 // if (expected != null) errln((UnicodeString)"FAIL: Expected " + dateToString(expected)); 662 //} 663 //catch(Exception e) { 664 // errln((UnicodeString)"*** Exception:"); 665 // e.printStackTrace(); 666 //} 667 } 668 669 // ------------------------------------- 670 671 /** 672 * Verify the behavior of patterns in which digits for different fields run together 673 * without intervening separators. 674 */ 675 void 676 DateFormatTest::TestRunTogetherPattern985() 677 { 678 UErrorCode status = U_ZERO_ERROR; 679 UnicodeString format("yyyyMMddHHmmssSSS"); 680 UnicodeString now, then; 681 //UBool flag; 682 SimpleDateFormat *formatter = new SimpleDateFormat(format, status); 683 if (U_FAILURE(status)) { 684 dataerrln("Fail new SimpleDateFormat: %s", u_errorName(status)); 685 delete formatter; 686 return; 687 } 688 UDate date1 = Calendar::getNow(); 689 ((DateFormat*)formatter)->format(date1, now); 690 logln(now); 691 ParsePosition pos(0); 692 UDate date2 = formatter->parse(now, pos); 693 if (date2 == 0) then = "Parse stopped at " + pos.getIndex(); 694 else ((DateFormat*)formatter)->format(date2, then); 695 logln(then); 696 if (!(date2 == date1)) errln((UnicodeString)"FAIL"); 697 delete formatter; 698 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status); 699 } 700 701 // ------------------------------------- 702 703 /** 704 * Verify the behavior of patterns in which digits for different fields run together 705 * without intervening separators. 706 */ 707 void 708 DateFormatTest::TestRunTogetherPattern917() 709 { 710 UErrorCode status = U_ZERO_ERROR; 711 SimpleDateFormat* fmt; 712 UnicodeString myDate; 713 fmt = new SimpleDateFormat((UnicodeString)"yyyy/MM/dd", status); 714 if (U_FAILURE(status)) { 715 dataerrln("Fail new SimpleDateFormat: %s", u_errorName(status)); 716 delete fmt; 717 return; 718 } 719 myDate = "1997/02/03"; 720 testIt917(fmt, myDate, date(97, 2 - 1, 3)); 721 delete fmt; 722 fmt = new SimpleDateFormat((UnicodeString)"yyyyMMdd", status); 723 myDate = "19970304"; 724 testIt917(fmt, myDate, date(97, 3 - 1, 4)); 725 delete fmt; 726 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status); 727 } 728 729 // ------------------------------------- 730 731 void 732 DateFormatTest::testIt917(SimpleDateFormat* fmt, UnicodeString& str, UDate expected) 733 { 734 UErrorCode status = U_ZERO_ERROR; 735 UnicodeString pattern; 736 logln((UnicodeString)"pattern=" + fmt->toPattern(pattern) + " string=" + str); 737 Formattable o; 738 //try { 739 ((Format*)fmt)->parseObject(str, o, status); 740 //} 741 if (U_FAILURE(status)) return; 742 //catch(ParseException e) { 743 // e.printStackTrace(); 744 // return; 745 //} 746 logln((UnicodeString)"Parsed object: " + dateToString(o.getDate())); 747 if (!(o.getDate() == expected)) errln((UnicodeString)"FAIL: Expected " + dateToString(expected)); 748 UnicodeString formatted; ((Format*)fmt)->format(o, formatted, status); 749 logln((UnicodeString)"Formatted string: " + formatted); 750 if (!(formatted == str)) errln((UnicodeString)"FAIL: Expected " + str); 751 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status); 752 } 753 754 // ------------------------------------- 755 756 /** 757 * Verify the handling of Czech June and July, which have the unique attribute that 758 * one is a proper prefix substring of the other. 759 */ 760 void 761 DateFormatTest::TestCzechMonths459() 762 { 763 UErrorCode status = U_ZERO_ERROR; 764 DateFormat* fmt = DateFormat::createDateInstance(DateFormat::FULL, Locale("cs", "", "")); 765 if (fmt == NULL){ 766 dataerrln("Error calling DateFormat::createDateInstance()"); 767 return; 768 } 769 770 UnicodeString pattern; 771 logln((UnicodeString)"Pattern " + ((SimpleDateFormat*) fmt)->toPattern(pattern)); 772 UDate june = date(97, UCAL_JUNE, 15); 773 UDate july = date(97, UCAL_JULY, 15); 774 UnicodeString juneStr; fmt->format(june, juneStr); 775 UnicodeString julyStr; fmt->format(july, julyStr); 776 //try { 777 logln((UnicodeString)"format(June 15 1997) = " + juneStr); 778 UDate d = fmt->parse(juneStr, status); 779 UnicodeString s; fmt->format(d, s); 780 int32_t month,yr,day,hr,min,sec; dateToFields(d,yr,month,day,hr,min,sec); 781 logln((UnicodeString)" -> parse -> " + s + " (month = " + month + ")"); 782 if (month != UCAL_JUNE) errln((UnicodeString)"FAIL: Month should be June"); 783 logln((UnicodeString)"format(July 15 1997) = " + julyStr); 784 d = fmt->parse(julyStr, status); 785 fmt->format(d, s); 786 dateToFields(d,yr,month,day,hr,min,sec); 787 logln((UnicodeString)" -> parse -> " + s + " (month = " + month + ")"); 788 if (month != UCAL_JULY) errln((UnicodeString)"FAIL: Month should be July"); 789 //} 790 //catch(ParseException e) { 791 if (U_FAILURE(status)) 792 errln((UnicodeString)"Exception: " + (int32_t)status); 793 //} 794 delete fmt; 795 } 796 797 // ------------------------------------- 798 799 /** 800 * Test the handling of 'D' in patterns. 801 */ 802 void 803 DateFormatTest::TestLetterDPattern212() 804 { 805 UErrorCode status = U_ZERO_ERROR; 806 UnicodeString dateString("1995-040.05:01:29"); 807 UnicodeString bigD("yyyy-DDD.hh:mm:ss"); 808 UnicodeString littleD("yyyy-ddd.hh:mm:ss"); 809 UDate expLittleD = date(95, 0, 1, 5, 1, 29); 810 UDate expBigD = expLittleD + 39 * 24 * 3600000.0; 811 expLittleD = expBigD; // Expect the same, with default lenient parsing 812 logln((UnicodeString)"dateString= " + dateString); 813 SimpleDateFormat *formatter = new SimpleDateFormat(bigD, status); 814 if (U_FAILURE(status)) { 815 dataerrln("Fail new SimpleDateFormat: %s", u_errorName(status)); 816 delete formatter; 817 return; 818 } 819 ParsePosition pos(0); 820 UDate myDate = formatter->parse(dateString, pos); 821 logln((UnicodeString)"Using " + bigD + " -> " + myDate); 822 if (myDate != expBigD) errln((UnicodeString)"FAIL: bigD - Expected " + dateToString(expBigD)); 823 delete formatter; 824 formatter = new SimpleDateFormat(littleD, status); 825 ASSERT_OK(status); 826 pos = ParsePosition(0); 827 myDate = formatter->parse(dateString, pos); 828 logln((UnicodeString)"Using " + littleD + " -> " + dateToString(myDate)); 829 if (myDate != expLittleD) errln((UnicodeString)"FAIL: littleD - Expected " + dateToString(expLittleD)); 830 delete formatter; 831 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status); 832 } 833 834 // ------------------------------------- 835 836 /** 837 * Test the day of year pattern. 838 */ 839 void 840 DateFormatTest::TestDayOfYearPattern195() 841 { 842 UErrorCode status = U_ZERO_ERROR; 843 UDate today = Calendar::getNow(); 844 int32_t year,month,day,hour,min,sec; dateToFields(today,year,month,day,hour,min,sec); 845 UDate expected = date(year, month, day); 846 logln((UnicodeString)"Test Date: " + dateToString(today)); 847 SimpleDateFormat* sdf = (SimpleDateFormat*)DateFormat::createDateInstance(); 848 if (sdf == NULL){ 849 dataerrln("Error calling DateFormat::createDateInstance()"); 850 return; 851 } 852 tryPattern(*sdf, today, 0, expected); 853 tryPattern(*sdf, today, "G yyyy DDD", expected); 854 delete sdf; 855 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status); 856 } 857 858 // ------------------------------------- 859 860 void 861 DateFormatTest::tryPattern(SimpleDateFormat& sdf, UDate d, const char* pattern, UDate expected) 862 { 863 UErrorCode status = U_ZERO_ERROR; 864 if (pattern != 0) sdf.applyPattern(pattern); 865 UnicodeString thePat; 866 logln((UnicodeString)"pattern: " + sdf.toPattern(thePat)); 867 UnicodeString formatResult; (*(DateFormat*)&sdf).format(d, formatResult); 868 logln((UnicodeString)" format -> " + formatResult); 869 // try { 870 UDate d2 = sdf.parse(formatResult, status); 871 logln((UnicodeString)" parse(" + formatResult + ") -> " + dateToString(d2)); 872 if (d2 != expected) errln((UnicodeString)"FAIL: Expected " + dateToString(expected)); 873 UnicodeString format2; (*(DateFormat*)&sdf).format(d2, format2); 874 logln((UnicodeString)" format -> " + format2); 875 if (!(formatResult == format2)) errln((UnicodeString)"FAIL: Round trip drift"); 876 //} 877 //catch(Exception e) { 878 if (U_FAILURE(status)) 879 errln((UnicodeString)"Error: " + (int32_t)status); 880 //} 881 } 882 883 // ------------------------------------- 884 885 /** 886 * Test the handling of single quotes in patterns. 887 */ 888 void 889 DateFormatTest::TestQuotePattern161() 890 { 891 UErrorCode status = U_ZERO_ERROR; 892 SimpleDateFormat* formatter = new SimpleDateFormat((UnicodeString)"MM/dd/yyyy 'at' hh:mm:ss a zzz", status); 893 if (U_FAILURE(status)) { 894 dataerrln("Fail new SimpleDateFormat: %s", u_errorName(status)); 895 delete formatter; 896 return; 897 } 898 UDate currentTime_1 = date(97, UCAL_AUGUST, 13, 10, 42, 28); 899 UnicodeString dateString; ((DateFormat*)formatter)->format(currentTime_1, dateString); 900 UnicodeString exp("08/13/1997 at 10:42:28 AM "); 901 logln((UnicodeString)"format(" + dateToString(currentTime_1) + ") = " + dateString); 902 if (0 != dateString.compareBetween(0, exp.length(), exp, 0, exp.length())) errln((UnicodeString)"FAIL: Expected " + exp); 903 delete formatter; 904 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status); 905 } 906 907 // ------------------------------------- 908 909 /** 910 * Verify the correct behavior when handling invalid input strings. 911 */ 912 void 913 DateFormatTest::TestBadInput135() 914 { 915 UErrorCode status = U_ZERO_ERROR; 916 DateFormat::EStyle looks[] = { 917 DateFormat::SHORT, DateFormat::MEDIUM, DateFormat::LONG, DateFormat::FULL 918 }; 919 int32_t looks_length = (int32_t)(sizeof(looks) / sizeof(looks[0])); 920 const char* strings[] = { 921 "Mar 15", "Mar 15 1997", "asdf", "3/1/97 1:23:", "3/1/00 1:23:45 AM" 922 }; 923 int32_t strings_length = (int32_t)(sizeof(strings) / sizeof(strings[0])); 924 DateFormat *full = DateFormat::createDateTimeInstance(DateFormat::LONG, DateFormat::LONG); 925 if(full==NULL) { 926 dataerrln("could not create date time instance"); 927 return; 928 } 929 UnicodeString expected("March 1, 2000 at 1:23:45 AM "); 930 for (int32_t i = 0; i < strings_length;++i) { 931 const char* text = strings[i]; 932 for (int32_t j = 0; j < looks_length;++j) { 933 DateFormat::EStyle dateLook = looks[j]; 934 for (int32_t k = 0; k < looks_length;++k) { 935 DateFormat::EStyle timeLook = looks[k]; 936 DateFormat *df = DateFormat::createDateTimeInstance(dateLook, timeLook); 937 if (df == NULL){ 938 dataerrln("Error calling DateFormat::createDateTimeInstance()"); 939 continue; 940 } 941 UnicodeString prefix = UnicodeString(text) + ", " + dateLook + "/" + timeLook + ": "; 942 //try { 943 UDate when = df->parse(text, status); 944 if (when == 0 && U_SUCCESS(status)) { 945 errln(prefix + "SHOULD NOT HAPPEN: parse returned 0."); 946 continue; 947 } 948 if (U_SUCCESS(status)) 949 { 950 UnicodeString format; 951 UnicodeString pattern; 952 SimpleDateFormat* sdtfmt = dynamic_cast<SimpleDateFormat*>(df); 953 if (sdtfmt != NULL) { 954 sdtfmt->toPattern(pattern); 955 } 956 full->format(when, format); 957 logln(prefix + "OK: " + format); 958 if (0!=format.compareBetween(0, expected.length(), expected, 0, expected.length())) 959 errln((UnicodeString)"FAIL: Parse \"" + text + "\", pattern \"" + pattern + "\", expected " + expected + " got " + format); 960 } 961 //} 962 //catch(ParseException e) { 963 else 964 status = U_ZERO_ERROR; 965 //} 966 //catch(StringIndexOutOfBoundsException e) { 967 // errln(prefix + "SHOULD NOT HAPPEN: " + (int)status); 968 //} 969 delete df; 970 } 971 } 972 } 973 delete full; 974 if (U_FAILURE(status)) 975 errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status); 976 } 977 978 static const char* const parseFormats[] = { 979 "MMMM d, yyyy", 980 "MMMM d yyyy", 981 "M/d/yy", 982 "d MMMM, yyyy", 983 "d MMMM yyyy", 984 "d MMMM", 985 "MMMM d", 986 "yyyy", 987 "h:mm a MMMM d, yyyy" 988 }; 989 990 #if 0 991 // strict inputStrings 992 static const char* const inputStrings[] = { 993 "bogus string", 0, 0, 0, 0, 0, 0, 0, 0, 0, 994 "April 1, 1997", "April 1, 1997", 0, 0, 0, 0, 0, "April 1", 0, 0, 995 "Jan 1, 1970", "January 1, 1970", 0, 0, 0, 0, 0, "January 1", 0, 0, 996 "Jan 1 2037", 0, "January 1 2037", 0, 0, 0, 0, "January 1", 0, 0, 997 "1/1/70", 0, 0, "1/1/70", 0, 0, 0, 0, "0001", 0, 998 "5 May 1997", 0, 0, 0, 0, "5 May 1997", "5 May", 0, "0005", 0, 999 "16 May", 0, 0, 0, 0, 0, "16 May", 0, "0016", 0, 1000 "April 30", 0, 0, 0, 0, 0, 0, "April 30", 0, 0, 1001 "1998", 0, 0, 0, 0, 0, 0, 0, "1998", 0, 1002 "1", 0, 0, 0, 0, 0, 0, 0, "0001", 0, 1003 "3:00 pm Jan 1, 1997", 0, 0, 0, 0, 0, 0, 0, "0003", "3:00 PM January 1, 1997", 1004 }; 1005 #else 1006 // lenient inputStrings 1007 static const char* const inputStrings[] = { 1008 "bogus string", 0, 0, 0, 0, 0, 0, 0, 0, 0, 1009 "April 1, 1997", "April 1, 1997", "April 1 1997", "4/1/97", 0, 0, 0, "April 1", 0, 0, 1010 "Jan 1, 1970", "January 1, 1970", "January 1 1970", "1/1/70", 0, 0, 0, "January 1", 0, 0, 1011 "Jan 1 2037", "January 1, 2037", "January 1 2037", "1/1/37", 0, 0, 0, "January 1", 0, 0, 1012 "1/1/70", "January 1, 1970", "January 1 1970", "1/1/70", "1 January, 1970", "1 January 1970", "1 January", "January 1", "0001", 0, 1013 "5 May 1997", 0, 0, 0, "5 May, 1997", "5 May 1997", "5 May", 0, "0005", 0, 1014 "16 May", 0, 0, 0, 0, 0, "16 May", 0, "2016", 0, 1015 "April 30", 0, 0, 0, 0, 0, 0, "April 30", 0, 0, 1016 "1998", 0, 0, 0, 0, 0, 0, 0, "1998", 0, 1017 "1", 0, 0, 0, 0, 0, 0, 0, "0001", 0, 1018 "3:00 pm Jan 1, 1997", 0, 0, 0, 0, 0, 0, 0, "0003", "3:00 PM January 1, 1997", 1019 }; 1020 #endif 1021 1022 // ------------------------------------- 1023 1024 /** 1025 * Verify the correct behavior when parsing an array of inputs against an 1026 * array of patterns, with known results. The results are encoded after 1027 * the input strings in each row. 1028 */ 1029 void 1030 DateFormatTest::TestBadInput135a() 1031 { 1032 UErrorCode status = U_ZERO_ERROR; 1033 SimpleDateFormat* dateParse = new SimpleDateFormat(status); 1034 if(U_FAILURE(status)) { 1035 dataerrln("Failed creating SimpleDateFormat with %s. Quitting test", u_errorName(status)); 1036 delete dateParse; 1037 return; 1038 } 1039 const char* s; 1040 UDate date; 1041 const uint32_t PF_LENGTH = (int32_t)(sizeof(parseFormats)/sizeof(parseFormats[0])); 1042 const uint32_t INPUT_LENGTH = (int32_t)(sizeof(inputStrings)/sizeof(inputStrings[0])); 1043 1044 dateParse->applyPattern("d MMMM, yyyy"); 1045 dateParse->adoptTimeZone(TimeZone::createDefault()); 1046 s = "not parseable"; 1047 UnicodeString thePat; 1048 logln(UnicodeString("Trying to parse \"") + s + "\" with " + dateParse->toPattern(thePat)); 1049 //try { 1050 date = dateParse->parse(s, status); 1051 if (U_SUCCESS(status)) 1052 errln((UnicodeString)"FAIL: Expected exception during parse"); 1053 //} 1054 //catch(Exception ex) { 1055 else 1056 logln((UnicodeString)"Exception during parse: " + (int32_t)status); 1057 status = U_ZERO_ERROR; 1058 //} 1059 for (uint32_t i = 0; i < INPUT_LENGTH; i += (PF_LENGTH + 1)) { 1060 ParsePosition parsePosition(0); 1061 UnicodeString s( inputStrings[i]); 1062 for (uint32_t index = 0; index < PF_LENGTH;++index) { 1063 const char* expected = inputStrings[i + 1 + index]; 1064 dateParse->applyPattern(parseFormats[index]); 1065 dateParse->adoptTimeZone(TimeZone::createDefault()); 1066 //try { 1067 parsePosition.setIndex(0); 1068 date = dateParse->parse(s, parsePosition); 1069 if (parsePosition.getIndex() != 0) { 1070 UnicodeString s1, s2; 1071 s.extract(0, parsePosition.getIndex(), s1); 1072 s.extract(parsePosition.getIndex(), s.length(), s2); 1073 if (date == 0) { 1074 errln((UnicodeString)"ERROR: null result fmt=\"" + 1075 parseFormats[index] + 1076 "\" pos=" + parsePosition.getIndex() + " " + 1077 s1 + "|" + s2); 1078 } 1079 else { 1080 UnicodeString result; 1081 ((DateFormat*)dateParse)->format(date, result); 1082 logln((UnicodeString)"Parsed \"" + s + "\" using \"" + dateParse->toPattern(thePat) + "\" to: " + result); 1083 if (expected == 0) 1084 errln((UnicodeString)"FAIL: Expected parse failure, got " + result); 1085 else if (!(result == expected)) 1086 errln(UnicodeString("FAIL: Parse \"") + s + UnicodeString("\", expected ") + expected + UnicodeString(", got ") + result); 1087 } 1088 } 1089 else if (expected != 0) { 1090 errln(UnicodeString("FAIL: Expected ") + expected + " from \"" + 1091 s + "\" with \"" + dateParse->toPattern(thePat) + "\""); 1092 } 1093 //} 1094 //catch(Exception ex) { 1095 if (U_FAILURE(status)) 1096 errln((UnicodeString)"An exception was thrown during parse: " + (int32_t)status); 1097 //} 1098 } 1099 } 1100 delete dateParse; 1101 if (U_FAILURE(status)) 1102 errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status); 1103 } 1104 1105 // ------------------------------------- 1106 1107 /** 1108 * Test the parsing of two-digit years. 1109 */ 1110 void 1111 DateFormatTest::TestTwoDigitYear() 1112 { 1113 UErrorCode ec = U_ZERO_ERROR; 1114 SimpleDateFormat fmt("dd/MM/yy", Locale::getUK(), ec); 1115 if (U_FAILURE(ec)) { 1116 dataerrln("FAIL: SimpleDateFormat constructor - %s", u_errorName(ec)); 1117 return; 1118 } 1119 parse2DigitYear(fmt, "5/6/17", date(117, UCAL_JUNE, 5)); 1120 parse2DigitYear(fmt, "4/6/34", date(34, UCAL_JUNE, 4)); 1121 } 1122 1123 // ------------------------------------- 1124 1125 void 1126 DateFormatTest::parse2DigitYear(DateFormat& fmt, const char* str, UDate expected) 1127 { 1128 UErrorCode status = U_ZERO_ERROR; 1129 //try { 1130 UDate d = fmt.parse(str, status); 1131 UnicodeString thePat; 1132 logln(UnicodeString("Parsing \"") + str + "\" with " + ((SimpleDateFormat*)&fmt)->toPattern(thePat) + 1133 " => " + dateToString(d)); 1134 if (d != expected) errln((UnicodeString)"FAIL: Expected " + expected); 1135 //} 1136 //catch(ParseException e) { 1137 if (U_FAILURE(status)) 1138 errln((UnicodeString)"FAIL: Got exception"); 1139 //} 1140 } 1141 1142 // ------------------------------------- 1143 1144 /** 1145 * Test the formatting of time zones. 1146 */ 1147 void 1148 DateFormatTest::TestDateFormatZone061() 1149 { 1150 UErrorCode status = U_ZERO_ERROR; 1151 UDate date; 1152 DateFormat *formatter; 1153 date= 859248000000.0; 1154 logln((UnicodeString)"Date 1997/3/25 00:00 GMT: " + date); 1155 formatter = new SimpleDateFormat((UnicodeString)"dd-MMM-yyyyy HH:mm", Locale::getUK(), status); 1156 if(U_FAILURE(status)) { 1157 dataerrln("Failed creating SimpleDateFormat with %s. Quitting test", u_errorName(status)); 1158 delete formatter; 1159 return; 1160 } 1161 formatter->adoptTimeZone(TimeZone::createTimeZone("GMT")); 1162 UnicodeString temp; formatter->format(date, temp); 1163 logln((UnicodeString)"Formatted in GMT to: " + temp); 1164 //try { 1165 UDate tempDate = formatter->parse(temp, status); 1166 logln((UnicodeString)"Parsed to: " + dateToString(tempDate)); 1167 if (tempDate != date) errln((UnicodeString)"FAIL: Expected " + dateToString(date)); 1168 //} 1169 //catch(Throwable t) { 1170 if (U_FAILURE(status)) 1171 errln((UnicodeString)"Date Formatter throws: " + (int32_t)status); 1172 //} 1173 delete formatter; 1174 } 1175 1176 // ------------------------------------- 1177 1178 /** 1179 * Test the formatting of time zones. 1180 */ 1181 void 1182 DateFormatTest::TestDateFormatZone146() 1183 { 1184 TimeZone *saveDefault = TimeZone::createDefault(); 1185 1186 //try { 1187 TimeZone *thedefault = TimeZone::createTimeZone("GMT"); 1188 TimeZone::setDefault(*thedefault); 1189 // java.util.Locale.setDefault(new java.util.Locale("ar", "", "")); 1190 1191 // check to be sure... its GMT all right 1192 TimeZone *testdefault = TimeZone::createDefault(); 1193 UnicodeString testtimezone; 1194 testdefault->getID(testtimezone); 1195 if (testtimezone == "GMT") 1196 logln("Test timezone = " + testtimezone); 1197 else 1198 dataerrln("Test timezone should be GMT, not " + testtimezone); 1199 1200 UErrorCode status = U_ZERO_ERROR; 1201 // now try to use the default GMT time zone 1202 GregorianCalendar *greenwichcalendar = 1203 new GregorianCalendar(1997, 3, 4, 23, 0, status); 1204 if (U_FAILURE(status)) { 1205 dataerrln("Fail new GregorianCalendar: %s", u_errorName(status)); 1206 } else { 1207 //*****************************greenwichcalendar.setTimeZone(TimeZone.getDefault()); 1208 //greenwichcalendar.set(1997, 3, 4, 23, 0); 1209 // try anything to set hour to 23:00 !!! 1210 greenwichcalendar->set(UCAL_HOUR_OF_DAY, 23); 1211 // get time 1212 UDate greenwichdate = greenwichcalendar->getTime(status); 1213 // format every way 1214 UnicodeString DATA [] = { 1215 UnicodeString("simple format: "), UnicodeString("04/04/97 23:00 GMT"), 1216 UnicodeString("MM/dd/yy HH:mm z"), 1217 UnicodeString("full format: "), UnicodeString("Friday, April 4, 1997 11:00:00 o'clock PM GMT"), 1218 UnicodeString("EEEE, MMMM d, yyyy h:mm:ss 'o''clock' a z"), 1219 UnicodeString("long format: "), UnicodeString("April 4, 1997 11:00:00 PM GMT"), 1220 UnicodeString("MMMM d, yyyy h:mm:ss a z"), 1221 UnicodeString("default format: "), UnicodeString("04-Apr-97 11:00:00 PM"), 1222 UnicodeString("dd-MMM-yy h:mm:ss a"), 1223 UnicodeString("short format: "), UnicodeString("4/4/97 11:00 PM"), 1224 UnicodeString("M/d/yy h:mm a") 1225 }; 1226 int32_t DATA_length = (int32_t)(sizeof(DATA) / sizeof(DATA[0])); 1227 1228 for (int32_t i=0; i<DATA_length; i+=3) { 1229 DateFormat *fmt = new SimpleDateFormat(DATA[i+2], Locale::getEnglish(), status); 1230 if (U_FAILURE(status)) { 1231 dataerrln("Unable to create SimpleDateFormat - %s", u_errorName(status)); 1232 break; 1233 } 1234 fmt->setCalendar(*greenwichcalendar); 1235 UnicodeString result; 1236 result = fmt->format(greenwichdate, result); 1237 logln(DATA[i] + result); 1238 if (result != DATA[i+1]) 1239 errln("FAIL: Expected " + DATA[i+1] + ", got " + result); 1240 delete fmt; 1241 } 1242 } 1243 //} 1244 //finally { 1245 TimeZone::adoptDefault(saveDefault); 1246 //} 1247 delete testdefault; 1248 delete greenwichcalendar; 1249 delete thedefault; 1250 1251 1252 } 1253 1254 // ------------------------------------- 1255 1256 /** 1257 * Test the formatting of dates in different locales. 1258 */ 1259 void 1260 DateFormatTest::TestLocaleDateFormat() // Bug 495 1261 { 1262 UDate testDate = date(97, UCAL_SEPTEMBER, 15); 1263 DateFormat *dfFrench = DateFormat::createDateTimeInstance(DateFormat::FULL, 1264 DateFormat::FULL, Locale::getFrench()); 1265 DateFormat *dfUS = DateFormat::createDateTimeInstance(DateFormat::FULL, 1266 DateFormat::FULL, Locale::getUS()); 1267 UnicodeString expectedFRENCH ( "lundi 15 septembre 1997 00:00:00 heure avanc\\u00E9e du Pacifique", -1, US_INV ); 1268 expectedFRENCH = expectedFRENCH.unescape(); 1269 UnicodeString expectedUS ( "Monday, September 15, 1997 at 12:00:00 AM Pacific Daylight Time" ); 1270 logln((UnicodeString)"Date set to : " + dateToString(testDate)); 1271 UnicodeString out; 1272 if (dfUS == NULL || dfFrench == NULL){ 1273 dataerrln("Error calling DateFormat::createDateTimeInstance)"); 1274 delete dfUS; 1275 delete dfFrench; 1276 return; 1277 } 1278 1279 dfFrench->format(testDate, out); 1280 logln((UnicodeString)"Date Formated with French Locale " + out); 1281 if (!(out == expectedFRENCH)) 1282 errln((UnicodeString)"FAIL: Expected " + expectedFRENCH); 1283 out.truncate(0); 1284 dfUS->format(testDate, out); 1285 logln((UnicodeString)"Date Formated with US Locale " + out); 1286 if (!(out == expectedUS)) 1287 errln((UnicodeString)"FAIL: Expected " + expectedUS); 1288 delete dfUS; 1289 delete dfFrench; 1290 } 1291 1292 /** 1293 * Test DateFormat(Calendar) API 1294 */ 1295 void DateFormatTest::TestDateFormatCalendar() { 1296 DateFormat *date=0, *time=0, *full=0; 1297 Calendar *cal=0; 1298 UnicodeString str; 1299 ParsePosition pos; 1300 UDate when; 1301 UErrorCode ec = U_ZERO_ERROR; 1302 1303 /* Create a formatter for date fields. */ 1304 date = DateFormat::createDateInstance(DateFormat::kShort, Locale::getUS()); 1305 if (date == NULL) { 1306 dataerrln("FAIL: createDateInstance failed"); 1307 goto FAIL; 1308 } 1309 1310 /* Create a formatter for time fields. */ 1311 time = DateFormat::createTimeInstance(DateFormat::kShort, Locale::getUS()); 1312 if (time == NULL) { 1313 errln("FAIL: createTimeInstance failed"); 1314 goto FAIL; 1315 } 1316 1317 /* Create a full format for output */ 1318 full = DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, 1319 Locale::getUS()); 1320 if (full == NULL) { 1321 errln("FAIL: createInstance failed"); 1322 goto FAIL; 1323 } 1324 1325 /* Create a calendar */ 1326 cal = Calendar::createInstance(Locale::getUS(), ec); 1327 if (cal == NULL || U_FAILURE(ec)) { 1328 errln((UnicodeString)"FAIL: Calendar::createInstance failed with " + 1329 u_errorName(ec)); 1330 goto FAIL; 1331 } 1332 1333 /* Parse the date */ 1334 cal->clear(); 1335 str = UnicodeString("4/5/2001", ""); 1336 pos.setIndex(0); 1337 date->parse(str, *cal, pos); 1338 if (pos.getIndex() != str.length()) { 1339 errln((UnicodeString)"FAIL: DateFormat::parse(4/5/2001) failed at " + 1340 pos.getIndex()); 1341 goto FAIL; 1342 } 1343 1344 /* Parse the time */ 1345 str = UnicodeString("5:45 PM", ""); 1346 pos.setIndex(0); 1347 time->parse(str, *cal, pos); 1348 if (pos.getIndex() != str.length()) { 1349 errln((UnicodeString)"FAIL: DateFormat::parse(17:45) failed at " + 1350 pos.getIndex()); 1351 goto FAIL; 1352 } 1353 1354 /* Check result */ 1355 when = cal->getTime(ec); 1356 if (U_FAILURE(ec)) { 1357 errln((UnicodeString)"FAIL: cal->getTime() failed with " + u_errorName(ec)); 1358 goto FAIL; 1359 } 1360 str.truncate(0); 1361 full->format(when, str); 1362 // Thursday, April 5, 2001 5:45:00 PM PDT 986517900000 1363 if (when == 986517900000.0) { 1364 logln("Ok: Parsed result: " + str); 1365 } else { 1366 errln("FAIL: Parsed result: " + str + ", exp 4/5/2001 5:45 PM"); 1367 } 1368 1369 FAIL: 1370 delete date; 1371 delete time; 1372 delete full; 1373 delete cal; 1374 } 1375 1376 /** 1377 * Test DateFormat's parsing of space characters. See jitterbug 1916. 1378 */ 1379 void DateFormatTest::TestSpaceParsing() { 1380 const char* DATA[] = { 1381 "yyyy MM dd HH:mm:ss", 1382 1383 // pattern, input, expected parse or NULL if expect parse failure 1384 "MMMM d yy", " 04 05 06", "2006 04 05 00:00:00", 1385 NULL, "04 05 06", "2006 04 05 00:00:00", 1386 1387 "MM d yy", " 04 05 06", "2006 04 05 00:00:00", 1388 NULL, "04 05 06", "2006 04 05 00:00:00", 1389 NULL, "04/05/06", "2006 04 05 00:00:00", 1390 NULL, "04-05-06", "2006 04 05 00:00:00", 1391 NULL, "04.05.06", "2006 04 05 00:00:00", 1392 NULL, "04 / 05 / 06", "2006 04 05 00:00:00", 1393 NULL, "Apr / 05/ 06", "2006 04 05 00:00:00", 1394 NULL, "Apr-05-06", "2006 04 05 00:00:00", 1395 NULL, "Apr 05, 2006", "2006 04 05 00:00:00", 1396 1397 "MMMM d yy", " Apr 05 06", "2006 04 05 00:00:00", 1398 NULL, "Apr 05 06", "2006 04 05 00:00:00", 1399 NULL, "Apr05 06", "2006 04 05 00:00:00", 1400 1401 "hh:mm:ss a", "12:34:56 PM", "1970 01 01 12:34:56", 1402 NULL, "12:34:56PM", "1970 01 01 12:34:56", 1403 NULL, "12.34.56PM", "1970 01 01 12:34:56", 1404 NULL, "12-34-56 PM", "1970 01 01 12:34:56", 1405 NULL, "12 : 34 : 56 PM", "1970 01 01 12:34:56", 1406 1407 "MM d yy 'at' hh:mm:ss a", "04/05/06 12:34:56 PM", "2006 04 05 12:34:56", 1408 1409 "MMMM dd yyyy hh:mm a", "September 27, 1964 21:56 PM", "1964 09 28 09:56:00", 1410 NULL, "November 4, 2008 0:13 AM", "2008 11 04 00:13:00", 1411 1412 "HH'h'mm'min'ss's'", "12h34min56s", "1970 01 01 12:34:56", 1413 NULL, "12h34mi56s", "1970 01 01 12:34:56", 1414 NULL, "12h34m56s", "1970 01 01 12:34:56", 1415 NULL, "12:34:56", "1970 01 01 12:34:56" 1416 }; 1417 const int32_t DATA_len = sizeof(DATA)/sizeof(DATA[0]); 1418 1419 expectParse(DATA, DATA_len, Locale("en")); 1420 } 1421 1422 /** 1423 * Test handling of "HHmmss" pattern. 1424 */ 1425 void DateFormatTest::TestExactCountFormat() { 1426 const char* DATA[] = { 1427 "yyyy MM dd HH:mm:ss", 1428 1429 // pattern, input, expected parse or NULL if expect parse failure 1430 "HHmmss", "123456", "1970 01 01 12:34:56", 1431 NULL, "12345", "1970 01 01 01:23:45", 1432 NULL, "1234", NULL, 1433 NULL, "00-05", NULL, 1434 NULL, "12-34", NULL, 1435 NULL, "00+05", NULL, 1436 "ahhmm", "PM730", "1970 01 01 19:30:00", 1437 }; 1438 const int32_t DATA_len = sizeof(DATA)/sizeof(DATA[0]); 1439 1440 expectParse(DATA, DATA_len, Locale("en")); 1441 } 1442 1443 /** 1444 * Test handling of white space. 1445 */ 1446 void DateFormatTest::TestWhiteSpaceParsing() { 1447 const char* DATA[] = { 1448 "yyyy MM dd", 1449 1450 // pattern, input, expected parse or null if expect parse failure 1451 1452 // Pattern space run should parse input text space run 1453 "MM d yy", " 04 01 03", "2003 04 01", 1454 NULL, " 04 01 03 ", "2003 04 01", 1455 }; 1456 const int32_t DATA_len = sizeof(DATA)/sizeof(DATA[0]); 1457 1458 expectParse(DATA, DATA_len, Locale("en")); 1459 } 1460 1461 1462 void DateFormatTest::TestInvalidPattern() { 1463 UErrorCode ec = U_ZERO_ERROR; 1464 SimpleDateFormat f(UnicodeString("Yesterday"), ec); 1465 if (U_FAILURE(ec)) { 1466 dataerrln("Fail construct SimpleDateFormat: %s", u_errorName(ec)); 1467 return; 1468 } 1469 UnicodeString out; 1470 FieldPosition pos; 1471 f.format((UDate)0, out, pos); 1472 logln(out); 1473 // The bug is that the call to format() will crash. By not 1474 // crashing, the test passes. 1475 } 1476 1477 void DateFormatTest::TestGreekMay() { 1478 UErrorCode ec = U_ZERO_ERROR; 1479 UDate date = -9896080848000.0; 1480 SimpleDateFormat fmt("EEEE, dd MMMM yyyy h:mm:ss a", Locale("el", "", ""), ec); 1481 if (U_FAILURE(ec)) { 1482 dataerrln("Fail construct SimpleDateFormat: %s", u_errorName(ec)); 1483 return; 1484 } 1485 UnicodeString str; 1486 fmt.format(date, str); 1487 ParsePosition pos(0); 1488 UDate d2 = fmt.parse(str, pos); 1489 if (date != d2) { 1490 errln("FAIL: unable to parse strings where case-folding changes length"); 1491 } 1492 } 1493 1494 void DateFormatTest::TestStandAloneMonths() 1495 { 1496 const char *EN_DATA[] = { 1497 "yyyy MM dd HH:mm:ss", 1498 1499 "yyyy LLLL dd H:mm:ss", "fp", "2004 03 10 16:36:31", "2004 March 10 16:36:31", "2004 03 10 16:36:31", 1500 "yyyy LLL dd H:mm:ss", "fp", "2004 03 10 16:36:31", "2004 Mar 10 16:36:31", "2004 03 10 16:36:31", 1501 "yyyy LLLL dd H:mm:ss", "F", "2004 03 10 16:36:31", "2004 March 10 16:36:31", 1502 "yyyy LLL dd H:mm:ss", "pf", "2004 Mar 10 16:36:31", "2004 03 10 16:36:31", "2004 Mar 10 16:36:31", 1503 1504 "LLLL", "fp", "1970 01 01 0:00:00", "January", "1970 01 01 0:00:00", 1505 "LLLL", "fp", "1970 02 01 0:00:00", "February", "1970 02 01 0:00:00", 1506 "LLLL", "fp", "1970 03 01 0:00:00", "March", "1970 03 01 0:00:00", 1507 "LLLL", "fp", "1970 04 01 0:00:00", "April", "1970 04 01 0:00:00", 1508 "LLLL", "fp", "1970 05 01 0:00:00", "May", "1970 05 01 0:00:00", 1509 "LLLL", "fp", "1970 06 01 0:00:00", "June", "1970 06 01 0:00:00", 1510 "LLLL", "fp", "1970 07 01 0:00:00", "July", "1970 07 01 0:00:00", 1511 "LLLL", "fp", "1970 08 01 0:00:00", "August", "1970 08 01 0:00:00", 1512 "LLLL", "fp", "1970 09 01 0:00:00", "September", "1970 09 01 0:00:00", 1513 "LLLL", "fp", "1970 10 01 0:00:00", "October", "1970 10 01 0:00:00", 1514 "LLLL", "fp", "1970 11 01 0:00:00", "November", "1970 11 01 0:00:00", 1515 "LLLL", "fp", "1970 12 01 0:00:00", "December", "1970 12 01 0:00:00", 1516 1517 "LLL", "fp", "1970 01 01 0:00:00", "Jan", "1970 01 01 0:00:00", 1518 "LLL", "fp", "1970 02 01 0:00:00", "Feb", "1970 02 01 0:00:00", 1519 "LLL", "fp", "1970 03 01 0:00:00", "Mar", "1970 03 01 0:00:00", 1520 "LLL", "fp", "1970 04 01 0:00:00", "Apr", "1970 04 01 0:00:00", 1521 "LLL", "fp", "1970 05 01 0:00:00", "May", "1970 05 01 0:00:00", 1522 "LLL", "fp", "1970 06 01 0:00:00", "Jun", "1970 06 01 0:00:00", 1523 "LLL", "fp", "1970 07 01 0:00:00", "Jul", "1970 07 01 0:00:00", 1524 "LLL", "fp", "1970 08 01 0:00:00", "Aug", "1970 08 01 0:00:00", 1525 "LLL", "fp", "1970 09 01 0:00:00", "Sep", "1970 09 01 0:00:00", 1526 "LLL", "fp", "1970 10 01 0:00:00", "Oct", "1970 10 01 0:00:00", 1527 "LLL", "fp", "1970 11 01 0:00:00", "Nov", "1970 11 01 0:00:00", 1528 "LLL", "fp", "1970 12 01 0:00:00", "Dec", "1970 12 01 0:00:00", 1529 }; 1530 1531 const char *CS_DATA[] = { 1532 "yyyy MM dd HH:mm:ss", 1533 1534 "yyyy LLLL dd H:mm:ss", "fp", "2004 04 10 16:36:31", "2004 duben 10 16:36:31", "2004 04 10 16:36:31", 1535 "yyyy MMMM dd H:mm:ss", "fp", "2004 04 10 16:36:31", "2004 dubna 10 16:36:31", "2004 04 10 16:36:31", 1536 "yyyy LLL dd H:mm:ss", "fp", "2004 04 10 16:36:31", "2004 dub 10 16:36:31", "2004 04 10 16:36:31", 1537 "yyyy LLLL dd H:mm:ss", "F", "2004 04 10 16:36:31", "2004 duben 10 16:36:31", 1538 "yyyy MMMM dd H:mm:ss", "F", "2004 04 10 16:36:31", "2004 dubna 10 16:36:31", 1539 "yyyy LLLL dd H:mm:ss", "pf", "2004 duben 10 16:36:31", "2004 04 10 16:36:31", "2004 duben 10 16:36:31", 1540 "yyyy MMMM dd H:mm:ss", "pf", "2004 dubna 10 16:36:31", "2004 04 10 16:36:31", "2004 dubna 10 16:36:31", 1541 1542 "LLLL", "fp", "1970 01 01 0:00:00", "leden", "1970 01 01 0:00:00", 1543 "LLLL", "fp", "1970 02 01 0:00:00", "\\u00FAnor", "1970 02 01 0:00:00", 1544 "LLLL", "fp", "1970 03 01 0:00:00", "b\\u0159ezen", "1970 03 01 0:00:00", 1545 "LLLL", "fp", "1970 04 01 0:00:00", "duben", "1970 04 01 0:00:00", 1546 "LLLL", "fp", "1970 05 01 0:00:00", "kv\\u011Bten", "1970 05 01 0:00:00", 1547 "LLLL", "fp", "1970 06 01 0:00:00", "\\u010Derven", "1970 06 01 0:00:00", 1548 "LLLL", "fp", "1970 07 01 0:00:00", "\\u010Dervenec", "1970 07 01 0:00:00", 1549 "LLLL", "fp", "1970 08 01 0:00:00", "srpen", "1970 08 01 0:00:00", 1550 "LLLL", "fp", "1970 09 01 0:00:00", "z\\u00E1\\u0159\\u00ED", "1970 09 01 0:00:00", 1551 "LLLL", "fp", "1970 10 01 0:00:00", "\\u0159\\u00EDjen", "1970 10 01 0:00:00", 1552 "LLLL", "fp", "1970 11 01 0:00:00", "listopad", "1970 11 01 0:00:00", 1553 "LLLL", "fp", "1970 12 01 0:00:00", "prosinec", "1970 12 01 0:00:00", 1554 1555 "LLL", "fp", "1970 01 01 0:00:00", "led", "1970 01 01 0:00:00", 1556 "LLL", "fp", "1970 02 01 0:00:00", "\\u00FAno", "1970 02 01 0:00:00", 1557 "LLL", "fp", "1970 03 01 0:00:00", "b\\u0159e", "1970 03 01 0:00:00", 1558 "LLL", "fp", "1970 04 01 0:00:00", "dub", "1970 04 01 0:00:00", 1559 "LLL", "fp", "1970 05 01 0:00:00", "kv\\u011B", "1970 05 01 0:00:00", 1560 "LLL", "fp", "1970 06 01 0:00:00", "\\u010Dvn", "1970 06 01 0:00:00", 1561 "LLL", "fp", "1970 07 01 0:00:00", "\\u010Dvc", "1970 07 01 0:00:00", 1562 "LLL", "fp", "1970 08 01 0:00:00", "srp", "1970 08 01 0:00:00", 1563 "LLL", "fp", "1970 09 01 0:00:00", "z\\u00E1\\u0159", "1970 09 01 0:00:00", 1564 "LLL", "fp", "1970 10 01 0:00:00", "\\u0159\\u00EDj", "1970 10 01 0:00:00", 1565 "LLL", "fp", "1970 11 01 0:00:00", "lis", "1970 11 01 0:00:00", 1566 "LLL", "fp", "1970 12 01 0:00:00", "pro", "1970 12 01 0:00:00", 1567 }; 1568 1569 expect(EN_DATA, ARRAY_SIZE(EN_DATA), Locale("en", "", "")); 1570 expect(CS_DATA, ARRAY_SIZE(CS_DATA), Locale("cs", "", "")); 1571 } 1572 1573 void DateFormatTest::TestStandAloneDays() 1574 { 1575 const char *EN_DATA[] = { 1576 "yyyy MM dd HH:mm:ss", 1577 1578 "cccc", "fp", "1970 01 04 0:00:00", "Sunday", "1970 01 04 0:00:00", 1579 "cccc", "fp", "1970 01 05 0:00:00", "Monday", "1970 01 05 0:00:00", 1580 "cccc", "fp", "1970 01 06 0:00:00", "Tuesday", "1970 01 06 0:00:00", 1581 "cccc", "fp", "1970 01 07 0:00:00", "Wednesday", "1970 01 07 0:00:00", 1582 "cccc", "fp", "1970 01 01 0:00:00", "Thursday", "1970 01 01 0:00:00", 1583 "cccc", "fp", "1970 01 02 0:00:00", "Friday", "1970 01 02 0:00:00", 1584 "cccc", "fp", "1970 01 03 0:00:00", "Saturday", "1970 01 03 0:00:00", 1585 1586 "ccc", "fp", "1970 01 04 0:00:00", "Sun", "1970 01 04 0:00:00", 1587 "ccc", "fp", "1970 01 05 0:00:00", "Mon", "1970 01 05 0:00:00", 1588 "ccc", "fp", "1970 01 06 0:00:00", "Tue", "1970 01 06 0:00:00", 1589 "ccc", "fp", "1970 01 07 0:00:00", "Wed", "1970 01 07 0:00:00", 1590 "ccc", "fp", "1970 01 01 0:00:00", "Thu", "1970 01 01 0:00:00", 1591 "ccc", "fp", "1970 01 02 0:00:00", "Fri", "1970 01 02 0:00:00", 1592 "ccc", "fp", "1970 01 03 0:00:00", "Sat", "1970 01 03 0:00:00", 1593 }; 1594 1595 const char *CS_DATA[] = { 1596 "yyyy MM dd HH:mm:ss", 1597 1598 "cccc", "fp", "1970 01 04 0:00:00", "ned\\u011Ble", "1970 01 04 0:00:00", 1599 "cccc", "fp", "1970 01 05 0:00:00", "pond\\u011Bl\\u00ED", "1970 01 05 0:00:00", 1600 "cccc", "fp", "1970 01 06 0:00:00", "\\u00FAter\\u00FD", "1970 01 06 0:00:00", 1601 "cccc", "fp", "1970 01 07 0:00:00", "st\\u0159eda", "1970 01 07 0:00:00", 1602 "cccc", "fp", "1970 01 01 0:00:00", "\\u010Dtvrtek", "1970 01 01 0:00:00", 1603 "cccc", "fp", "1970 01 02 0:00:00", "p\\u00E1tek", "1970 01 02 0:00:00", 1604 "cccc", "fp", "1970 01 03 0:00:00", "sobota", "1970 01 03 0:00:00", 1605 1606 "ccc", "fp", "1970 01 04 0:00:00", "ne", "1970 01 04 0:00:00", 1607 "ccc", "fp", "1970 01 05 0:00:00", "po", "1970 01 05 0:00:00", 1608 "ccc", "fp", "1970 01 06 0:00:00", "\\u00FAt", "1970 01 06 0:00:00", 1609 "ccc", "fp", "1970 01 07 0:00:00", "st", "1970 01 07 0:00:00", 1610 "ccc", "fp", "1970 01 01 0:00:00", "\\u010Dt", "1970 01 01 0:00:00", 1611 "ccc", "fp", "1970 01 02 0:00:00", "p\\u00E1", "1970 01 02 0:00:00", 1612 "ccc", "fp", "1970 01 03 0:00:00", "so", "1970 01 03 0:00:00", 1613 }; 1614 1615 expect(EN_DATA, ARRAY_SIZE(EN_DATA), Locale("en", "", "")); 1616 expect(CS_DATA, ARRAY_SIZE(CS_DATA), Locale("cs", "", "")); 1617 } 1618 1619 void DateFormatTest::TestNarrowNames() 1620 { 1621 const char *EN_DATA[] = { 1622 "yyyy MM dd HH:mm:ss", 1623 1624 "yyyy MMMMM dd H:mm:ss", "2004 03 10 16:36:31", "2004 M 10 16:36:31", 1625 "yyyy LLLLL dd H:mm:ss", "2004 03 10 16:36:31", "2004 M 10 16:36:31", 1626 1627 "MMMMM", "1970 01 01 0:00:00", "J", 1628 "MMMMM", "1970 02 01 0:00:00", "F", 1629 "MMMMM", "1970 03 01 0:00:00", "M", 1630 "MMMMM", "1970 04 01 0:00:00", "A", 1631 "MMMMM", "1970 05 01 0:00:00", "M", 1632 "MMMMM", "1970 06 01 0:00:00", "J", 1633 "MMMMM", "1970 07 01 0:00:00", "J", 1634 "MMMMM", "1970 08 01 0:00:00", "A", 1635 "MMMMM", "1970 09 01 0:00:00", "S", 1636 "MMMMM", "1970 10 01 0:00:00", "O", 1637 "MMMMM", "1970 11 01 0:00:00", "N", 1638 "MMMMM", "1970 12 01 0:00:00", "D", 1639 1640 "LLLLL", "1970 01 01 0:00:00", "J", 1641 "LLLLL", "1970 02 01 0:00:00", "F", 1642 "LLLLL", "1970 03 01 0:00:00", "M", 1643 "LLLLL", "1970 04 01 0:00:00", "A", 1644 "LLLLL", "1970 05 01 0:00:00", "M", 1645 "LLLLL", "1970 06 01 0:00:00", "J", 1646 "LLLLL", "1970 07 01 0:00:00", "J", 1647 "LLLLL", "1970 08 01 0:00:00", "A", 1648 "LLLLL", "1970 09 01 0:00:00", "S", 1649 "LLLLL", "1970 10 01 0:00:00", "O", 1650 "LLLLL", "1970 11 01 0:00:00", "N", 1651 "LLLLL", "1970 12 01 0:00:00", "D", 1652 1653 "EEEEE", "1970 01 04 0:00:00", "S", 1654 "EEEEE", "1970 01 05 0:00:00", "M", 1655 "EEEEE", "1970 01 06 0:00:00", "T", 1656 "EEEEE", "1970 01 07 0:00:00", "W", 1657 "EEEEE", "1970 01 01 0:00:00", "T", 1658 "EEEEE", "1970 01 02 0:00:00", "F", 1659 "EEEEE", "1970 01 03 0:00:00", "S", 1660 1661 "ccccc", "1970 01 04 0:00:00", "S", 1662 "ccccc", "1970 01 05 0:00:00", "M", 1663 "ccccc", "1970 01 06 0:00:00", "T", 1664 "ccccc", "1970 01 07 0:00:00", "W", 1665 "ccccc", "1970 01 01 0:00:00", "T", 1666 "ccccc", "1970 01 02 0:00:00", "F", 1667 "ccccc", "1970 01 03 0:00:00", "S", 1668 }; 1669 1670 const char *CS_DATA[] = { 1671 "yyyy MM dd HH:mm:ss", 1672 1673 "yyyy LLLLL dd H:mm:ss", "2004 04 10 16:36:31", "2004 d 10 16:36:31", 1674 "yyyy MMMMM dd H:mm:ss", "2004 04 10 16:36:31", "2004 4 10 16:36:31", 1675 1676 "MMMMM", "1970 01 01 0:00:00", "1", 1677 "MMMMM", "1970 02 01 0:00:00", "2", 1678 "MMMMM", "1970 03 01 0:00:00", "3", 1679 "MMMMM", "1970 04 01 0:00:00", "4", 1680 "MMMMM", "1970 05 01 0:00:00", "5", 1681 "MMMMM", "1970 06 01 0:00:00", "6", 1682 "MMMMM", "1970 07 01 0:00:00", "7", 1683 "MMMMM", "1970 08 01 0:00:00", "8", 1684 "MMMMM", "1970 09 01 0:00:00", "9", 1685 "MMMMM", "1970 10 01 0:00:00", "10", 1686 "MMMMM", "1970 11 01 0:00:00", "11", 1687 "MMMMM", "1970 12 01 0:00:00", "12", 1688 1689 "LLLLL", "1970 01 01 0:00:00", "l", 1690 "LLLLL", "1970 02 01 0:00:00", "\\u00FA", 1691 "LLLLL", "1970 03 01 0:00:00", "b", 1692 "LLLLL", "1970 04 01 0:00:00", "d", 1693 "LLLLL", "1970 05 01 0:00:00", "k", 1694 "LLLLL", "1970 06 01 0:00:00", "\\u010D", 1695 "LLLLL", "1970 07 01 0:00:00", "\\u010D", 1696 "LLLLL", "1970 08 01 0:00:00", "s", 1697 "LLLLL", "1970 09 01 0:00:00", "z", 1698 "LLLLL", "1970 10 01 0:00:00", "\\u0159", 1699 "LLLLL", "1970 11 01 0:00:00", "l", 1700 "LLLLL", "1970 12 01 0:00:00", "p", 1701 1702 "EEEEE", "1970 01 04 0:00:00", "N", 1703 "EEEEE", "1970 01 05 0:00:00", "P", 1704 "EEEEE", "1970 01 06 0:00:00", "\\u00DA", 1705 "EEEEE", "1970 01 07 0:00:00", "S", 1706 "EEEEE", "1970 01 01 0:00:00", "\\u010C", 1707 "EEEEE", "1970 01 02 0:00:00", "P", 1708 "EEEEE", "1970 01 03 0:00:00", "S", 1709 1710 "ccccc", "1970 01 04 0:00:00", "N", 1711 "ccccc", "1970 01 05 0:00:00", "P", 1712 "ccccc", "1970 01 06 0:00:00", "\\u00DA", 1713 "ccccc", "1970 01 07 0:00:00", "S", 1714 "ccccc", "1970 01 01 0:00:00", "\\u010C", 1715 "ccccc", "1970 01 02 0:00:00", "P", 1716 "ccccc", "1970 01 03 0:00:00", "S", 1717 }; 1718 1719 expectFormat(EN_DATA, ARRAY_SIZE(EN_DATA), Locale("en", "", "")); 1720 expectFormat(CS_DATA, ARRAY_SIZE(CS_DATA), Locale("cs", "", "")); 1721 } 1722 1723 void DateFormatTest::TestEras() 1724 { 1725 const char *EN_DATA[] = { 1726 "yyyy MM dd", 1727 1728 "MMMM dd yyyy G", "fp", "1951 07 17", "July 17 1951 AD", "1951 07 17", 1729 "MMMM dd yyyy GG", "fp", "1951 07 17", "July 17 1951 AD", "1951 07 17", 1730 "MMMM dd yyyy GGG", "fp", "1951 07 17", "July 17 1951 AD", "1951 07 17", 1731 "MMMM dd yyyy GGGG", "fp", "1951 07 17", "July 17 1951 Anno Domini", "1951 07 17", 1732 1733 "MMMM dd yyyy G", "fp", "-438 07 17", "July 17 0439 BC", "-438 07 17", 1734 "MMMM dd yyyy GG", "fp", "-438 07 17", "July 17 0439 BC", "-438 07 17", 1735 "MMMM dd yyyy GGG", "fp", "-438 07 17", "July 17 0439 BC", "-438 07 17", 1736 "MMMM dd yyyy GGGG", "fp", "-438 07 17", "July 17 0439 Before Christ", "-438 07 17", 1737 }; 1738 1739 expect(EN_DATA, ARRAY_SIZE(EN_DATA), Locale("en", "", "")); 1740 } 1741 1742 void DateFormatTest::TestQuarters() 1743 { 1744 const char *EN_DATA[] = { 1745 "yyyy MM dd", 1746 1747 "Q", "fp", "1970 01 01", "1", "1970 01 01", 1748 "QQ", "fp", "1970 04 01", "02", "1970 04 01", 1749 "QQQ", "fp", "1970 07 01", "Q3", "1970 07 01", 1750 "QQQQ", "fp", "1970 10 01", "4th quarter", "1970 10 01", 1751 1752 "q", "fp", "1970 01 01", "1", "1970 01 01", 1753 "qq", "fp", "1970 04 01", "02", "1970 04 01", 1754 "qqq", "fp", "1970 07 01", "Q3", "1970 07 01", 1755 "qqqq", "fp", "1970 10 01", "4th quarter", "1970 10 01", 1756 }; 1757 1758 expect(EN_DATA, ARRAY_SIZE(EN_DATA), Locale("en", "", "")); 1759 } 1760 1761 /** 1762 * Test parsing. Input is an array that starts with the following 1763 * header: 1764 * 1765 * [0] = pattern string to parse [i+2] with 1766 * 1767 * followed by test cases, each of which is 3 array elements: 1768 * 1769 * [i] = pattern, or NULL to reuse prior pattern 1770 * [i+1] = input string 1771 * [i+2] = expected parse result (parsed with pattern [0]) 1772 * 1773 * If expect parse failure, then [i+2] should be NULL. 1774 */ 1775 void DateFormatTest::expectParse(const char** data, int32_t data_length, 1776 const Locale& loc) { 1777 const UDate FAIL = (UDate) -1; 1778 const UnicodeString FAIL_STR("parse failure"); 1779 int32_t i = 0; 1780 1781 UErrorCode ec = U_ZERO_ERROR; 1782 SimpleDateFormat fmt("", loc, ec); 1783 SimpleDateFormat ref(data[i++], loc, ec); 1784 SimpleDateFormat gotfmt("G yyyy MM dd HH:mm:ss z", loc, ec); 1785 if (U_FAILURE(ec)) { 1786 dataerrln("FAIL: SimpleDateFormat constructor - %s", u_errorName(ec)); 1787 return; 1788 } 1789 1790 const char* currentPat = NULL; 1791 while (i<data_length) { 1792 const char* pattern = data[i++]; 1793 const char* input = data[i++]; 1794 const char* expected = data[i++]; 1795 1796 ec = U_ZERO_ERROR; 1797 if (pattern != NULL) { 1798 fmt.applyPattern(pattern); 1799 currentPat = pattern; 1800 } 1801 UDate got = fmt.parse(input, ec); 1802 UnicodeString gotstr(FAIL_STR); 1803 if (U_FAILURE(ec)) { 1804 got = FAIL; 1805 } else { 1806 gotstr.remove(); 1807 gotfmt.format(got, gotstr); 1808 } 1809 1810 UErrorCode ec2 = U_ZERO_ERROR; 1811 UDate exp = FAIL; 1812 UnicodeString expstr(FAIL_STR); 1813 if (expected != NULL) { 1814 expstr = expected; 1815 exp = ref.parse(expstr, ec2); 1816 if (U_FAILURE(ec2)) { 1817 // This only happens if expected is in wrong format -- 1818 // should never happen once test is debugged. 1819 errln("FAIL: Internal test error"); 1820 return; 1821 } 1822 } 1823 1824 if (got == exp) { 1825 logln((UnicodeString)"Ok: " + input + " x " + 1826 currentPat + " => " + gotstr); 1827 } else { 1828 errln((UnicodeString)"FAIL: " + input + " x " + 1829 currentPat + " => " + gotstr + ", expected " + 1830 expstr); 1831 } 1832 } 1833 } 1834 1835 /** 1836 * Test formatting and parsing. Input is an array that starts 1837 * with the following header: 1838 * 1839 * [0] = pattern string to parse [i+2] with 1840 * 1841 * followed by test cases, each of which is 3 array elements: 1842 * 1843 * [i] = pattern, or null to reuse prior pattern 1844 * [i+1] = control string, either "fp", "pf", or "F". 1845 * [i+2..] = data strings 1846 * 1847 * The number of data strings depends on the control string. 1848 * Examples: 1849 * 1. "y/M/d H:mm:ss.SS", "fp", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.56", "2004 03 10 16:36:31.560", 1850 * 'f': Format date [i+2] (as parsed using pattern [0]) and expect string [i+3]. 1851 * 'p': Parse string [i+3] and expect date [i+4]. 1852 * 1853 * 2. "y/M/d H:mm:ss.SSS", "F", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.567" 1854 * 'F': Format date [i+2] and expect string [i+3], 1855 * then parse string [i+3] and expect date [i+2]. 1856 * 1857 * 3. "y/M/d H:mm:ss.SSSS", "pf", "2004/3/10 16:36:31.5679", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.5670", 1858 * 'p': Parse string [i+2] and expect date [i+3]. 1859 * 'f': Format date [i+3] and expect string [i+4]. 1860 */ 1861 void DateFormatTest::expect(const char** data, int32_t data_length, 1862 const Locale& loc) { 1863 int32_t i = 0; 1864 UErrorCode ec = U_ZERO_ERROR; 1865 UnicodeString str, str2; 1866 SimpleDateFormat fmt("", loc, ec); 1867 SimpleDateFormat ref(data[i++], loc, ec); 1868 SimpleDateFormat univ("EE G yyyy MM dd HH:mm:ss.SSS z", loc, ec); 1869 if (U_FAILURE(ec)) { 1870 dataerrln("Fail construct SimpleDateFormat: %s", u_errorName(ec)); 1871 return; 1872 } 1873 1874 UnicodeString currentPat; 1875 while (i<data_length) { 1876 const char* pattern = data[i++]; 1877 if (pattern != NULL) { 1878 fmt.applyPattern(pattern); 1879 currentPat = pattern; 1880 } 1881 1882 const char* control = data[i++]; 1883 1884 if (uprv_strcmp(control, "fp") == 0) { 1885 // 'f' 1886 const char* datestr = data[i++]; 1887 const char* string = data[i++]; 1888 UDate date = ref.parse(ctou(datestr), ec); 1889 if (!assertSuccess("parse", ec)) return; 1890 assertEquals((UnicodeString)"\"" + currentPat + "\".format(" + datestr + ")", 1891 ctou(string), 1892 fmt.format(date, str.remove())); 1893 // 'p' 1894 datestr = data[i++]; 1895 date = ref.parse(ctou(datestr), ec); 1896 if (!assertSuccess("parse", ec)) return; 1897 UDate parsedate = fmt.parse(ctou(string), ec); 1898 if (assertSuccess((UnicodeString)"\"" + currentPat + "\".parse(" + string + ")", ec)) { 1899 assertEquals((UnicodeString)"\"" + currentPat + "\".parse(" + string + ")", 1900 univ.format(date, str.remove()), 1901 univ.format(parsedate, str2.remove())); 1902 } 1903 } 1904 1905 else if (uprv_strcmp(control, "pf") == 0) { 1906 // 'p' 1907 const char* string = data[i++]; 1908 const char* datestr = data[i++]; 1909 UDate date = ref.parse(ctou(datestr), ec); 1910 if (!assertSuccess("parse", ec)) return; 1911 UDate parsedate = fmt.parse(ctou(string), ec); 1912 if (assertSuccess((UnicodeString)"\"" + currentPat + "\".parse(" + string + ")", ec)) { 1913 assertEquals((UnicodeString)"\"" + currentPat + "\".parse(" + string + ")", 1914 univ.format(date, str.remove()), 1915 univ.format(parsedate, str2.remove())); 1916 } 1917 // 'f' 1918 string = data[i++]; 1919 assertEquals((UnicodeString)"\"" + currentPat + "\".format(" + datestr + ")", 1920 ctou(string), 1921 fmt.format(date, str.remove())); 1922 } 1923 1924 else if (uprv_strcmp(control, "F") == 0) { 1925 const char* datestr = data[i++]; 1926 const char* string = data[i++]; 1927 UDate date = ref.parse(ctou(datestr), ec); 1928 if (!assertSuccess("parse", ec)) return; 1929 assertEquals((UnicodeString)"\"" + currentPat + "\".format(" + datestr + ")", 1930 ctou(string), 1931 fmt.format(date, str.remove())); 1932 1933 UDate parsedate = fmt.parse(string, ec); 1934 if (assertSuccess((UnicodeString)"\"" + currentPat + "\".parse(" + string + ")", ec)) { 1935 assertEquals((UnicodeString)"\"" + currentPat + "\".parse(" + string + ")", 1936 univ.format(date, str.remove()), 1937 univ.format(parsedate, str2.remove())); 1938 } 1939 } 1940 1941 else { 1942 errln((UnicodeString)"FAIL: Invalid control string " + control); 1943 return; 1944 } 1945 } 1946 } 1947 1948 /** 1949 * Test formatting. Input is an array that starts 1950 * with the following header: 1951 * 1952 * [0] = pattern string to parse [i+2] with 1953 * 1954 * followed by test cases, each of which is 3 array elements: 1955 * 1956 * [i] = pattern, or null to reuse prior pattern 1957 * [i+1] = data string a 1958 * [i+2] = data string b 1959 * 1960 * Examples: 1961 * Format date [i+1] and expect string [i+2]. 1962 * 1963 * "y/M/d H:mm:ss.SSSS", "2004/3/10 16:36:31.5679", "2004 03 10 16:36:31.567" 1964 */ 1965 void DateFormatTest::expectFormat(const char** data, int32_t data_length, 1966 const Locale& loc) { 1967 int32_t i = 0; 1968 UErrorCode ec = U_ZERO_ERROR; 1969 UnicodeString str, str2; 1970 SimpleDateFormat fmt("", loc, ec); 1971 SimpleDateFormat ref(data[i++], loc, ec); 1972 SimpleDateFormat univ("EE G yyyy MM dd HH:mm:ss.SSS z", loc, ec); 1973 if (U_FAILURE(ec)) { 1974 dataerrln("Fail construct SimpleDateFormat: %s", u_errorName(ec)); 1975 return; 1976 } 1977 1978 UnicodeString currentPat; 1979 1980 while (i<data_length) { 1981 const char* pattern = data[i++]; 1982 if (pattern != NULL) { 1983 fmt.applyPattern(pattern); 1984 currentPat = pattern; 1985 } 1986 1987 const char* datestr = data[i++]; 1988 const char* string = data[i++]; 1989 UDate date = ref.parse(ctou(datestr), ec); 1990 if (!assertSuccess("parse", ec)) return; 1991 assertEquals((UnicodeString)"\"" + currentPat + "\".format(" + datestr + ")", 1992 ctou(string), 1993 fmt.format(date, str.remove())); 1994 } 1995 } 1996 1997 void DateFormatTest::TestGenericTime() { 1998 const Locale en("en"); 1999 // Note: We no longer parse strings in different styles. 2000 /* 2001 const char* ZDATA[] = { 2002 "yyyy MM dd HH:mm zzz", 2003 // round trip 2004 "y/M/d H:mm zzzz", "F", "2004 01 01 01:00 PST", "2004/1/1 1:00 Pacific Standard Time", 2005 "y/M/d H:mm zzz", "F", "2004 01 01 01:00 PST", "2004/1/1 1:00 PST", 2006 "y/M/d H:mm vvvv", "F", "2004 01 01 01:00 PST", "2004/1/1 1:00 Pacific Time", 2007 "y/M/d H:mm v", "F", "2004 01 01 01:00 PST", "2004/1/1 1:00 PT", 2008 // non-generic timezone string influences dst offset even if wrong for date/time 2009 "y/M/d H:mm zzz", "pf", "2004/1/1 1:00 PDT", "2004 01 01 01:00 PDT", "2004/1/1 0:00 PST", 2010 "y/M/d H:mm vvvv", "pf", "2004/1/1 1:00 PDT", "2004 01 01 01:00 PDT", "2004/1/1 0:00 Pacific Time", 2011 "y/M/d H:mm zzz", "pf", "2004/7/1 1:00 PST", "2004 07 01 02:00 PDT", "2004/7/1 2:00 PDT", 2012 "y/M/d H:mm vvvv", "pf", "2004/7/1 1:00 PST", "2004 07 01 02:00 PDT", "2004/7/1 2:00 Pacific Time", 2013 // generic timezone generates dst offset appropriate for local time 2014 "y/M/d H:mm zzz", "pf", "2004/1/1 1:00 PT", "2004 01 01 01:00 PST", "2004/1/1 1:00 PST", 2015 "y/M/d H:mm vvvv", "pf", "2004/1/1 1:00 PT", "2004 01 01 01:00 PST", "2004/1/1 1:00 Pacific Time", 2016 "y/M/d H:mm zzz", "pf", "2004/7/1 1:00 PT", "2004 07 01 01:00 PDT", "2004/7/1 1:00 PDT", 2017 "y/M/d H:mm vvvv", "pf", "2004/7/1 1:00 PT", "2004 07 01 01:00 PDT", "2004/7/1 1:00 Pacific Time", 2018 // daylight savings time transition edge cases. 2019 // time to parse does not really exist, PT interpreted as earlier time 2020 "y/M/d H:mm zzz", "pf", "2005/4/3 2:30 PT", "2005 04 03 03:30 PDT", "2005/4/3 3:30 PDT", 2021 "y/M/d H:mm zzz", "pf", "2005/4/3 2:30 PST", "2005 04 03 03:30 PDT", "2005/4/3 3:30 PDT", 2022 "y/M/d H:mm zzz", "pf", "2005/4/3 2:30 PDT", "2005 04 03 01:30 PST", "2005/4/3 1:30 PST", 2023 "y/M/d H:mm v", "pf", "2005/4/3 2:30 PT", "2005 04 03 03:30 PDT", "2005/4/3 3:30 PT", 2024 "y/M/d H:mm v", "pf", "2005/4/3 2:30 PST", "2005 04 03 03:30 PDT", "2005/4/3 3:30 PT", 2025 "y/M/d H:mm v", "pf", "2005/4/3 2:30 PDT", "2005 04 03 01:30 PST", "2005/4/3 1:30 PT", 2026 "y/M/d H:mm", "pf", "2005/4/3 2:30", "2005 04 03 03:30 PDT", "2005/4/3 3:30", 2027 // time to parse is ambiguous, PT interpreted as later time 2028 "y/M/d H:mm zzz", "pf", "2005/10/30 1:30 PT", "2005 10 30 01:30 PST", "2005/10/30 1:30 PST", 2029 "y/M/d H:mm v", "pf", "2005/10/30 1:30 PT", "2005 10 30 01:30 PST", "2005/10/30 1:30 PT", 2030 "y/M/d H:mm", "pf", "2005/10/30 1:30 PT", "2005 10 30 01:30 PST", "2005/10/30 1:30", 2031 2032 "y/M/d H:mm zzz", "pf", "2004/10/31 1:30 PT", "2004 10 31 01:30 PST", "2004/10/31 1:30 PST", 2033 "y/M/d H:mm zzz", "pf", "2004/10/31 1:30 PST", "2004 10 31 01:30 PST", "2004/10/31 1:30 PST", 2034 "y/M/d H:mm zzz", "pf", "2004/10/31 1:30 PDT", "2004 10 31 01:30 PDT", "2004/10/31 1:30 PDT", 2035 "y/M/d H:mm v", "pf", "2004/10/31 1:30 PT", "2004 10 31 01:30 PST", "2004/10/31 1:30 PT", 2036 "y/M/d H:mm v", "pf", "2004/10/31 1:30 PST", "2004 10 31 01:30 PST", "2004/10/31 1:30 PT", 2037 "y/M/d H:mm v", "pf", "2004/10/31 1:30 PDT", "2004 10 31 01:30 PDT", "2004/10/31 1:30 PT", 2038 "y/M/d H:mm", "pf", "2004/10/31 1:30", "2004 10 31 01:30 PST", "2004/10/31 1:30", 2039 }; 2040 */ 2041 const char* ZDATA[] = { 2042 "yyyy MM dd HH:mm zzz", 2043 // round trip 2044 "y/M/d H:mm zzzz", "F", "2004 01 01 01:00 PST", "2004/1/1 1:00 Pacific Standard Time", 2045 "y/M/d H:mm zzz", "F", "2004 01 01 01:00 PST", "2004/1/1 1:00 PST", 2046 "y/M/d H:mm vvvv", "F", "2004 01 01 01:00 PST", "2004/1/1 1:00 Pacific Time", 2047 "y/M/d H:mm v", "F", "2004 01 01 01:00 PST", "2004/1/1 1:00 PT", 2048 // non-generic timezone string influences dst offset even if wrong for date/time 2049 "y/M/d H:mm zzz", "pf", "2004/1/1 1:00 PDT", "2004 01 01 01:00 PDT", "2004/1/1 0:00 PST", 2050 "y/M/d H:mm zzz", "pf", "2004/7/1 1:00 PST", "2004 07 01 02:00 PDT", "2004/7/1 2:00 PDT", 2051 // generic timezone generates dst offset appropriate for local time 2052 "y/M/d H:mm zzz", "pf", "2004/1/1 1:00 PST", "2004 01 01 01:00 PST", "2004/1/1 1:00 PST", 2053 "y/M/d H:mm vvvv", "pf", "2004/1/1 1:00 Pacific Time", "2004 01 01 01:00 PST", "2004/1/1 1:00 Pacific Time", 2054 "y/M/d H:mm zzz", "pf", "2004/7/1 1:00 PDT", "2004 07 01 01:00 PDT", "2004/7/1 1:00 PDT", 2055 "y/M/d H:mm vvvv", "pf", "2004/7/1 1:00 Pacific Time", "2004 07 01 01:00 PDT", "2004/7/1 1:00 Pacific Time", 2056 // daylight savings time transition edge cases. 2057 // time to parse does not really exist, PT interpreted as earlier time 2058 "y/M/d H:mm zzz", "pf", "2005/4/3 2:30 PST", "2005 04 03 03:30 PDT", "2005/4/3 3:30 PDT", 2059 "y/M/d H:mm zzz", "pf", "2005/4/3 2:30 PDT", "2005 04 03 01:30 PST", "2005/4/3 1:30 PST", 2060 "y/M/d H:mm v", "pf", "2005/4/3 2:30 PT", "2005 04 03 03:30 PDT", "2005/4/3 3:30 PT", 2061 "y/M/d H:mm", "pf", "2005/4/3 2:30", "2005 04 03 03:30 PDT", "2005/4/3 3:30", 2062 // time to parse is ambiguous, PT interpreted as later time 2063 "y/M/d H:mm v", "pf", "2005/10/30 1:30 PT", "2005 10 30 01:30 PST", "2005/10/30 1:30 PT", 2064 "y/M/d H:mm", "pf", "2005/10/30 1:30 PT", "2005 10 30 01:30 PST", "2005/10/30 1:30", 2065 2066 "y/M/d H:mm zzz", "pf", "2004/10/31 1:30 PST", "2004 10 31 01:30 PST", "2004/10/31 1:30 PST", 2067 "y/M/d H:mm zzz", "pf", "2004/10/31 1:30 PDT", "2004 10 31 01:30 PDT", "2004/10/31 1:30 PDT", 2068 "y/M/d H:mm v", "pf", "2004/10/31 1:30 PT", "2004 10 31 01:30 PST", "2004/10/31 1:30 PT", 2069 "y/M/d H:mm", "pf", "2004/10/31 1:30", "2004 10 31 01:30 PST", "2004/10/31 1:30", 2070 }; 2071 2072 const int32_t ZDATA_length = sizeof(ZDATA)/ sizeof(ZDATA[0]); 2073 expect(ZDATA, ZDATA_length, en); 2074 2075 UErrorCode status = U_ZERO_ERROR; 2076 2077 logln("cross format/parse tests"); // Note: We no longer support cross format/parse 2078 UnicodeString basepat("yy/MM/dd H:mm "); 2079 SimpleDateFormat formats[] = { 2080 SimpleDateFormat(basepat + "vvv", en, status), 2081 SimpleDateFormat(basepat + "vvvv", en, status), 2082 SimpleDateFormat(basepat + "zzz", en, status), 2083 SimpleDateFormat(basepat + "zzzz", en, status) 2084 }; 2085 if (U_FAILURE(status)) { 2086 dataerrln("Fail construct SimpleDateFormat: %s", u_errorName(status)); 2087 return; 2088 } 2089 const int32_t formats_length = sizeof(formats)/sizeof(formats[0]); 2090 2091 UnicodeString test; 2092 SimpleDateFormat univ("yyyy MM dd HH:mm zzz", en, status); 2093 ASSERT_OK(status); 2094 const UnicodeString times[] = { 2095 "2004 01 02 03:04 PST", 2096 "2004 07 08 09:10 PDT" 2097 }; 2098 int32_t times_length = sizeof(times)/sizeof(times[0]); 2099 for (int i = 0; i < times_length; ++i) { 2100 UDate d = univ.parse(times[i], status); 2101 logln(UnicodeString("\ntime: ") + d); 2102 for (int j = 0; j < formats_length; ++j) { 2103 test.remove(); 2104 formats[j].format(d, test); 2105 logln("\ntest: '" + test + "'"); 2106 for (int k = 0; k < formats_length; ++k) { 2107 UDate t = formats[k].parse(test, status); 2108 if (U_SUCCESS(status)) { 2109 if (d != t) { 2110 errln((UnicodeString)"FAIL: format " + k + 2111 " incorrectly parsed output of format " + j + 2112 " (" + test + "), returned " + 2113 dateToString(t) + " instead of " + dateToString(d)); 2114 } else { 2115 logln((UnicodeString)"OK: format " + k + " parsed ok"); 2116 } 2117 } else if (status == U_PARSE_ERROR) { 2118 errln((UnicodeString)"FAIL: format " + k + 2119 " could not parse output of format " + j + 2120 " (" + test + ")"); 2121 } 2122 } 2123 } 2124 } 2125 } 2126 2127 void DateFormatTest::TestGenericTimeZoneOrder() { 2128 // generic times should parse the same no matter what the placement of the time zone string 2129 2130 // Note: We no longer support cross style format/parse 2131 2132 //const char* XDATA[] = { 2133 // "yyyy MM dd HH:mm zzz", 2134 // // standard time, explicit daylight/standard 2135 // "y/M/d H:mm zzz", "pf", "2004/1/1 1:00 PT", "2004 01 01 01:00 PST", "2004/1/1 1:00 PST", 2136 // "y/M/d zzz H:mm", "pf", "2004/1/1 PT 1:00", "2004 01 01 01:00 PST", "2004/1/1 PST 1:00", 2137 // "zzz y/M/d H:mm", "pf", "PT 2004/1/1 1:00", "2004 01 01 01:00 PST", "PST 2004/1/1 1:00", 2138 2139 // // standard time, generic 2140 // "y/M/d H:mm vvvv", "pf", "2004/1/1 1:00 PT", "2004 01 01 01:00 PST", "2004/1/1 1:00 Pacific Time", 2141 // "y/M/d vvvv H:mm", "pf", "2004/1/1 PT 1:00", "2004 01 01 01:00 PST", "2004/1/1 Pacific Time 1:00", 2142 // "vvvv y/M/d H:mm", "pf", "PT 2004/1/1 1:00", "2004 01 01 01:00 PST", "Pacific Time 2004/1/1 1:00", 2143 2144 // // dahylight time, explicit daylight/standard 2145 // "y/M/d H:mm zzz", "pf", "2004/7/1 1:00 PT", "2004 07 01 01:00 PDT", "2004/7/1 1:00 PDT", 2146 // "y/M/d zzz H:mm", "pf", "2004/7/1 PT 1:00", "2004 07 01 01:00 PDT", "2004/7/1 PDT 1:00", 2147 // "zzz y/M/d H:mm", "pf", "PT 2004/7/1 1:00", "2004 07 01 01:00 PDT", "PDT 2004/7/1 1:00", 2148 2149 // // daylight time, generic 2150 // "y/M/d H:mm vvvv", "pf", "2004/7/1 1:00 PT", "2004 07 01 01:00 PDT", "2004/7/1 1:00 Pacific Time", 2151 // "y/M/d vvvv H:mm", "pf", "2004/7/1 PT 1:00", "2004 07 01 01:00 PDT", "2004/7/1 Pacific Time 1:00", 2152 // "vvvv y/M/d H:mm", "pf", "PT 2004/7/1 1:00", "2004 07 01 01:00 PDT", "Pacific Time 2004/7/1 1:00", 2153 //}; 2154 const char* XDATA[] = { 2155 "yyyy MM dd HH:mm zzz", 2156 // standard time, explicit daylight/standard 2157 "y/M/d H:mm zzz", "pf", "2004/1/1 1:00 PST", "2004 01 01 01:00 PST", "2004/1/1 1:00 PST", 2158 "y/M/d zzz H:mm", "pf", "2004/1/1 PST 1:00", "2004 01 01 01:00 PST", "2004/1/1 PST 1:00", 2159 "zzz y/M/d H:mm", "pf", "PST 2004/1/1 1:00", "2004 01 01 01:00 PST", "PST 2004/1/1 1:00", 2160 2161 // standard time, generic 2162 "y/M/d H:mm vvvv", "pf", "2004/1/1 1:00 Pacific Time", "2004 01 01 01:00 PST", "2004/1/1 1:00 Pacific Time", 2163 "y/M/d vvvv H:mm", "pf", "2004/1/1 Pacific Time 1:00", "2004 01 01 01:00 PST", "2004/1/1 Pacific Time 1:00", 2164 "vvvv y/M/d H:mm", "pf", "Pacific Time 2004/1/1 1:00", "2004 01 01 01:00 PST", "Pacific Time 2004/1/1 1:00", 2165 2166 // dahylight time, explicit daylight/standard 2167 "y/M/d H:mm zzz", "pf", "2004/7/1 1:00 PDT", "2004 07 01 01:00 PDT", "2004/7/1 1:00 PDT", 2168 "y/M/d zzz H:mm", "pf", "2004/7/1 PDT 1:00", "2004 07 01 01:00 PDT", "2004/7/1 PDT 1:00", 2169 "zzz y/M/d H:mm", "pf", "PDT 2004/7/1 1:00", "2004 07 01 01:00 PDT", "PDT 2004/7/1 1:00", 2170 2171 // daylight time, generic 2172 "y/M/d H:mm v", "pf", "2004/7/1 1:00 PT", "2004 07 01 01:00 PDT", "2004/7/1 1:00 PT", 2173 "y/M/d v H:mm", "pf", "2004/7/1 PT 1:00", "2004 07 01 01:00 PDT", "2004/7/1 PT 1:00", 2174 "v y/M/d H:mm", "pf", "PT 2004/7/1 1:00", "2004 07 01 01:00 PDT", "PT 2004/7/1 1:00", 2175 }; 2176 const int32_t XDATA_length = sizeof(XDATA)/sizeof(XDATA[0]); 2177 Locale en("en"); 2178 expect(XDATA, XDATA_length, en); 2179 } 2180 2181 void DateFormatTest::TestZTimeZoneParsing(void) { 2182 UErrorCode status = U_ZERO_ERROR; 2183 const Locale en("en"); 2184 UnicodeString test; 2185 //SimpleDateFormat univ("yyyy-MM-dd'T'HH:mm Z", en, status); 2186 SimpleDateFormat univ("HH:mm Z", en, status); 2187 if (failure(status, "construct SimpleDateFormat", TRUE)) return; 2188 const TimeZone *t = TimeZone::getGMT(); 2189 univ.setTimeZone(*t); 2190 2191 univ.setLenient(false); 2192 ParsePosition pp(0); 2193 struct { 2194 UnicodeString input; 2195 UnicodeString expected_result; 2196 } tests[] = { 2197 { "11:00 -0200", "13:00 +0000" }, 2198 { "11:00 +0200", "09:00 +0000" }, 2199 { "11:00 +0400", "07:00 +0000" }, 2200 { "11:00 +0530", "05:30 +0000" } 2201 }; 2202 2203 UnicodeString result; 2204 int32_t tests_length = sizeof(tests)/sizeof(tests[0]); 2205 for (int i = 0; i < tests_length; ++i) { 2206 pp.setIndex(0); 2207 UDate d = univ.parse(tests[i].input, pp); 2208 if(pp.getIndex() != tests[i].input.length()){ 2209 errln("Test %i: setZoneString() did not succeed. Consumed: %i instead of %i", 2210 i, pp.getIndex(), tests[i].input.length()); 2211 return; 2212 } 2213 result.remove(); 2214 univ.format(d, result); 2215 if(result != tests[i].expected_result) { 2216 errln("Expected " + tests[i].expected_result 2217 + " got " + result); 2218 return; 2219 } 2220 logln("SUCCESS: Parsed " + tests[i].input 2221 + " got " + result 2222 + " expected " + tests[i].expected_result); 2223 } 2224 } 2225 2226 void DateFormatTest::TestHost(void) 2227 { 2228 #if U_PLATFORM_HAS_WIN32_API 2229 Win32DateTimeTest::testLocales(this); 2230 #endif 2231 } 2232 2233 // Relative Date Tests 2234 2235 void DateFormatTest::TestRelative(int daysdelta, 2236 const Locale& loc, 2237 const char *expectChars) { 2238 char banner[25]; 2239 sprintf(banner, "%d", daysdelta); 2240 UnicodeString bannerStr(banner, ""); 2241 2242 UErrorCode status = U_ZERO_ERROR; 2243 2244 FieldPosition pos(0); 2245 UnicodeString test; 2246 Locale en("en"); 2247 DateFormat *fullrelative = DateFormat::createDateInstance(DateFormat::kFullRelative, loc); 2248 2249 if (fullrelative == NULL) { 2250 dataerrln("DateFormat::createDateInstance(DateFormat::kFullRelative, %s) returned NULL", loc.getName()); 2251 return; 2252 } 2253 2254 DateFormat *full = DateFormat::createDateInstance(DateFormat::kFull , loc); 2255 2256 if (full == NULL) { 2257 errln("DateFormat::createDateInstance(DateFormat::kFull, %s) returned NULL", loc.getName()); 2258 return; 2259 } 2260 2261 DateFormat *en_full = DateFormat::createDateInstance(DateFormat::kFull, en); 2262 2263 if (en_full == NULL) { 2264 errln("DateFormat::createDateInstance(DateFormat::kFull, en) returned NULL"); 2265 return; 2266 } 2267 2268 DateFormat *en_fulltime = DateFormat::createDateTimeInstance(DateFormat::kFull,DateFormat::kFull,en); 2269 2270 if (en_fulltime == NULL) { 2271 errln("DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, en) returned NULL"); 2272 return; 2273 } 2274 2275 UnicodeString result; 2276 UnicodeString normalResult; 2277 UnicodeString expect; 2278 UnicodeString parseResult; 2279 2280 Calendar *c = Calendar::createInstance(status); 2281 2282 // Today = Today 2283 c->setTime(Calendar::getNow(), status); 2284 if(daysdelta != 0) { 2285 c->add(Calendar::DATE,daysdelta,status); 2286 } 2287 ASSERT_OK(status); 2288 2289 // calculate the expected string 2290 if(expectChars != NULL) { 2291 expect = expectChars; 2292 } else { 2293 full->format(*c, expect, pos); // expected = normal full 2294 } 2295 2296 fullrelative ->format(*c, result, pos); 2297 en_full ->format(*c, normalResult, pos); 2298 2299 if(result != expect) { 2300 errln("FAIL: Relative Format ["+bannerStr+"] of "+normalResult+" failed, expected "+expect+" but got " + result); 2301 } else { 2302 logln("PASS: Relative Format ["+bannerStr+"] of "+normalResult+" got " + result); 2303 } 2304 2305 2306 //verify 2307 UDate d = fullrelative->parse(result, status); 2308 ASSERT_OK(status); 2309 2310 UnicodeString parseFormat; // parse rel->format full 2311 en_full->format(d, parseFormat, status); 2312 2313 UnicodeString origFormat; 2314 en_full->format(*c, origFormat, pos); 2315 2316 if(parseFormat!=origFormat) { 2317 errln("FAIL: Relative Parse ["+bannerStr+"] of "+result+" failed, expected "+parseFormat+" but got "+origFormat); 2318 } else { 2319 logln("PASS: Relative Parse ["+bannerStr+"] of "+result+" passed, got "+parseFormat); 2320 } 2321 2322 delete full; 2323 delete fullrelative; 2324 delete en_fulltime; 2325 delete en_full; 2326 delete c; 2327 } 2328 2329 2330 void DateFormatTest::TestRelative(void) 2331 { 2332 Locale en("en"); 2333 TestRelative( 0, en, "Today"); 2334 TestRelative(-1, en, "Yesterday"); 2335 TestRelative( 1, en, "Tomorrow"); 2336 TestRelative( 2, en, NULL); 2337 TestRelative( -2, en, NULL); 2338 TestRelative( 3, en, NULL); 2339 TestRelative( -3, en, NULL); 2340 TestRelative( 300, en, NULL); 2341 TestRelative( -300, en, NULL); 2342 } 2343 2344 void DateFormatTest::TestRelativeClone(void) 2345 { 2346 /* 2347 Verify that a cloned formatter gives the same results 2348 and is useable after the original has been deleted. 2349 */ 2350 UErrorCode status = U_ZERO_ERROR; 2351 Locale loc("en"); 2352 UDate now = Calendar::getNow(); 2353 DateFormat *full = DateFormat::createDateInstance(DateFormat::kFullRelative, loc); 2354 if (full == NULL) { 2355 dataerrln("FAIL: Can't create Relative date instance"); 2356 return; 2357 } 2358 UnicodeString result1; 2359 full->format(now, result1, status); 2360 Format *fullClone = full->clone(); 2361 delete full; 2362 full = NULL; 2363 2364 UnicodeString result2; 2365 fullClone->format(now, result2, status); 2366 ASSERT_OK(status); 2367 if (result1 != result2) { 2368 errln("FAIL: Clone returned different result from non-clone."); 2369 } 2370 delete fullClone; 2371 } 2372 2373 void DateFormatTest::TestHostClone(void) 2374 { 2375 /* 2376 Verify that a cloned formatter gives the same results 2377 and is useable after the original has been deleted. 2378 */ 2379 // This is mainly important on Windows. 2380 UErrorCode status = U_ZERO_ERROR; 2381 Locale loc("en_US@compat=host"); 2382 UDate now = Calendar::getNow(); 2383 DateFormat *full = DateFormat::createDateInstance(DateFormat::kFull, loc); 2384 if (full == NULL) { 2385 dataerrln("FAIL: Can't create Relative date instance"); 2386 return; 2387 } 2388 UnicodeString result1; 2389 full->format(now, result1, status); 2390 Format *fullClone = full->clone(); 2391 delete full; 2392 full = NULL; 2393 2394 UnicodeString result2; 2395 fullClone->format(now, result2, status); 2396 ASSERT_OK(status); 2397 if (result1 != result2) { 2398 errln("FAIL: Clone returned different result from non-clone."); 2399 } 2400 delete fullClone; 2401 } 2402 2403 void DateFormatTest::TestTimeZoneDisplayName() 2404 { 2405 // This test data was ported from ICU4J. Don't know why the 6th column in there because it's not being 2406 // used currently. 2407 const char *fallbackTests[][6] = { 2408 { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" }, 2409 { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-08:00", "-8:00" }, 2410 { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZZ", "-08:00", "-8:00" }, 2411 { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "PST", "America/Los_Angeles" }, 2412 { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "V", "PST", "America/Los_Angeles" }, 2413 { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "Pacific Standard Time", "America/Los_Angeles" }, 2414 { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" }, 2415 { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" }, 2416 { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "PDT", "America/Los_Angeles" }, 2417 { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "V", "PDT", "America/Los_Angeles" }, 2418 { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "Pacific Daylight Time", "America/Los_Angeles" }, 2419 { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "PT", "America/Los_Angeles" }, 2420 { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "Pacific Time", "America/Los_Angeles" }, 2421 { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "VVVV", "Los Angeles Time", "America/Los_Angeles" }, 2422 { "en_GB", "America/Los_Angeles", "2004-01-15T12:00:00Z", "z", "GMT-08:00", "America/Los_Angeles" }, 2423 { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "Z", "-0700", "-7:00" }, 2424 { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" }, 2425 { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "z", "MST", "America/Phoenix" }, 2426 { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "V", "MST", "America/Phoenix" }, 2427 { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "zzzz", "Mountain Standard Time", "America/Phoenix" }, 2428 { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" }, 2429 { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" }, 2430 { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "z", "MST", "America/Phoenix" }, 2431 { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "V", "MST", "America/Phoenix" }, 2432 { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "zzzz", "Mountain Standard Time", "America/Phoenix" }, 2433 { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "v", "MST", "America/Phoenix" }, 2434 { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "vvvv", "Mountain Standard Time", "America/Phoenix" }, 2435 { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "VVVV", "Phoenix Time", "America/Phoenix" }, 2436 2437 { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2438 { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 2439 { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 2440 { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "V", "GMT-03:00", "-3:00" }, 2441 { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "Argentina Standard Time", "-3:00" }, 2442 { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2443 { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 2444 { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 2445 { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "V", "GMT-03:00", "-3:00" }, 2446 { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "Argentina Standard Time", "-3:00" }, 2447 { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "Buenos Aires Time", "America/Buenos_Aires" }, 2448 { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "Argentina Standard Time", "America/Buenos_Aires" }, 2449 { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "VVVV", "Buenos Aires Time", "America/Buenos_Aires" }, 2450 2451 { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2452 { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 2453 { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 2454 { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "V", "GMT-03:00", "-3:00" }, 2455 { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "Argentina Standard Time", "-3:00" }, 2456 { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2457 { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 2458 { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 2459 { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "V", "GMT-03:00", "-3:00" }, 2460 { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "Argentina Standard Time", "-3:00" }, 2461 { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "Buenos Aires Time", "America/Buenos_Aires" }, 2462 { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "Argentina Standard Time", "America/Buenos_Aires" }, 2463 { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "VVVV", "Buenos Aires Time", "America/Buenos_Aires" }, 2464 2465 { "en", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" }, 2466 { "en", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-05:00", "-5:00" }, 2467 { "en", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-05:00", "-5:00" }, 2468 { "en", "America/Havana", "2004-01-15T00:00:00Z", "V", "GMT-05:00", "-5:00" }, 2469 { "en", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "Cuba Standard Time", "-5:00" }, 2470 { "en", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" }, 2471 { "en", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-04:00", "-4:00" }, 2472 { "en", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-04:00", "-4:00" }, 2473 { "en", "America/Havana", "2004-07-15T00:00:00Z", "V", "GMT-04:00", "-4:00" }, 2474 { "en", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "Cuba Daylight Time", "-4:00" }, 2475 { "en", "America/Havana", "2004-07-15T00:00:00Z", "v", "Cuba Time", "America/Havana" }, 2476 { "en", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "Cuba Time", "America/Havana" }, 2477 { "en", "America/Havana", "2004-07-15T00:00:00Z", "VVVV", "Cuba Time", "America/Havana" }, 2478 2479 { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" }, 2480 { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" }, 2481 { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" }, 2482 { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "V", "GMT+11:00", "+11:00" }, 2483 { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "Australian Eastern Daylight Time", "+11:00" }, 2484 { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" }, 2485 { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" }, 2486 { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" }, 2487 { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "V", "GMT+10:00", "+10:00" }, 2488 { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "Australian Eastern Standard Time", "+10:00" }, 2489 { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "Sydney Time", "Australia/Sydney" }, 2490 { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "Eastern Australia Time", "Australia/Sydney" }, 2491 { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "VVVV", "Sydney Time", "Australia/Sydney" }, 2492 2493 { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" }, 2494 { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" }, 2495 { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" }, 2496 { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "V", "GMT+11:00", "+11:00" }, 2497 { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "Australian Eastern Daylight Time", "+11:00" }, 2498 { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" }, 2499 { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" }, 2500 { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" }, 2501 { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "V", "GMT+10:00", "+10:00" }, 2502 { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "Australian Eastern Standard Time", "+10:00" }, 2503 { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "Sydney Time", "Australia/Sydney" }, 2504 { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "Eastern Australia Time", "Australia/Sydney" }, 2505 { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "VVVV", "Sydney Time", "Australia/Sydney" }, 2506 2507 { "en", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" }, 2508 { "en", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT", "+0:00" }, 2509 { "en", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT", "+0:00" }, 2510 { "en", "Europe/London", "2004-01-15T00:00:00Z", "V", "GMT", "+0:00" }, 2511 { "en", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "Greenwich Mean Time", "+0:00" }, 2512 { "en", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" }, 2513 { "en", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+01:00", "+1:00" }, 2514 { "en", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+01:00", "Europe/London" }, 2515 { "en", "Europe/London", "2004-07-15T00:00:00Z", "V", "GMT+01:00", "Europe/London" }, 2516 { "en", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "British Summer Time", "Europe/London" }, 2517 // icu en.txt has exemplar city for this time zone 2518 { "en", "Europe/London", "2004-07-15T00:00:00Z", "v", "United Kingdom Time", "Europe/London" }, 2519 { "en", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "United Kingdom Time", "Europe/London" }, 2520 { "en", "Europe/London", "2004-07-15T00:00:00Z", "VVVV", "United Kingdom Time", "Europe/London" }, 2521 2522 { "en", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2523 { "en", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 2524 { "en", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 2525 { "en", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" }, 2526 { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2527 { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 2528 { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 2529 { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" }, 2530 { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-03:00", "-3:00" }, 2531 { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-03:00", "-3:00" }, 2532 2533 // JB#5150 2534 { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" }, 2535 { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" }, 2536 { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "GMT+05:30", "+5:30" }, 2537 { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "V", "GMT+05:30", "+5:30" }, 2538 { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "India Standard Time", "+5:30" }, 2539 { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" }, 2540 { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" }, 2541 { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "GMT+05:30", "+05:30" }, 2542 { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "V", "GMT+05:30", "+05:30" }, 2543 { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "India Standard Time", "+5:30" }, 2544 { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "India Time", "Asia/Calcutta" }, 2545 { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "India Standard Time", "Asia/Calcutta" }, 2546 2547 // ========== 2548 2549 { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" }, 2550 { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-08:00", "-8:00" }, 2551 // BEGIN android-change 2552 { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "PST", "-8:00" }, 2553 // END android-change 2554 { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "Nordamerikanische Westk\\u00fcsten-Normalzeit", "-8:00" }, 2555 { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" }, 2556 { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" }, 2557 // BEGIN android-change 2558 { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "PDT", "-7:00" }, 2559 // END android-change 2560 { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "Nordamerikanische Westk\\u00fcsten-Sommerzeit", "-7:00" }, 2561 // BEGIN android-change 2562 { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "PT", "America/Los_Angeles" }, 2563 // END android-change 2564 { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "Nordamerikanische Westk\\u00fcstenzeit", "America/Los_Angeles" }, 2565 2566 { "de", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2567 { "de", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 2568 { "de", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 2569 { "de", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "Argentinische Normalzeit", "-3:00" }, 2570 { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2571 { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 2572 { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 2573 { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "Argentinische Normalzeit", "-3:00" }, 2574 { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "Buenos Aires Zeit", "America/Buenos_Aires" }, 2575 { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "Argentinische Normalzeit", "America/Buenos_Aires" }, 2576 2577 { "de", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2578 { "de", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 2579 { "de", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 2580 { "de", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "Argentinische Normalzeit", "-3:00" }, 2581 { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2582 { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 2583 { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 2584 { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "Argentinische Normalzeit", "-3:00" }, 2585 { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "Buenos Aires Zeit", "America/Buenos_Aires" }, 2586 { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "Argentinische Normalzeit", "America/Buenos_Aires" }, 2587 2588 { "de", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" }, 2589 { "de", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-05:00", "-5:00" }, 2590 { "de", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-05:00", "-5:00" }, 2591 { "de", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "Kubanische Normalzeit", "-5:00" }, 2592 { "de", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" }, 2593 { "de", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-04:00", "-4:00" }, 2594 { "de", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-04:00", "-4:00" }, 2595 { "de", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "Kubanische Sommerzeit", "-4:00" }, 2596 { "de", "America/Havana", "2004-07-15T00:00:00Z", "v", "Kuba Zeit", "America/Havana" }, 2597 { "de", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "Kubanische Zeit", "America/Havana" }, 2598 // added to test proper fallback of country name 2599 { "de_CH", "America/Havana", "2004-07-15T00:00:00Z", "v", "Kuba Zeit", "America/Havana" }, 2600 { "de_CH", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "Kubanische Zeit", "America/Havana" }, 2601 2602 { "de", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" }, 2603 { "de", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" }, 2604 { "de", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" }, 2605 { "de", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "Ostaustralische Sommerzeit", "+11:00" }, 2606 { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" }, 2607 { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" }, 2608 { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" }, 2609 { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "Ostaustralische Normalzeit", "+10:00" }, 2610 { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "Sydney Zeit", "Australia/Sydney" }, 2611 { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "Ostaustralische Zeit", "Australia/Sydney" }, 2612 2613 { "de", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" }, 2614 { "de", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" }, 2615 { "de", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" }, 2616 { "de", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "Ostaustralische Sommerzeit", "+11:00" }, 2617 { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" }, 2618 { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" }, 2619 { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" }, 2620 { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "Ostaustralische Normalzeit", "+10:00" }, 2621 { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "Sydney Zeit", "Australia/Sydney" }, 2622 { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "Ostaustralische Zeit", "Australia/Sydney" }, 2623 2624 { "de", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" }, 2625 { "de", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT", "+0:00" }, 2626 { "de", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT", "+0:00" }, 2627 { "de", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "Mittlere Greenwich-Zeit", "+0:00" }, 2628 { "de", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" }, 2629 { "de", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+01:00", "+1:00" }, 2630 { "de", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+01:00", "+1:00" }, 2631 { "de", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "Britische Sommerzeit", "+1:00" }, 2632 { "de", "Europe/London", "2004-07-15T00:00:00Z", "v", "Vereinigtes K\\u00f6nigreich Zeit", "Europe/London" }, 2633 { "de", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "Vereinigtes K\\u00f6nigreich Zeit", "Europe/London" }, 2634 2635 { "de", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2636 { "de", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 2637 { "de", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 2638 { "de", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" }, 2639 { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2640 { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 2641 { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 2642 { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" }, 2643 { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-03:00", "-3:00" }, 2644 { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-03:00", "-3:00" }, 2645 2646 // JB#5150 2647 { "de", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" }, 2648 { "de", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" }, 2649 { "de", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "GMT+05:30", "+5:30" }, 2650 { "de", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "Indische Zeit", "+5:30" }, 2651 { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" }, 2652 { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" }, 2653 { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "GMT+05:30", "+05:30" }, 2654 { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "Indische Zeit", "+5:30" }, 2655 { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "Indien Zeit", "Asia/Calcutta" }, 2656 { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "Indische Zeit", "Asia/Calcutta" }, 2657 2658 // ========== 2659 2660 { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" }, 2661 // BEGIN android-change 2662 { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "PST", "-8:00" }, 2663 // END android-change 2664 { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-0800", "America/Los_Angeles" }, 2665 { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "\\u5317\\u7f8e\\u592a\\u5e73\\u6d0b\\u6807\\u51c6\\u65f6\\u95f4", "America/Los_Angeles" }, 2666 { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" }, 2667 // BEGIN android-change 2668 { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "PDT", "-7:00" }, 2669 // END android-change 2670 { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-0700", "America/Los_Angeles" }, 2671 // BEGIN android-change 2672 { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "PT", "America/Los_Angeles" }, 2673 // END android-change 2674 // icu zh.txt has exemplar city for this time zone 2675 { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\\u6D1B\\u6749\\u77F6\\u65F6\\u95F4", "America/Los_Angeles" }, 2676 { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\\u5317\\u7f8e\\u592a\\u5e73\\u6d0b\\u65f6\\u95f4", "America/Los_Angeles" }, 2677 2678 { "zh", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2679 { "zh", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-0300", "-3:00" }, 2680 { "zh", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-0300", "-3:00" }, 2681 { "zh", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "\\u963f\\u6839\\u5ef7\\u6807\\u51c6\\u65f6\\u95f4", "-3:00" }, 2682 { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2683 { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-0300", "-3:00" }, 2684 { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-0300", "-3:00" }, 2685 { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "\\u963f\\u6839\\u5ef7\\u6807\\u51c6\\u65f6\\u95f4", "-3:00" }, 2686 { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\\u5E03\\u5B9C\\u8BFA\\u65AF\\u827E\\u5229\\u65AF\\u65F6\\u95F4", "America/Buenos_Aires" }, 2687 { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\\u963f\\u6839\\u5ef7\\u6807\\u51c6\\u65f6\\u95f4", "America/Buenos_Aires" }, 2688 2689 { "zh", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2690 { "zh", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-0300", "-3:00" }, 2691 { "zh", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-0300", "-3:00" }, 2692 { "zh", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "\\u963f\\u6839\\u5ef7\\u6807\\u51c6\\u65f6\\u95f4", "-3:00" }, 2693 { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2694 { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-0300", "-3:00" }, 2695 { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-0300", "-3:00" }, 2696 { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "\\u963f\\u6839\\u5ef7\\u6807\\u51c6\\u65f6\\u95f4", "-3:00" }, 2697 { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\\u5E03\\u5B9C\\u8BFA\\u65AF\\u827E\\u5229\\u65AF\\u65F6\\u95F4", "America/Buenos_Aires" }, 2698 { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\\u963f\\u6839\\u5ef7\\u6807\\u51c6\\u65f6\\u95f4", "America/Buenos_Aires" }, 2699 2700 { "zh", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" }, 2701 { "zh", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-0500", "-5:00" }, 2702 { "zh", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-0500", "-5:00" }, 2703 { "zh", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "\\u53e4\\u5df4\\u6807\\u51c6\\u65f6\\u95f4", "-5:00" }, 2704 { "zh", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" }, 2705 { "zh", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-0400", "-4:00" }, 2706 { "zh", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-0400", "-4:00" }, 2707 { "zh", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "\\u53e4\\u5df4\\u590f\\u4ee4\\u65f6\\u95f4", "-4:00" }, 2708 { "zh", "America/Havana", "2004-07-15T00:00:00Z", "v", "\\u53e4\\u5df4\\u65f6\\u95f4", "America/Havana" }, 2709 { "zh", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "\\u53e4\\u5df4\\u65f6\\u95f4", "America/Havana" }, 2710 2711 { "zh", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" }, 2712 { "zh", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+1100", "+11:00" }, 2713 { "zh", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+1100", "+11:00" }, 2714 { "zh", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "\\u6fb3\\u5927\\u5229\\u4e9a\\u4e1c\\u90e8\\u590f\\u4ee4\\u65f6\\u95f4", "+11:00" }, 2715 { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" }, 2716 { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+1000", "+10:00" }, 2717 { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+1000", "+10:00" }, 2718 { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "\\u6fb3\\u5927\\u5229\\u4e9a\\u4e1c\\u90e8\\u6807\\u51c6\\u65f6\\u95f4", "+10:00" }, 2719 // icu zh.txt does not have info for this time zone 2720 { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "\\u6089\\u5C3C\\u65F6\\u95F4", "Australia/Sydney" }, 2721 { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "\\u6fb3\\u5927\\u5229\\u4e9a\\u4e1c\\u90e8\\u65f6\\u95f4", "Australia/Sydney" }, 2722 2723 { "zh", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" }, 2724 { "zh", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+1100", "+11:00" }, 2725 { "zh", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+1100", "+11:00" }, 2726 { "zh", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "\\u6fb3\\u5927\\u5229\\u4e9a\\u4e1c\\u90e8\\u590f\\u4ee4\\u65f6\\u95f4", "+11:00" }, 2727 { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" }, 2728 { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+1000", "+10:00" }, 2729 { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+1000", "+10:00" }, 2730 { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "\\u6fb3\\u5927\\u5229\\u4e9a\\u4e1c\\u90e8\\u6807\\u51c6\\u65f6\\u95f4", "+10:00" }, 2731 { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "\\u6089\\u5C3C\\u65F6\\u95F4", "Australia/Sydney" }, 2732 { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "\\u6fb3\\u5927\\u5229\\u4e9a\\u4e1c\\u90e8\\u65f6\\u95f4", "Australia/Sydney" }, 2733 2734 { "zh", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" }, 2735 { "zh", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT", "+0:00" }, 2736 { "zh", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT", "+0:00" }, 2737 { "zh", "Europe/London", "2004-01-15T00:00:00Z", "V", "GMT", "+0:00" }, 2738 { "zh", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT", "+0:00" }, 2739 { "zh", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT", "+0:00" }, 2740 { "zh", "Europe/London", "2004-01-15T00:00:00Z", "V", "GMT", "+0:00" }, 2741 { "zh", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "\\u683C\\u6797\\u5C3C\\u6CBB\\u6807\\u51C6\\u65F6\\u95F4", "+0:00" }, 2742 { "zh", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" }, 2743 { "zh", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+0100", "+1:00" }, 2744 { "zh", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+0100", "+1:00" }, 2745 { "zh", "Europe/London", "2004-07-15T00:00:00Z", "V", "GMT+0100", "+1:00" }, 2746 { "zh", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "\\u82f1\\u56fd\\u590f\\u4ee4\\u65f6\\u95f4", "+1:00" }, 2747 { "zh", "Europe/London", "2004-07-15T00:00:00Z", "v", "\\u82f1\\u56fd\\u65f6\\u95f4", "Europe/London" }, 2748 { "zh", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "\\u82f1\\u56fd\\u65f6\\u95f4", "Europe/London" }, 2749 { "zh", "Europe/London", "2004-07-15T00:00:00Z", "VVVV", "\\u82f1\\u56fd\\u65f6\\u95f4", "Europe/London" }, 2750 2751 { "zh", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2752 { "zh", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-0300", "-3:00" }, 2753 { "zh", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-0300", "-3:00" }, 2754 { "zh", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-0300", "-3:00" }, 2755 { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2756 { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-0300", "-3:00" }, 2757 { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-0300", "-3:00" }, 2758 { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-0300", "-3:00" }, 2759 { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-0300", "-3:00" }, 2760 { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-0300", "-3:00" }, 2761 2762 // JB#5150 2763 { "zh", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" }, 2764 { "zh", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+0530", "+5:30" }, 2765 { "zh", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "GMT+0530", "+5:30" }, 2766 { "zh", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "\\u5370\\u5ea6\\u65f6\\u95f4", "+5:30" }, 2767 { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" }, 2768 { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+0530", "+5:30" }, 2769 { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "GMT+0530", "+05:30" }, 2770 { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "\\u5370\\u5ea6\\u65f6\\u95f4", "+5:30" }, 2771 { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "\\u5370\\u5ea6\\u65f6\\u95f4", "Asia/Calcutta" }, 2772 { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "\\u5370\\u5ea6\\u65f6\\u95f4", "Asia/Calcutta" }, 2773 2774 // ========== 2775 2776 { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" }, 2777 { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-08:00", "-8:00" }, 2778 { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-08:00", "-8:00" }, 2779 { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "\\u092a\\u094d\\u0930\\u0936\\u093e\\u0902\\u0924\\u0020\\u092e\\u093e\\u0928\\u0915\\u0020\\u0938\\u092e\\u092f", "-8:00" }, 2780 { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" }, 2781 { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" }, 2782 { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-07:00", "-7:00" }, 2783 { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "\\u092A\\u094D\\u0930\\u0936\\u093E\\u0902\\u0924 \\u0926\\u093F\\u0935\\u093E\\u0935\\u0932\\u094B\\u0915 \\u0938\\u092E\\u092F", "-7:00" }, 2784 { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\\u0932\\u094B\\u0938 \\u090F\\u0902\\u091C\\u093F\\u0932\\u0947\\u0938 \\u0938\\u092E\\u092F", "America/Los_Angeles" }, 2785 { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\\u092A\\u094D\\u0930\\u0936\\u093E\\u0902\\u0924 \\u0938\\u092E\\u092F", "America/Los_Angeles" }, 2786 2787 { "hi", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2788 { "hi", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 2789 { "hi", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 2790 { "hi", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "\\u0905\\u0930\\u094D\\u091C\\u0947\\u0902\\u091F\\u0940\\u0928\\u093E \\u092E\\u093E\\u0928\\u0915 \\u0938\\u092E\\u092F", "-3:00" }, 2791 { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2792 { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 2793 { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 2794 { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "\\u0905\\u0930\\u094D\\u091C\\u0947\\u0902\\u091F\\u0940\\u0928\\u093E \\u092E\\u093E\\u0928\\u0915 \\u0938\\u092E\\u092F", "-3:00" }, 2795 { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\\u092C\\u094D\\u092F\\u0942\\u0928\\u0938 \\u0906\\u092F\\u0930\\u0938 \\u0938\\u092E\\u092F", "America/Buenos_Aires" }, 2796 { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\\u0905\\u0930\\u094D\\u091C\\u0947\\u0902\\u091F\\u0940\\u0928\\u093E \\u092E\\u093E\\u0928\\u0915 \\u0938\\u092E\\u092F", "America/Buenos_Aires" }, 2797 2798 { "hi", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2799 { "hi", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 2800 { "hi", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 2801 { "hi", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "\\u0905\\u0930\\u094D\\u091C\\u0947\\u0902\\u091F\\u0940\\u0928\\u093E \\u092E\\u093E\\u0928\\u0915 \\u0938\\u092E\\u092F", "-3:00" }, 2802 { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2803 { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 2804 { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 2805 { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "\\u0905\\u0930\\u094D\\u091C\\u0947\\u0902\\u091F\\u0940\\u0928\\u093E \\u092E\\u093E\\u0928\\u0915 \\u0938\\u092E\\u092F", "-3:00" }, 2806 { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\\u092C\\u094D\\u092F\\u0942\\u0928\\u0938 \\u0906\\u092F\\u0930\\u0938 \\u0938\\u092E\\u092F", "America/Buenos_Aires" }, 2807 { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\\u0905\\u0930\\u094D\\u091C\\u0947\\u0902\\u091F\\u0940\\u0928\\u093E \\u092E\\u093E\\u0928\\u0915 \\u0938\\u092E\\u092F", "America/Buenos_Aires" }, 2808 2809 { "hi", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" }, 2810 { "hi", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-05:00", "-5:00" }, 2811 { "hi", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-05:00", "-5:00" }, 2812 { "hi", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "\\u0915\\u094d\\u092f\\u0942\\u092c\\u093e \\u0915\\u093e \\u092e\\u093e\\u0928\\u0915 \\u0938\\u092e\\u092f", "-5:00" }, 2813 { "hi", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" }, 2814 { "hi", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-04:00", "-4:00" }, 2815 { "hi", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-04:00", "-4:00" }, 2816 { "hi", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "\\u0915\\u094d\\u092f\\u0942\\u092c\\u093e \\u0915\\u093e \\u0921\\u0947\\u0932\\u093e\\u0907\\u091f \\u091f\\u093e\\u0907\\u092e", "-4:00" }, 2817 { "hi", "America/Havana", "2004-07-15T00:00:00Z", "v", "\\u0915\\u094d\\u092f\\u0942\\u092c\\u093e \\u0938\\u092E\\u092F", "America/Havana" }, 2818 { "hi", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "\\u0915\\u094d\\u092f\\u0942\\u092c\\u093e \\u0915\\u093e \\u0938\\u092E\\u092F", "America/Havana" }, 2819 2820 { "hi", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" }, 2821 { "hi", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" }, 2822 { "hi", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" }, 2823 { "hi", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "\\u0911\\u0938\\u094D\\u200D\\u091F\\u094D\\u0930\\u0947\\u0932\\u093F\\u092F\\u093E\\u0908 \\u092A\\u0942\\u0930\\u094D\\u0935\\u0940 \\u0926\\u093F\\u0935\\u093E\\u0935\\u0932\\u094B\\u0915 \\u0938\\u092E\\u092F", "+11:00" }, 2824 { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" }, 2825 { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" }, 2826 { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" }, 2827 { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "\\u0911\\u0938\\u094D\\u200D\\u091F\\u094D\\u0930\\u0947\\u0932\\u093F\\u092F\\u093E\\u0908 \\u092A\\u0942\\u0930\\u094D\\u0935\\u0940 \\u092E\\u093E\\u0928\\u0915 \\u0938\\u092E\\u092F", "+10:00" }, 2828 { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "\\u0938\\u093F\\u0921\\u0928\\u0940 \\u0938\\u092E\\u092F", "Australia/Sydney" }, 2829 { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "\\u092A\\u0942\\u0930\\u094D\\u0935\\u0940 \\u0911\\u0938\\u094D\\u091F\\u094D\\u0930\\u0947\\u0932\\u093F\\u092F\\u093E\\u0908 \\u0938\\u092E\\u092F", "Australia/Sydney" }, 2830 2831 { "hi", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" }, 2832 { "hi", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" }, 2833 { "hi", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" }, 2834 { "hi", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "\\u0911\\u0938\\u094D\\u200D\\u091F\\u094D\\u0930\\u0947\\u0932\\u093F\\u092F\\u093E\\u0908 \\u092A\\u0942\\u0930\\u094D\\u0935\\u0940 \\u0926\\u093F\\u0935\\u093E\\u0935\\u0932\\u094B\\u0915 \\u0938\\u092E\\u092F", "+11:00" }, 2835 { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" }, 2836 { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" }, 2837 { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" }, 2838 { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "\\u0911\\u0938\\u094D\\u200D\\u091F\\u094D\\u0930\\u0947\\u0932\\u093F\\u092F\\u093E\\u0908 \\u092A\\u0942\\u0930\\u094D\\u0935\\u0940 \\u092E\\u093E\\u0928\\u0915 \\u0938\\u092E\\u092F", "+10:00" }, 2839 { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "\\u0938\\u093F\\u0921\\u0928\\u0940 \\u0938\\u092E\\u092F", "Australia/Sydney" }, 2840 { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "\\u092A\\u0942\\u0930\\u094D\\u0935\\u0940 \\u0911\\u0938\\u094D\\u091F\\u094D\\u0930\\u0947\\u0932\\u093F\\u092F\\u093E\\u0908 \\u0938\\u092E\\u092F", "Australia/Sydney" }, 2841 2842 { "hi", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" }, 2843 { "hi", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT", "+0:00" }, 2844 { "hi", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT", "+0:00" }, 2845 { "hi", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "\\u0917\\u094d\\u0930\\u0940\\u0928\\u0935\\u093f\\u091a \\u092e\\u0940\\u0928 \\u091f\\u093e\\u0907\\u092e", "+0:00" }, 2846 { "hi", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" }, 2847 { "hi", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+01:00", "+1:00" }, 2848 { "hi", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+01:00", "+1:00" }, 2849 { "hi", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "GMT+01:00", "+1:00" }, 2850 { "hi", "Europe/London", "2004-07-15T00:00:00Z", "v", "\\u092C\\u094D\\u0930\\u093F\\u0924\\u0928 \\u0938\\u092E\\u092F", "Europe/London" }, 2851 { "hi", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "\\u092C\\u094D\\u0930\\u093F\\u0924\\u0928 \\u0938\\u092E\\u092F", "Europe/London" }, 2852 2853 { "hi", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2854 { "hi", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 2855 { "hi", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 2856 { "hi", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" }, 2857 { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2858 { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 2859 { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 2860 { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" }, 2861 { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-03:00", "-3:00" }, 2862 { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-03:00", "-3:00" }, 2863 2864 { "hi", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" }, 2865 { "hi", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" }, 2866 { "hi", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "IST", "+5:30" }, 2867 { "hi", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "\\u092D\\u093E\\u0930\\u0924\\u0940\\u092F \\u0938\\u092E\\u092F", "+5:30" }, 2868 { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" }, 2869 { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" }, 2870 { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "IST", "+05:30" }, 2871 { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "\\u092D\\u093E\\u0930\\u0924\\u0940\\u092F \\u0938\\u092E\\u092F", "+5:30" }, 2872 { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "IST", "Asia/Calcutta" }, 2873 { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "\\u092D\\u093E\\u0930\\u0924\\u0940\\u092F \\u0938\\u092E\\u092F", "Asia/Calcutta" }, 2874 2875 // ========== 2876 2877 { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" }, 2878 { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0800", "-8:00" }, 2879 // BEGIN android-change 2880 { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "PST", "America/Los_Angeles" }, 2881 { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "V", "PST", "America/Los_Angeles" }, 2882 // END android-change 2883 { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "\\u0422\\u0438\\u0445\\u043E\\u043E\\u043A\\u0435\\u0430\\u043D\\u0441\\u043A\\u0430 \\u0447\\u0430\\u0441\\u043E\\u0432\\u0430 \\u0437\\u043E\\u043D\\u0430", "America/Los_Angeles" }, 2884 { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" }, 2885 { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0700", "-7:00" }, 2886 // BEGIN android-change 2887 { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "PDT", "America/Los_Angeles" }, 2888 { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "V", "PDT", "America/Los_Angeles" }, 2889 // END android-change 2890 { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "\\u0422\\u0438\\u0445\\u043E\\u043E\\u043A\\u0435\\u0430\\u043D\\u0441\\u043A\\u0430 \\u043B\\u044F\\u0442\\u043D\\u0430 \\u0447\\u0430\\u0441\\u043E\\u0432\\u0430 \\u0437\\u043E\\u043D\\u0430", "America/Los_Angeles" }, 2891 // icu bg.txt has exemplar city for this time zone 2892 { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\\u041B\\u043E\\u0441 \\u0410\\u043D\\u0436\\u0435\\u043B\\u0438\\u0441 \\u0432\\u0440\\u0435\\u043C\\u0435", "America/Los_Angeles" }, 2893 { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\\u0422\\u0438\\u0445\\u043E\\u043E\\u043A\\u0435\\u0430\\u043D\\u0441\\u043A\\u043E \\u0432\\u0440\\u0435\\u043C\\u0435", "America/Los_Angeles" }, 2894 { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "VVVV", "\\u041B\\u043E\\u0441 \\u0410\\u043D\\u0436\\u0435\\u043B\\u0438\\u0441 \\u0432\\u0440\\u0435\\u043C\\u0435", "America/Los_Angeles" }, 2895 2896 { "bg", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2897 { "bg", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" }, 2898 { "bg", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" }, 2899 { "bg", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "\\u0410\\u0440\\u0436\\u0435\\u043D\\u0442\\u0438\\u043D\\u0430 \\u2013 \\u0441\\u0442\\u0430\\u043d\\u0434\\u0430\\u0440\\u0442\\u043d\\u043e \\u0432\\u0440\\u0435\\u043c\\u0435", "-3:00" }, 2900 { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2901 { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" }, 2902 { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" }, 2903 { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "\\u0410\\u0440\\u0436\\u0435\\u043D\\u0442\\u0438\\u043D\\u0430 \\u2013 \\u0441\\u0442\\u0430\\u043d\\u0434\\u0430\\u0440\\u0442\\u043d\\u043e \\u0432\\u0440\\u0435\\u043c\\u0435", "-3:00" }, 2904 { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\\u0411\\u0443\\u0435\\u043D\\u043E\\u0441 \\u0410\\u0439\\u0440\\u0435\\u0441 \\u0432\\u0440\\u0435\\u043C\\u0435", "America/Buenos_Aires" }, 2905 { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\\u0410\\u0440\\u0436\\u0435\\u043D\\u0442\\u0438\\u043D\\u0430 \\u2013 \\u0441\\u0442\\u0430\\u043d\\u0434\\u0430\\u0440\\u0442\\u043d\\u043e \\u0432\\u0440\\u0435\\u043c\\u0435", "America/Buenos_Aires" }, 2906 2907 { "bg", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2908 { "bg", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" }, 2909 { "bg", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" }, 2910 { "bg", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "\\u0410\\u0440\\u0436\\u0435\\u043D\\u0442\\u0438\\u043D\\u0430 \\u2013 \\u0441\\u0442\\u0430\\u043d\\u0434\\u0430\\u0440\\u0442\\u043d\\u043e \\u0432\\u0440\\u0435\\u043c\\u0435", "-3:00" }, 2911 { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2912 { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" }, 2913 { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" }, 2914 { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "\\u0410\\u0440\\u0436\\u0435\\u043D\\u0442\\u0438\\u043D\\u0430 \\u2013 \\u0441\\u0442\\u0430\\u043d\\u0434\\u0430\\u0440\\u0442\\u043d\\u043e \\u0432\\u0440\\u0435\\u043c\\u0435", "-3:00" }, 2915 // icu bg.txt does not have info for this time zone 2916 { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\\u0411\\u0443\\u0435\\u043D\\u043E\\u0441 \\u0410\\u0439\\u0440\\u0435\\u0441 \\u0432\\u0440\\u0435\\u043C\\u0435", "America/Buenos_Aires" }, 2917 { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\\u0410\\u0440\\u0436\\u0435\\u043D\\u0442\\u0438\\u043D\\u0430 \\u2013 \\u0441\\u0442\\u0430\\u043d\\u0434\\u0430\\u0440\\u0442\\u043d\\u043e \\u0432\\u0440\\u0435\\u043c\\u0435", "America/Buenos_Aires" }, 2918 2919 { "bg", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" }, 2920 { "bg", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0500", "-5:00" }, 2921 { "bg", "America/Havana", "2004-01-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0500", "-5:00" }, 2922 { "bg", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "\\u041a\\u0443\\u0431\\u0438\\u043d\\u0441\\u043a\\u043e \\u0441\\u0442\\u0430\\u043d\\u0434\\u0430\\u0440\\u0442\\u043d\\u043e \\u0432\\u0440\\u0435\\u043c\\u0435", "-5:00" }, 2923 { "bg", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" }, 2924 { "bg", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0400", "-4:00" }, 2925 { "bg", "America/Havana", "2004-07-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0400", "-4:00" }, 2926 { "bg", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "\\u041a\\u0443\\u0431\\u0438\\u043d\\u0441\\u043a\\u043e \\u043b\\u044f\\u0442\\u043d\\u043e \\u0447\\u0430\\u0441\\u043e\\u0432\\u043e \\u0432\\u0440\\u0435\\u043c\\u0435", "-4:00" }, 2927 { "bg", "America/Havana", "2004-07-15T00:00:00Z", "v", "\\u041a\\u0443\\u0431\\u0430 \\u0432\\u0440\\u0435\\u043C\\u0435", "America/Havana" }, 2928 { "bg", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "\\u041a\\u0443\\u0431\\u0438\\u043d\\u0441\\u043a\\u043e \\u0432\\u0440\\u0435\\u043C\\u0435", "America/Havana" }, 2929 2930 { "bg", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" }, 2931 { "bg", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+1100", "+11:00" }, 2932 { "bg", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+1100", "+11:00" }, 2933 { "bg", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "\\u0410\\u0432\\u0441\\u0442\\u0440\\u0430\\u043B\\u0438\\u044F \\u2013 \\u0438\\u0437\\u0442\\u043E\\u0447\\u043D\\u043E \\u043B\\u044F\\u0442\\u043D\\u043E \\u0447\\u0430\\u0441\\u043E\\u0432\\u043E \\u0432\\u0440\\u0435\\u043C\\u0435", "+11:00" }, 2934 { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" }, 2935 { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+1000", "+10:00" }, 2936 { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+1000", "+10:00" }, 2937 { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "\\u0410\\u0432\\u0441\\u0442\\u0440\\u0430\\u043B\\u0438\\u044F \\u2013 \\u0438\\u0437\\u0442\\u043E\\u0447\\u043D\\u043E \\u0441\\u0442\\u0430\\u043D\\u0434\\u0430\\u0440\\u0442\\u043D\\u043E \\u0432\\u0440\\u0435\\u043C\\u0435", "+10:00" }, 2938 { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "\\u0421\\u0438\\u0434\\u043D\\u0438 \\u0432\\u0440\\u0435\\u043C\\u0435", "Australia/Sydney" }, 2939 { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "\\u0410\\u0432\\u0441\\u0442\\u0440\\u0430\\u043B\\u0438\\u044F \\u2013 \\u0438\\u0437\\u0442\\u043E\\u0447\\u043D\\u043E \\u0432\\u0440\\u0435\\u043C\\u0435", "Australia/Sydney" }, 2940 2941 { "bg", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" }, 2942 { "bg", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+1100", "+11:00" }, 2943 { "bg", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+1100", "+11:00" }, 2944 { "bg", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "\\u0410\\u0432\\u0441\\u0442\\u0440\\u0430\\u043B\\u0438\\u044F \\u2013 \\u0438\\u0437\\u0442\\u043E\\u0447\\u043D\\u043E \\u043B\\u044F\\u0442\\u043D\\u043E \\u0447\\u0430\\u0441\\u043E\\u0432\\u043E \\u0432\\u0440\\u0435\\u043C\\u0435", "+11:00" }, 2945 { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" }, 2946 { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+1000", "+10:00" }, 2947 { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+1000", "+10:00" }, 2948 { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "\\u0410\\u0432\\u0441\\u0442\\u0440\\u0430\\u043B\\u0438\\u044F \\u2013 \\u0438\\u0437\\u0442\\u043E\\u0447\\u043D\\u043E \\u0441\\u0442\\u0430\\u043D\\u0434\\u0430\\u0440\\u0442\\u043D\\u043E \\u0432\\u0440\\u0435\\u043C\\u0435", "+10:00" }, 2949 { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "\\u0421\\u0438\\u0434\\u043D\\u0438 \\u0432\\u0440\\u0435\\u043C\\u0435", "Australia/Sydney" }, 2950 { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "\\u0410\\u0432\\u0441\\u0442\\u0440\\u0430\\u043B\\u0438\\u044F \\u2013 \\u0438\\u0437\\u0442\\u043E\\u0447\\u043D\\u043E \\u0432\\u0440\\u0435\\u043C\\u0435", "Australia/Sydney" }, 2951 2952 { "bg", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" }, 2953 { "bg", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447", "+0:00" }, 2954 // BEGIN android-change 2955 { "bg", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT", "+0:00" }, 2956 // END android-change 2957 { "bg", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "\\u0427\\u0430\\u0441\\u043E\\u0432\\u0430 \\u0437\\u043E\\u043D\\u0430 \\u0413\\u0440\\u0438\\u043D\\u0443\\u0438\\u0447", "+0:00" }, 2958 { "bg", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" }, 2959 { "bg", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+0100", "+1:00" }, 2960 { "bg", "Europe/London", "2004-07-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+0100", "+1:00" }, 2961 { "bg", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+0100", "+1:00" }, 2962 { "bg", "Europe/London", "2004-07-15T00:00:00Z", "v", "\\u041e\\u0431\\u0435\\u0434\\u0438\\u043d\\u0435\\u043d\\u043e \\u043a\\u0440\\u0430\\u043b\\u0441\\u0442\\u0432\\u043e \\u0432\\u0440\\u0435\\u043C\\u0435", "Europe/London" }, 2963 { "bg", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "\\u041e\\u0431\\u0435\\u0434\\u0438\\u043d\\u0435\\u043d\\u043e \\u043a\\u0440\\u0430\\u043b\\u0441\\u0442\\u0432\\u043e \\u0432\\u0440\\u0435\\u043C\\u0435", "Europe/London" }, 2964 2965 { "bg", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2966 { "bg", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" }, 2967 { "bg", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" }, 2968 { "bg", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" }, 2969 { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" }, 2970 { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" }, 2971 { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" }, 2972 { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" }, 2973 { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" }, 2974 { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447-0300", "-3:00" }, 2975 2976 // JB#5150 2977 { "bg", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" }, 2978 { "bg", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+0530", "+5:30" }, 2979 { "bg", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+0530", "+5:30" }, 2980 { "bg", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "\\u0418\\u043d\\u0434\\u0438\\u0439\\u0441\\u043a\\u043e \\u0441\\u0442\\u0430\\u043d\\u0434\\u0430\\u0440\\u0442\\u043d\\u043e \\u0432\\u0440\\u0435\\u043c\\u0435", "+5:30" }, 2981 { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" }, 2982 { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+0530", "+5:30" }, 2983 { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "\\u0413\\u0440\\u0438\\u0438\\u043D\\u0443\\u0438\\u0447+0530", "+05:30" }, 2984 { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "\\u0418\\u043d\\u0434\\u0438\\u0439\\u0441\\u043a\\u043e \\u0441\\u0442\\u0430\\u043d\\u0434\\u0430\\u0440\\u0442\\u043d\\u043e \\u0432\\u0440\\u0435\\u043c\\u0435", "+5:30" }, 2985 { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "\\u0418\\u043D\\u0434\\u0438\\u044F \\u0432\\u0440\\u0435\\u043C\\u0435", "Asia/Calcutta" }, 2986 { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "\\u0418\\u043d\\u0434\\u0438\\u0439\\u0441\\u043a\\u043e \\u0441\\u0442\\u0430\\u043d\\u0434\\u0430\\u0440\\u0442\\u043d\\u043e \\u0432\\u0440\\u0435\\u043c\\u0435", "Asia/Calcutta" }, 2987 // ========== 2988 2989 { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" }, 2990 { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-08:00", "-8:00" }, 2991 { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-08:00", "America/Los_Angeles" }, 2992 { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "V", "GMT-08:00", "America/Los_Angeles" }, 2993 { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "\\u30a2\\u30e1\\u30ea\\u30ab\\u592a\\u5e73\\u6d0b\\u6a19\\u6e96\\u6642", "America/Los_Angeles" }, 2994 { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-700" }, 2995 { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" }, 2996 { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-07:00", "America/Los_Angeles" }, 2997 { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "V", "GMT-07:00", "America/Los_Angeles" }, 2998 { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "\\u30a2\\u30e1\\u30ea\\u30ab\\u592a\\u5e73\\u6d0b\\u590f\\u6642\\u9593", "America/Los_Angeles" }, 2999 // icu ja.txt has exemplar city for this time zone 3000 { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\\u30ED\\u30B5\\u30F3\\u30BC\\u30EB\\u30B9\\u6642\\u9593", "America/Los_Angeles" }, 3001 { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\\u30A2\\u30E1\\u30EA\\u30AB\\u592A\\u5e73\\u6D0B\\u6642\\u9593", "America/Los_Angeles" }, 3002 { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "VVVV", "\\u30ED\\u30B5\\u30F3\\u30BC\\u30EB\\u30B9\\u6642\\u9593", "America/Los_Angeles" }, 3003 3004 { "ja", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, 3005 { "ja", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 3006 { "ja", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 3007 { "ja", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "\\u30A2\\u30EB\\u30BC\\u30F3\\u30C1\\u30F3\\u6A19\\u6E96\\u6642", "-3:00" }, 3008 { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" }, 3009 { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 3010 { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 3011 { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "\\u30A2\\u30EB\\u30BC\\u30F3\\u30C1\\u30F3\\u6A19\\u6E96\\u6642", "-3:00" }, 3012 // icu ja.txt does not have info for this time zone 3013 { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\\u30D6\\u30A8\\u30CE\\u30B9\\u30A2\\u30A4\\u30EC\\u30B9\\u6642\\u9593", "America/Buenos_Aires" }, 3014 { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\\u30A2\\u30EB\\u30BC\\u30F3\\u30C1\\u30F3\\u6A19\\u6E96\\u6642", "America/Buenos_Aires" }, 3015 3016 { "ja", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, 3017 { "ja", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 3018 { "ja", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 3019 { "ja", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "\\u30A2\\u30EB\\u30BC\\u30F3\\u30C1\\u30F3\\u6A19\\u6E96\\u6642", "-3:00" }, 3020 { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" }, 3021 { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 3022 { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 3023 { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "\\u30A2\\u30EB\\u30BC\\u30F3\\u30C1\\u30F3\\u6A19\\u6E96\\u6642", "-3:00" }, 3024 { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\\u30D6\\u30A8\\u30CE\\u30B9\\u30A2\\u30A4\\u30EC\\u30B9\\u6642\\u9593", "America/Buenos_Aires" }, 3025 { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\\u30A2\\u30EB\\u30BC\\u30F3\\u30C1\\u30F3\\u6A19\\u6E96\\u6642", "America/Buenos_Aires" }, 3026 3027 { "ja", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" }, 3028 { "ja", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-05:00", "-5:00" }, 3029 { "ja", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-05:00", "-5:00" }, 3030 { "ja", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "\\u30AD\\u30E5\\u30FC\\u30D0\\u6A19\\u6E96\\u6642", "-5:00" }, 3031 { "ja", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" }, 3032 { "ja", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-04:00", "-4:00" }, 3033 { "ja", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-04:00", "-4:00" }, 3034 { "ja", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "\\u30AD\\u30E5\\u30FC\\u30D0\\u590F\\u6642\\u9593", "-4:00" }, 3035 { "ja", "America/Havana", "2004-07-15T00:00:00Z", "v", "\\u30ad\\u30e5\\u30fc\\u30d0\\u6642\\u9593", "America/Havana" }, 3036 { "ja", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "\\u30ad\\u30e5\\u30fc\\u30d0\\u6642\\u9593", "America/Havana" }, 3037 3038 { "ja", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" }, 3039 { "ja", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" }, 3040 { "ja", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" }, 3041 { "ja", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "\\u30AA\\u30FC\\u30B9\\u30C8\\u30E9\\u30EA\\u30A2\\u6771\\u90E8\\u590F\\u6642\\u9593", "+11:00" }, 3042 { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" }, 3043 { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" }, 3044 { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" }, 3045 { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "\\u30AA\\u30FC\\u30B9\\u30C8\\u30E9\\u30EA\\u30A2\\u6771\\u90E8\\u6A19\\u6E96\\u6642", "+10:00" }, 3046 // icu ja.txt does not have info for this time zone 3047 { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "\\u30B7\\u30C9\\u30CB\\u30FC\\u6642\\u9593", "Australia/Sydney" }, 3048 { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "\\u30AA\\u30FC\\u30B9\\u30C8\\u30E9\\u30EA\\u30A2\\u6771\\u90E8\\u6642\\u9593", "Australia/Sydney" }, 3049 3050 { "ja", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" }, 3051 { "ja", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" }, 3052 { "ja", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" }, 3053 { "ja", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "\\u30AA\\u30FC\\u30B9\\u30C8\\u30E9\\u30EA\\u30A2\\u6771\\u90E8\\u590F\\u6642\\u9593", "+11:00" }, 3054 { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" }, 3055 { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" }, 3056 { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" }, 3057 { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "\\u30AA\\u30FC\\u30B9\\u30C8\\u30E9\\u30EA\\u30A2\\u6771\\u90E8\\u6A19\\u6E96\\u6642", "+10:00" }, 3058 { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "\\u30B7\\u30C9\\u30CB\\u30FC\\u6642\\u9593", "Australia/Sydney" }, 3059 { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "\\u30AA\\u30FC\\u30B9\\u30C8\\u30E9\\u30EA\\u30A2\\u6771\\u90E8\\u6642\\u9593", "Australia/Sydney" }, 3060 3061 { "ja", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" }, 3062 { "ja", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT", "+0:00" }, 3063 { "ja", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT", "+0:00" }, 3064 { "ja", "Europe/London", "2004-01-15T00:00:00Z", "V", "GMT", "+0:00" }, 3065 { "ja", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "\\u30B0\\u30EA\\u30CB\\u30C3\\u30B8\\u6A19\\u6E96\\u6642", "+0:00" }, 3066 { "ja", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" }, 3067 { "ja", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+01:00", "+1:00" }, 3068 { "ja", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+01:00", "+1:00" }, 3069 { "ja", "Europe/London", "2004-07-15T00:00:00Z", "V", "GMT+01:00", "+1:00" }, 3070 { "ja", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "\\u82f1\\u56fd\\u590f\\u6642\\u9593", "+1:00" }, 3071 { "ja", "Europe/London", "2004-07-15T00:00:00Z", "v", "\\u30a4\\u30ae\\u30ea\\u30b9\\u6642\\u9593", "Europe/London" }, 3072 { "ja", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "\\u30a4\\u30ae\\u30ea\\u30b9\\u6642\\u9593", "Europe/London" }, 3073 { "ja", "Europe/London", "2004-07-15T00:00:00Z", "VVVV", "\\u30a4\\u30ae\\u30ea\\u30b9\\u6642\\u9593", "Europe/London" }, 3074 3075 { "ja", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, 3076 { "ja", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 3077 { "ja", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 3078 { "ja", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" }, 3079 { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" }, 3080 { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 3081 { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 3082 { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" }, 3083 { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-03:00", "-3:00" }, 3084 { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-03:00", "-3:00" }, 3085 3086 // JB#5150 3087 { "ja", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" }, 3088 { "ja", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" }, 3089 { "ja", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "GMT+05:30", "+5:30" }, 3090 { "ja", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "\\u30A4\\u30F3\\u30C9\\u6642\\u9593", "+5:30" }, 3091 { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" }, 3092 { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" }, 3093 { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "GMT+05:30", "+05:30" }, 3094 { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "\\u30A4\\u30F3\\u30C9\\u6642\\u9593", "+5:30" }, 3095 { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "\\u30A4\\u30F3\\u30C9\\u6642\\u9593", "Asia/Calcutta" }, 3096 { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "\\u30A4\\u30F3\\u30C9\\u6642\\u9593", "Asia/Calcutta" }, 3097 3098 // ========== 3099 3100 { "ti", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" }, 3101 { "ti", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-08:00", "-8:00" }, 3102 { "ti", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-08:00", "-8:00" }, 3103 { "ti", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "GMT-08:00", "-8:00" }, 3104 { "ti", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" }, 3105 { "ti", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" }, 3106 { "ti", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-07:00", "-7:00" }, 3107 { "ti", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "GMT-07:00", "-7:00" }, 3108 { "ti", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "Los Angeles", "America/Los_Angeles" }, 3109 { "ti", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "Los Angeles", "America/Los_Angeles" }, 3110 3111 { "ti", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, 3112 { "ti", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 3113 { "ti", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 3114 { "ti", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" }, 3115 { "ti", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" }, 3116 { "ti", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 3117 { "ti", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 3118 { "ti", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" }, 3119 { "ti", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "Buenos Aires", "America/Buenos_Aires" }, 3120 { "ti", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "Buenos Aires", "America/Buenos_Aires" }, 3121 3122 { "ti", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, 3123 { "ti", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 3124 { "ti", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 3125 { "ti", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" }, 3126 { "ti", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" }, 3127 { "ti", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 3128 { "ti", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 3129 { "ti", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" }, 3130 { "ti", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "Buenos Aires", "America/Buenos_Aires" }, 3131 { "ti", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "Buenos Aires", "America/Buenos_Aires" }, 3132 3133 { "ti", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" }, 3134 { "ti", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-05:00", "-5:00" }, 3135 { "ti", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-05:00", "-5:00" }, 3136 { "ti", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "GMT-05:00", "-5:00" }, 3137 { "ti", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" }, 3138 { "ti", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-04:00", "-4:00" }, 3139 { "ti", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-04:00", "-4:00" }, 3140 { "ti", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "GMT-04:00", "-4:00" }, 3141 { "ti", "America/Havana", "2004-07-15T00:00:00Z", "v", "CU", "America/Havana" }, 3142 { "ti", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "CU", "America/Havana" }, 3143 3144 { "ti", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" }, 3145 { "ti", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" }, 3146 { "ti", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" }, 3147 { "ti", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "GMT+11:00", "+11:00" }, 3148 { "ti", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" }, 3149 { "ti", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" }, 3150 { "ti", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" }, 3151 { "ti", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "GMT+10:00", "+10:00" }, 3152 { "ti", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "Sydney", "Australia/Sydney" }, 3153 { "ti", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "Sydney", "Australia/Sydney" }, 3154 3155 { "ti", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" }, 3156 { "ti", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" }, 3157 { "ti", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" }, 3158 { "ti", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "GMT+11:00", "+11:00" }, 3159 { "ti", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" }, 3160 { "ti", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" }, 3161 { "ti", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" }, 3162 { "ti", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "GMT+10:00", "+10:00" }, 3163 { "ti", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "Sydney", "Australia/Sydney" }, 3164 { "ti", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "Sydney", "Australia/Sydney" }, 3165 3166 { "ti", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" }, 3167 { "ti", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT", "+0:00" }, 3168 { "ti", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT", "+0:00" }, 3169 { "ti", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "GMT", "+0:00" }, 3170 { "ti", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" }, 3171 { "ti", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+01:00", "+1:00" }, 3172 { "ti", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+01:00", "+1:00" }, 3173 { "ti", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "GMT+01:00", "+1:00" }, 3174 { "ti", "Europe/London", "2004-07-15T00:00:00Z", "v", "GB", "Europe/London" }, 3175 { "ti", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "GB", "Europe/London" }, 3176 3177 { "ti", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" }, 3178 { "ti", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 3179 { "ti", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 3180 { "ti", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" }, 3181 { "ti", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" }, 3182 { "ti", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" }, 3183 { "ti", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" }, 3184 { "ti", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" }, 3185 { "ti", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-03:00", "-3:00" }, 3186 { "ti", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-03:00", "-3:00" }, 3187 3188 // JB#5150 3189 { "ti", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" }, 3190 { "ti", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" }, 3191 { "ti", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "GMT+05:30", "+5:30" }, 3192 { "ti", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "GMT+05:30", "+5:30" }, 3193 { "ti", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" }, 3194 { "ti", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" }, 3195 { "ti", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "GMT+05:30", "+05:30" }, 3196 { "ti", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "GMT+05:30", "+5:30" }, 3197 { "ti", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "IN", "Alna/Calcutta" }, 3198 { "ti", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "IN", "Asia/Calcutta" }, 3199 3200 // Ticket#8589 Partial location name to use country name if the zone is the golden 3201 // zone for the time zone's country. 3202 { "en_MX", "America/Chicago", "1995-07-15T00:00:00Z", "vvvv", "Central Time (United States)", "America/Chicago"}, 3203 3204 // Tests proper handling of time zones that should have empty sets when inherited from the parent. 3205 // For example, en_GB understands CET as Central European Time, but en_HK, which inherits from en_GB 3206 // does not 3207 { "en_GB", "Europe/Paris", "2004-01-15T00:00:00Z", "zzzz", "Central European Standard Time", "+1:00"}, 3208 { "en_GB", "Europe/Paris", "2004-07-15T00:00:00Z", "zzzz", "Central European Summer Time", "+2:00"}, 3209 { "en_GB", "Europe/Paris", "2004-01-15T00:00:00Z", "z", "CET", "+1:00"}, 3210 { "en_GB", "Europe/Paris", "2004-07-15T00:00:00Z", "z", "CEST", "+2:00"}, 3211 { "en_HK", "Europe/Paris", "2004-01-15T00:00:00Z", "zzzz", "Central European Standard Time", "+1:00"}, 3212 { "en_HK", "Europe/Paris", "2004-07-15T00:00:00Z", "zzzz", "Central European Summer Time", "+2:00"}, 3213 { "en_HK", "Europe/Paris", "2004-01-15T00:00:00Z", "z", "GMT+01:00", "+1:00"}, 3214 { "en_HK", "Europe/Paris", "2004-07-15T00:00:00Z", "z", "GMT+02:00", "+2:00"}, 3215 3216 { NULL, NULL, NULL, NULL, NULL, NULL }, 3217 }; 3218 3219 UErrorCode status = U_ZERO_ERROR; 3220 Calendar *cal = GregorianCalendar::createInstance(status); 3221 if (failure(status, "GregorianCalendar::createInstance", TRUE)) return; 3222 SimpleDateFormat testfmt(UnicodeString("yyyy-MM-dd'T'HH:mm:ss'Z'"), status); 3223 if (failure(status, "SimpleDateFormat constructor", TRUE)) return; 3224 testfmt.setTimeZone(*TimeZone::getGMT()); 3225 3226 for (int i = 0; fallbackTests[i][0]; i++) { 3227 const char **testLine = fallbackTests[i]; 3228 UnicodeString info[5]; 3229 for ( int j = 0 ; j < 5 ; j++ ) { 3230 info[j] = UnicodeString(testLine[j], -1, US_INV); 3231 } 3232 info[4] = info[4].unescape(); 3233 logln("%s;%s;%s;%s", testLine[0], testLine[1], testLine[2], testLine[3]); 3234 3235 TimeZone *tz = TimeZone::createTimeZone(info[1]); 3236 3237 UDate d = testfmt.parse(testLine[2], status); 3238 cal->setTime(d, status); 3239 if (U_FAILURE(status)) { 3240 errln(UnicodeString("Failed to set date: ") + testLine[2]); 3241 } 3242 3243 SimpleDateFormat fmt(info[3], Locale(testLine[0]),status); 3244 ASSERT_OK(status); 3245 cal->adoptTimeZone(tz); 3246 UnicodeString result; 3247 FieldPosition pos(0); 3248 fmt.format(*cal,result,pos); 3249 if (result != info[4]) { 3250 errln(info[0] + ";" + info[1] + ";" + info[2] + ";" + info[3] + " expected: '" + 3251 info[4] + "' but got: '" + result + "'"); 3252 } 3253 } 3254 delete cal; 3255 } 3256 3257 void DateFormatTest::TestRoundtripWithCalendar(void) { 3258 UErrorCode status = U_ZERO_ERROR; 3259 3260 TimeZone *tz = TimeZone::createTimeZone("Europe/Paris"); 3261 TimeZone *gmt = TimeZone::createTimeZone("Etc/GMT"); 3262 3263 Calendar *calendars[] = { 3264 Calendar::createInstance(*tz, Locale("und@calendar=gregorian"), status), 3265 Calendar::createInstance(*tz, Locale("und@calendar=buddhist"), status), 3266 // Calendar::createInstance(*tz, Locale("und@calendar=hebrew"), status), 3267 Calendar::createInstance(*tz, Locale("und@calendar=islamic"), status), 3268 Calendar::createInstance(*tz, Locale("und@calendar=japanese"), status), 3269 NULL 3270 }; 3271 if (U_FAILURE(status)) { 3272 dataerrln("Failed to initialize calendars: %s", u_errorName(status)); 3273 for (int i = 0; calendars[i] != NULL; i++) { 3274 delete calendars[i]; 3275 } 3276 return; 3277 } 3278 3279 //FIXME The formatters commented out below are currently failing because of 3280 // the calendar calculation problem reported by #6691 3281 3282 // The order of test formatters must match the order of calendars above. 3283 DateFormat *formatters[] = { 3284 DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, Locale("en_US")), //calendar=gregorian 3285 DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, Locale("th_TH")), //calendar=buddhist 3286 // DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, Locale("he_IL@calendar=hebrew")), 3287 DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, Locale("ar_EG@calendar=islamic")), 3288 // DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, Locale("ja_JP@calendar=japanese")), 3289 NULL 3290 }; 3291 3292 UDate d = Calendar::getNow(); 3293 UnicodeString buf; 3294 FieldPosition fpos; 3295 ParsePosition ppos; 3296 3297 for (int i = 0; formatters[i] != NULL; i++) { 3298 buf.remove(); 3299 fpos.setBeginIndex(0); 3300 fpos.setEndIndex(0); 3301 calendars[i]->setTime(d, status); 3302 3303 // Normal case output - the given calendar matches the calendar 3304 // used by the formatter 3305 formatters[i]->format(*calendars[i], buf, fpos); 3306 UnicodeString refStr(buf); 3307 3308 for (int j = 0; calendars[j] != NULL; j++) { 3309 if (j == i) { 3310 continue; 3311 } 3312 buf.remove(); 3313 fpos.setBeginIndex(0); 3314 fpos.setEndIndex(0); 3315 calendars[j]->setTime(d, status); 3316 3317 // Even the different calendar type is specified, 3318 // we should get the same result. 3319 formatters[i]->format(*calendars[j], buf, fpos); 3320 if (refStr != buf) { 3321 errln((UnicodeString)"FAIL: Different format result with a different calendar for the same time -" 3322 + "\n Reference calendar type=" + calendars[i]->getType() 3323 + "\n Another calendar type=" + calendars[j]->getType() 3324 + "\n Expected result=" + refStr 3325 + "\n Actual result=" + buf); 3326 } 3327 } 3328 3329 calendars[i]->setTimeZone(*gmt); 3330 calendars[i]->clear(); 3331 ppos.setErrorIndex(-1); 3332 ppos.setIndex(0); 3333 3334 // Normal case parse result - the given calendar matches the calendar 3335 // used by the formatter 3336 formatters[i]->parse(refStr, *calendars[i], ppos); 3337 3338 for (int j = 0; calendars[j] != NULL; j++) { 3339 if (j == i) { 3340 continue; 3341 } 3342 calendars[j]->setTimeZone(*gmt); 3343 calendars[j]->clear(); 3344 ppos.setErrorIndex(-1); 3345 ppos.setIndex(0); 3346 3347 // Even the different calendar type is specified, 3348 // we should get the same time and time zone. 3349 formatters[i]->parse(refStr, *calendars[j], ppos); 3350 if (calendars[i]->getTime(status) != calendars[j]->getTime(status) 3351 || calendars[i]->getTimeZone() != calendars[j]->getTimeZone()) { 3352 UnicodeString tzid; 3353 errln((UnicodeString)"FAIL: Different parse result with a different calendar for the same string -" 3354 + "\n Reference calendar type=" + calendars[i]->getType() 3355 + "\n Another calendar type=" + calendars[j]->getType() 3356 + "\n Date string=" + refStr 3357 + "\n Expected time=" + calendars[i]->getTime(status) 3358 + "\n Expected time zone=" + calendars[i]->getTimeZone().getID(tzid) 3359 + "\n Actual time=" + calendars[j]->getTime(status) 3360 + "\n Actual time zone=" + calendars[j]->getTimeZone().getID(tzid)); 3361 } 3362 } 3363 if (U_FAILURE(status)) { 3364 errln((UnicodeString)"FAIL: " + u_errorName(status)); 3365 break; 3366 } 3367 } 3368 3369 delete tz; 3370 delete gmt; 3371 for (int i = 0; calendars[i] != NULL; i++) { 3372 delete calendars[i]; 3373 } 3374 for (int i = 0; formatters[i] != NULL; i++) { 3375 delete formatters[i]; 3376 } 3377 } 3378 3379 /* 3380 void DateFormatTest::TestRelativeError(void) 3381 { 3382 UErrorCode status; 3383 Locale en("en"); 3384 3385 DateFormat *en_reltime_reldate = DateFormat::createDateTimeInstance(DateFormat::kFullRelative,DateFormat::kFullRelative,en); 3386 if(en_reltime_reldate == NULL) { 3387 logln("PASS: rel date/rel time failed"); 3388 } else { 3389 errln("FAIL: rel date/rel time created, should have failed."); 3390 delete en_reltime_reldate; 3391 } 3392 } 3393 3394 void DateFormatTest::TestRelativeOther(void) 3395 { 3396 logln("Nothing in this test. When we get more data from CLDR, put in some tests of -2, +2, etc. "); 3397 } 3398 */ 3399 3400 void DateFormatTest::Test6338(void) 3401 { 3402 UErrorCode status = U_ZERO_ERROR; 3403 3404 SimpleDateFormat *fmt1 = new SimpleDateFormat(UnicodeString("y-M-d"), Locale("ar"), status); 3405 if (failure(status, "new SimpleDateFormat", TRUE)) return; 3406 3407 UDate dt1 = date(2008-1900, UCAL_JUNE, 10, 12, 00); 3408 UnicodeString str1; 3409 str1 = fmt1->format(dt1, str1); 3410 logln(str1); 3411 3412 UDate dt11 = fmt1->parse(str1, status); 3413 failure(status, "fmt->parse"); 3414 3415 UnicodeString str11; 3416 str11 = fmt1->format(dt11, str11); 3417 logln(str11); 3418 3419 if (str1 != str11) { 3420 errln((UnicodeString)"FAIL: Different dates str1:" + str1 3421 + " str2:" + str11); 3422 } 3423 delete fmt1; 3424 3425 ///////////////// 3426 3427 status = U_ZERO_ERROR; 3428 SimpleDateFormat *fmt2 = new SimpleDateFormat(UnicodeString("y M d"), Locale("ar"), status); 3429 failure(status, "new SimpleDateFormat"); 3430 3431 UDate dt2 = date(2008-1900, UCAL_JUNE, 10, 12, 00); 3432 UnicodeString str2; 3433 str2 = fmt2->format(dt2, str2); 3434 logln(str2); 3435 3436 UDate dt22 = fmt2->parse(str2, status); 3437 failure(status, "fmt->parse"); 3438 3439 UnicodeString str22; 3440 str22 = fmt2->format(dt22, str22); 3441 logln(str22); 3442 3443 if (str2 != str22) { 3444 errln((UnicodeString)"FAIL: Different dates str1:" + str2 3445 + " str2:" + str22); 3446 } 3447 delete fmt2; 3448 3449 ///////////////// 3450 3451 status = U_ZERO_ERROR; 3452 SimpleDateFormat *fmt3 = new SimpleDateFormat(UnicodeString("y-M-d"), Locale("en-us"), status); 3453 failure(status, "new SimpleDateFormat"); 3454 3455 UDate dt3 = date(2008-1900, UCAL_JUNE, 10, 12, 00); 3456 UnicodeString str3; 3457 str3 = fmt3->format(dt3, str3); 3458 logln(str3); 3459 3460 UDate dt33 = fmt3->parse(str3, status); 3461 failure(status, "fmt->parse"); 3462 3463 UnicodeString str33; 3464 str33 = fmt3->format(dt33, str33); 3465 logln(str33); 3466 3467 if (str3 != str33) { 3468 errln((UnicodeString)"FAIL: Different dates str1:" + str3 3469 + " str2:" + str33); 3470 } 3471 delete fmt3; 3472 3473 ///////////////// 3474 3475 status = U_ZERO_ERROR; 3476 SimpleDateFormat *fmt4 = new SimpleDateFormat(UnicodeString("y M d"), Locale("en-us"), status); 3477 failure(status, "new SimpleDateFormat"); 3478 3479 UDate dt4 = date(2008-1900, UCAL_JUNE, 10, 12, 00); 3480 UnicodeString str4; 3481 str4 = fmt4->format(dt4, str4); 3482 logln(str4); 3483 3484 UDate dt44 = fmt4->parse(str4, status); 3485 failure(status, "fmt->parse"); 3486 3487 UnicodeString str44; 3488 str44 = fmt4->format(dt44, str44); 3489 logln(str44); 3490 3491 if (str4 != str44) { 3492 errln((UnicodeString)"FAIL: Different dates str1:" + str4 3493 + " str2:" + str44); 3494 } 3495 delete fmt4; 3496 3497 } 3498 3499 void DateFormatTest::Test6726(void) 3500 { 3501 // status 3502 // UErrorCode status = U_ZERO_ERROR; 3503 3504 // fmtf, fmtl, fmtm, fmts; 3505 UnicodeString strf, strl, strm, strs; 3506 UDate dt = date(2008-1900, UCAL_JUNE, 10, 12, 00); 3507 3508 Locale loc("ja"); 3509 DateFormat* fmtf = DateFormat::createDateTimeInstance(DateFormat::FULL, DateFormat::FULL, loc); 3510 DateFormat* fmtl = DateFormat::createDateTimeInstance(DateFormat::LONG, DateFormat::FULL, loc); 3511 DateFormat* fmtm = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::FULL, loc); 3512 DateFormat* fmts = DateFormat::createDateTimeInstance(DateFormat::SHORT, DateFormat::FULL, loc); 3513 if (fmtf == NULL || fmtl == NULL || fmtm == NULL || fmts == NULL) { 3514 dataerrln("Unable to create DateFormat. got NULL."); 3515 /* It may not be true that if one is NULL all is NULL. Just to be safe. */ 3516 delete fmtf; 3517 delete fmtl; 3518 delete fmtm; 3519 delete fmts; 3520 3521 return; 3522 } 3523 strf = fmtf->format(dt, strf); 3524 strl = fmtl->format(dt, strl); 3525 strm = fmtm->format(dt, strm); 3526 strs = fmts->format(dt, strs); 3527 3528 3529 logln("strm.charAt(10)=%04X wanted 0x20\n", strm.charAt(10)); 3530 if (strm.charAt(10) != UChar(0x0020)) { 3531 errln((UnicodeString)"FAIL: Improper formatted date: " + strm ); 3532 } 3533 logln("strs.charAt(10)=%04X wanted 0x20\n", strs.charAt(8)); 3534 if (strs.charAt(10) != UChar(0x0020)) { 3535 errln((UnicodeString)"FAIL: Improper formatted date: " + strs); 3536 } 3537 3538 delete fmtf; 3539 delete fmtl; 3540 delete fmtm; 3541 delete fmts; 3542 3543 return; 3544 } 3545 3546 /** 3547 * Test DateFormat's parsing of default GMT variants. See ticket#6135 3548 */ 3549 void DateFormatTest::TestGMTParsing() { 3550 const char* DATA[] = { 3551 "HH:mm:ss Z", 3552 3553 // pattern, input, expected output (in quotes) 3554 "HH:mm:ss Z", "10:20:30 GMT+03:00", "10:20:30 +0300", 3555 "HH:mm:ss Z", "10:20:30 UT-02:00", "10:20:30 -0200", 3556 "HH:mm:ss Z", "10:20:30 GMT", "10:20:30 +0000", 3557 "HH:mm:ss vvvv", "10:20:30 UT+10:00", "10:20:30 +1000", 3558 "HH:mm:ss zzzz", "10:20:30 UTC", "10:20:30 +0000", // standalone "UTC" 3559 "ZZZZ HH:mm:ss", "UT 10:20:30", "10:20:30 +0000", 3560 "V HH:mm:ss", "UT+0130 10:20:30", "10:20:30 +0130", 3561 "V HH:mm:ss", "UTC+0130 10:20:30", "10:20:30 +0130", 3562 "HH mm Z ss", "10 20 GMT-1100 30", "10:20:30 -1100", 3563 "HH:mm:ssZZZZZ", "14:25:45Z", "14:25:45 +0000", 3564 "HH:mm:ssZZZZZ", "15:00:00-08:00", "15:00:00 -0800", 3565 }; 3566 const int32_t DATA_len = sizeof(DATA)/sizeof(DATA[0]); 3567 expectParse(DATA, DATA_len, Locale("en")); 3568 } 3569 3570 // Test case for localized GMT format parsing 3571 // with no delimitters in offset format (Chinese locale) 3572 void DateFormatTest::Test6880() { 3573 UErrorCode status = U_ZERO_ERROR; 3574 UDate d1, d2, dp1, dp2, dexp1, dexp2; 3575 UnicodeString s1, s2; 3576 3577 TimeZone *tz = TimeZone::createTimeZone("Asia/Shanghai"); 3578 GregorianCalendar gcal(*tz, status); 3579 if (failure(status, "construct GregorianCalendar", TRUE)) return; 3580 3581 gcal.clear(); 3582 gcal.set(1910, UCAL_JULY, 1, 12, 00); // offset 8:05:52 3583 d1 = gcal.getTime(status); 3584 3585 gcal.clear(); 3586 gcal.set(1950, UCAL_JULY, 1, 12, 00); // offset 8:00 3587 d2 = gcal.getTime(status); 3588 3589 gcal.clear(); 3590 gcal.set(1970, UCAL_JANUARY, 1, 12, 00); 3591 dexp2 = gcal.getTime(status); 3592 dexp1 = dexp2 - (5*60 + 52)*1000; // subtract 5m52s 3593 3594 if (U_FAILURE(status)) { 3595 errln("FAIL: Gregorian calendar error"); 3596 } 3597 3598 DateFormat *fmt = DateFormat::createTimeInstance(DateFormat::kFull, Locale("zh")); 3599 if (fmt == NULL) { 3600 dataerrln("Unable to create DateFormat. Got NULL."); 3601 return; 3602 } 3603 fmt->adoptTimeZone(tz); 3604 3605 fmt->format(d1, s1); 3606 fmt->format(d2, s2); 3607 3608 dp1 = fmt->parse(s1, status); 3609 dp2 = fmt->parse(s2, status); 3610 3611 if (U_FAILURE(status)) { 3612 errln("FAIL: Parse failure"); 3613 } 3614 3615 if (dp1 != dexp1) { 3616 errln("FAIL: Failed to parse " + s1 + " parsed: " + dp1 + " expected: " + dexp1); 3617 } 3618 if (dp2 != dexp2) { 3619 errln("FAIL: Failed to parse " + s2 + " parsed: " + dp2 + " expected: " + dexp2); 3620 } 3621 3622 delete fmt; 3623 } 3624 3625 typedef struct { 3626 const char * localeStr; 3627 UBool lenient; 3628 UBool expectFail; 3629 UnicodeString datePattern; 3630 UnicodeString dateString; 3631 } NumAsStringItem; 3632 3633 void DateFormatTest::TestNumberAsStringParsing() 3634 { 3635 const NumAsStringItem items[] = { 3636 // loc lenient fail? datePattern dateString 3637 { "", FALSE, FALSE, UnicodeString("y MMMM d HH:mm:ss"), UnicodeString("2009 7 14 08:43:57") }, 3638 { "", TRUE, FALSE, UnicodeString("y MMMM d HH:mm:ss"), UnicodeString("2009 7 14 08:43:57") }, 3639 { "en", FALSE, FALSE, UnicodeString("MMM d, y"), UnicodeString("Jul 14, 2009") }, 3640 { "en", TRUE, FALSE, UnicodeString("MMM d, y"), UnicodeString("Jul 14, 2009") }, 3641 { "en", FALSE, TRUE, UnicodeString("MMM d, y"), UnicodeString("7 14, 2009") }, 3642 { "en", TRUE, FALSE, UnicodeString("MMM d, y"), UnicodeString("7 14, 2009") }, 3643 { "ja", FALSE, FALSE, UnicodeString("yyyy/MM/dd"), UnicodeString("2009/07/14") }, 3644 { "ja", TRUE, FALSE, UnicodeString("yyyy/MM/dd"), UnicodeString("2009/07/14") }, 3645 //{ "ja", FALSE, FALSE, UnicodeString("yyyy/MMMMM/d"), UnicodeString("2009/7/14") }, // #8860 covers test failure 3646 { "ja", TRUE, FALSE, UnicodeString("yyyy/MMMMM/d"), UnicodeString("2009/7/14") }, 3647 { "ja", FALSE, FALSE, CharsToUnicodeString("y\\u5E74M\\u6708d\\u65E5"), CharsToUnicodeString("2009\\u5E747\\u670814\\u65E5") }, 3648 { "ja", TRUE, FALSE, CharsToUnicodeString("y\\u5E74M\\u6708d\\u65E5"), CharsToUnicodeString("2009\\u5E747\\u670814\\u65E5") }, 3649 { "ja", FALSE, FALSE, CharsToUnicodeString("y\\u5E74MMMd\\u65E5"), CharsToUnicodeString("2009\\u5E747\\u670814\\u65E5") }, 3650 { "ja", TRUE, FALSE, CharsToUnicodeString("y\\u5E74MMMd\\u65E5"), CharsToUnicodeString("2009\\u5E747\\u670814\\u65E5") }, // #8820 fixes test failure 3651 { "ko", FALSE, FALSE, UnicodeString("yyyy. M. d."), UnicodeString("2009. 7. 14.") }, 3652 { "ko", TRUE, FALSE, UnicodeString("yyyy. M. d."), UnicodeString("2009. 7. 14.") }, 3653 { "ko", FALSE, FALSE, UnicodeString("yyyy. MMMMM d."), CharsToUnicodeString("2009. 7\\uC6D4 14.") }, 3654 { "ko", TRUE, FALSE, UnicodeString("yyyy. MMMMM d."), CharsToUnicodeString("2009. 7\\uC6D4 14.") }, // #8820 fixes test failure 3655 { "ko", FALSE, FALSE, CharsToUnicodeString("y\\uB144 M\\uC6D4 d\\uC77C"), CharsToUnicodeString("2009\\uB144 7\\uC6D4 14\\uC77C") }, 3656 { "ko", TRUE, FALSE, CharsToUnicodeString("y\\uB144 M\\uC6D4 d\\uC77C"), CharsToUnicodeString("2009\\uB144 7\\uC6D4 14\\uC77C") }, 3657 { "ko", FALSE, FALSE, CharsToUnicodeString("y\\uB144 MMM d\\uC77C"), CharsToUnicodeString("2009\\uB144 7\\uC6D4 14\\uC77C") }, 3658 { "ko", TRUE, FALSE, CharsToUnicodeString("y\\uB144 MMM d\\uC77C"), CharsToUnicodeString("2009\\uB144 7\\uC6D4 14\\uC77C") }, // #8820 fixes test failure 3659 { NULL, FALSE, FALSE, UnicodeString(""), UnicodeString("") } 3660 }; 3661 const NumAsStringItem * itemPtr; 3662 for (itemPtr = items; itemPtr->localeStr != NULL; itemPtr++ ) { 3663 Locale locale = Locale::createFromName(itemPtr->localeStr); 3664 UErrorCode status = U_ZERO_ERROR; 3665 SimpleDateFormat *formatter = new SimpleDateFormat(itemPtr->datePattern, locale, status); 3666 if (formatter == NULL || U_FAILURE(status)) { 3667 dataerrln("Unable to create SimpleDateFormat - %s", u_errorName(status)); 3668 return; 3669 } 3670 3671 formatter->setLenient(itemPtr->lenient); 3672 UDate date1 = formatter->parse(itemPtr->dateString, status); 3673 if (U_FAILURE(status)) { 3674 if (!itemPtr->expectFail) { 3675 errln("FAIL, err when expected success: Locale \"" + UnicodeString(itemPtr->localeStr) + "\", lenient " + itemPtr->lenient + 3676 ": using pattern \"" + itemPtr->datePattern + "\", could not parse \"" + itemPtr->dateString + "\"; err: " + u_errorName(status) ); 3677 } 3678 } else if (itemPtr->expectFail) { 3679 errln("FAIL, expected err but got none: Locale \"" + UnicodeString(itemPtr->localeStr) + "\", lenient " + itemPtr->lenient + 3680 ": using pattern \"" + itemPtr->datePattern + "\", did parse \"" + itemPtr->dateString + "\"." ); 3681 } else if (!itemPtr->lenient) { 3682 UnicodeString formatted; 3683 formatter->format(date1, formatted); 3684 if (formatted != itemPtr->dateString) { 3685 errln("FAIL, mismatch formatting parsed date: Locale \"" + UnicodeString(itemPtr->localeStr) + "\", lenient " + itemPtr->lenient + 3686 ": using pattern \"" + itemPtr->datePattern + "\", did parse \"" + itemPtr->dateString + "\", formatted result \"" + formatted + "\"."); 3687 } 3688 } 3689 3690 delete formatter; 3691 } 3692 } 3693 3694 void DateFormatTest::TestISOEra() { 3695 3696 const char* data[] = { 3697 // input, output 3698 "BC 4004-10-23T07:00:00Z", "BC 4004-10-23T07:00:00Z", 3699 "AD 4004-10-23T07:00:00Z", "AD 4004-10-23T07:00:00Z", 3700 "-4004-10-23T07:00:00Z" , "BC 4005-10-23T07:00:00Z", 3701 "4004-10-23T07:00:00Z" , "AD 4004-10-23T07:00:00Z", 3702 }; 3703 3704 int32_t numData = 8; 3705 3706 UErrorCode status = U_ZERO_ERROR; 3707 3708 // create formatter 3709 SimpleDateFormat *fmt1 = new SimpleDateFormat(UnicodeString("GGG yyyy-MM-dd'T'HH:mm:ss'Z"), status); 3710 failure(status, "new SimpleDateFormat", TRUE); 3711 if (status == U_MISSING_RESOURCE_ERROR) { 3712 if (fmt1 != NULL) { 3713 delete fmt1; 3714 } 3715 return; 3716 } 3717 for(int i=0; i < numData; i+=2) { 3718 // create input string 3719 UnicodeString in = data[i]; 3720 3721 // parse string to date 3722 UDate dt1 = fmt1->parse(in, status); 3723 failure(status, "fmt->parse", TRUE); 3724 3725 // format date back to string 3726 UnicodeString out; 3727 out = fmt1->format(dt1, out); 3728 logln(out); 3729 3730 // check that roundtrip worked as expected 3731 UnicodeString expected = data[i+1]; 3732 if (out != expected) { 3733 dataerrln((UnicodeString)"FAIL: " + in + " -> " + out + " expected -> " + expected); 3734 } 3735 } 3736 3737 delete fmt1; 3738 } 3739 void DateFormatTest::TestFormalChineseDate() { 3740 3741 UErrorCode status = U_ZERO_ERROR; 3742 UnicodeString pattern ("y\\u5e74M\\u6708d\\u65e5", -1, US_INV ); 3743 pattern = pattern.unescape(); 3744 UnicodeString override ("y=hanidec;M=hans;d=hans", -1, US_INV ); 3745 3746 // create formatter 3747 SimpleDateFormat *sdf = new SimpleDateFormat(pattern,override,Locale::getChina(),status); 3748 failure(status, "new SimpleDateFormat with override", TRUE); 3749 3750 UDate thedate = date(2009-1900, UCAL_JULY, 28); 3751 FieldPosition pos(0); 3752 UnicodeString result; 3753 sdf->format(thedate,result,pos); 3754 3755 UnicodeString expected = "\\u4e8c\\u3007\\u3007\\u4e5d\\u5e74\\u4e03\\u6708\\u4e8c\\u5341\\u516b\\u65e5"; 3756 expected = expected.unescape(); 3757 if (result != expected) { 3758 dataerrln((UnicodeString)"FAIL: -> " + result + " expected -> " + expected); 3759 } 3760 3761 UDate parsedate = sdf->parse(expected,status); 3762 if ( parsedate != thedate ) { 3763 UnicodeString pat1 ("yyyy-MM-dd'T'HH:mm:ss'Z'", -1, US_INV ); 3764 SimpleDateFormat *usf = new SimpleDateFormat(pat1,Locale::getEnglish(),status); 3765 UnicodeString parsedres,expres; 3766 usf->format(parsedate,parsedres,pos); 3767 usf->format(thedate,expres,pos); 3768 dataerrln((UnicodeString)"FAIL: parsed -> " + parsedres + " expected -> " + expres); 3769 delete usf; 3770 } 3771 delete sdf; 3772 } 3773 3774 // Test case for #8675 3775 // Incorrect parse offset with stand alone GMT string on 2nd or later iteration. 3776 void DateFormatTest::TestStandAloneGMTParse() { 3777 UErrorCode status = U_ZERO_ERROR; 3778 SimpleDateFormat *sdf = new SimpleDateFormat("ZZZZ", Locale(""), status); 3779 3780 if (U_SUCCESS(status)) { 3781 3782 UnicodeString inText("GMT$$$"); 3783 for (int32_t i = 0; i < 10; i++) { 3784 ParsePosition pos(0); 3785 sdf->parse(inText, pos); 3786 if (pos.getIndex() != 3) { 3787 errln((UnicodeString)"FAIL: Incorrect output parse position: actual=" + pos.getIndex() + " expected=3"); 3788 } 3789 } 3790 3791 delete sdf; 3792 } else { 3793 dataerrln("Unable to create SimpleDateFormat - %s", u_errorName(status)); 3794 } 3795 } 3796 3797 void DateFormatTest::TestParsePosition() { 3798 const char* TestData[][4] = { 3799 // {<pattern>, <lead>, <date string>, <trail>} 3800 {"yyyy-MM-dd HH:mm:ssZ", "", "2010-01-10 12:30:00+0500", ""}, 3801 {"yyyy-MM-dd HH:mm:ss ZZZZ", "", "2010-01-10 12:30:00 GMT+05:00", ""}, 3802 {"Z HH:mm:ss", "", "-0100 13:20:30", ""}, 3803 {"y-M-d Z", "", "2011-8-25 -0400", " Foo"}, 3804 {"y/M/d H:mm:ss z", "", "2011/7/1 12:34:00 PDT", ""}, 3805 {"y/M/d H:mm:ss z", "+123", "2011/7/1 12:34:00 PDT", " PST"}, 3806 {"vvvv a h:mm:ss", "", "Pacific Time AM 10:21:45", ""}, 3807 {"HH:mm v M/d", "111", "14:15 PT 8/10", " 12345"}, 3808 {"'time zone:' VVVV 'date:' yyyy-MM-dd", "xxxx", "time zone: Los Angeles Time date: 2010-02-25", "xxxx"}, 3809 {"yG", "", "2012AD", ""}, 3810 {"yG", "", "2012", "x"}, 3811 {0, 0, 0, 0}, 3812 }; 3813 3814 for (int32_t i = 0; TestData[i][0]; i++) { 3815 UErrorCode status = U_ZERO_ERROR; 3816 SimpleDateFormat *sdf = new SimpleDateFormat(UnicodeString(TestData[i][0]), status); 3817 if (failure(status, "new SimpleDateFormat", TRUE)) return; 3818 3819 int32_t startPos, resPos; 3820 3821 // lead text 3822 UnicodeString input(TestData[i][1]); 3823 startPos = input.length(); 3824 3825 // date string 3826 input += TestData[i][2]; 3827 resPos = input.length(); 3828 3829 // trail text 3830 input += TestData[i][3]; 3831 3832 ParsePosition pos(startPos); 3833 //UDate d = sdf->parse(input, pos); 3834 (void)sdf->parse(input, pos); 3835 3836 if (pos.getIndex() != resPos) { 3837 errln(UnicodeString("FAIL: Parsing [") + input + "] with pattern [" + TestData[i][0] + "] returns position - " 3838 + pos.getIndex() + ", expected - " + resPos); 3839 } 3840 3841 delete sdf; 3842 } 3843 } 3844 3845 3846 typedef struct { 3847 int32_t era; 3848 int32_t year; 3849 int32_t month; // 1-based 3850 int32_t isLeapMonth; 3851 int32_t day; 3852 } ChineseCalTestDate; 3853 3854 #define NUM_TEST_DATES 3 3855 3856 typedef struct { 3857 const char * locale; 3858 int32_t style; // <0 => custom 3859 UnicodeString dateString[NUM_TEST_DATES]; 3860 } MonthPatternItem; 3861 3862 void DateFormatTest::TestMonthPatterns() 3863 { 3864 const ChineseCalTestDate dates[NUM_TEST_DATES] = { 3865 // era yr mo lp da 3866 { 78, 29, 4, 0, 2 }, // (in chinese era 78) gregorian 2012-4-22 3867 { 78, 29, 4, 1, 2 }, // (in chinese era 78) gregorian 2012-5-22 3868 { 78, 29, 5, 0, 2 }, // (in chinese era 78) gregorian 2012-6-20 3869 }; 3870 3871 const MonthPatternItem items[] = { 3872 // locale date style; expected formats for the 3 dates above 3873 { "root@calendar=chinese", DateFormat::kLong, { UnicodeString("ren-chen 4 2"), UnicodeString("ren-chen 4bis 2"), UnicodeString("ren-chen 5 2") } }, 3874 { "root@calendar=chinese", DateFormat::kShort, { UnicodeString("29-4-2"), UnicodeString("29-4bis-2"), UnicodeString("29-5-2") } }, 3875 { "root@calendar=chinese", -1, { UnicodeString("29-4-2"), UnicodeString("29-4bis-2"), UnicodeString("29-5-2") } }, 3876 { "root@calendar=chinese", -2, { UnicodeString("78x29-4-2"), UnicodeString("78x29-4bis-2"), UnicodeString("78x29-5-2") } }, 3877 { "root@calendar=chinese", -3, { UnicodeString("ren-chen-4-2"), UnicodeString("ren-chen-4bis-2"), UnicodeString("ren-chen-5-2") } }, 3878 { "root@calendar=chinese", -4, { UnicodeString("ren-chen 4 2"), UnicodeString("ren-chen 4bis 2"), UnicodeString("ren-chen 5 2") } }, 3879 { "en@calendar=gregorian", -3, { UnicodeString("2012-4-22"), UnicodeString("2012-5-22"), UnicodeString("2012-6-20") } }, 3880 { "en@calendar=chinese", DateFormat::kLong, { UnicodeString("4 2, ren-chen"), UnicodeString("4bis 2, ren-chen"), UnicodeString("5 2, ren-chen") } }, 3881 { "en@calendar=chinese", DateFormat::kShort, { UnicodeString("4/2/29"), UnicodeString("4bis/2/29"), UnicodeString("5/2/29") } }, 3882 { "zh@calendar=chinese", DateFormat::kLong, { CharsToUnicodeString("\\u58EC\\u8FB0\\u5E74\\u56DB\\u6708\\u4E8C\\u65E5"), 3883 CharsToUnicodeString("\\u58EC\\u8FB0\\u5E74\\u95F0\\u56DB\\u6708\\u4E8C\\u65E5"), 3884 CharsToUnicodeString("\\u58EC\\u8FB0\\u5E74\\u4E94\\u6708\\u4E8C\\u65E5") } }, 3885 { "zh@calendar=chinese", DateFormat::kShort, { CharsToUnicodeString("\\u58EC\\u8FB0-4-2"), 3886 CharsToUnicodeString("\\u58EC\\u8FB0-\\u95F04-2"), 3887 CharsToUnicodeString("\\u58EC\\u8FB0-5-2") } }, 3888 { "zh@calendar=chinese", -3, { CharsToUnicodeString("\\u58EC\\u8FB0-4-2"), 3889 CharsToUnicodeString("\\u58EC\\u8FB0-\\u95F04-2"), 3890 CharsToUnicodeString("\\u58EC\\u8FB0-5-2") } }, 3891 { "zh@calendar=chinese", -4, { CharsToUnicodeString("\\u58EC\\u8FB0 \\u56DB\\u6708 2"), 3892 CharsToUnicodeString("\\u58EC\\u8FB0 \\u95F0\\u56DB\\u6708 2"), 3893 CharsToUnicodeString("\\u58EC\\u8FB0 \\u4E94\\u6708 2") } }, 3894 { "zh_Hant@calendar=chinese", DateFormat::kLong, { CharsToUnicodeString("\\u58EC\\u8FB0\\u5E74\\u56DB\\u6708\\u4E8C\\u65E5"), 3895 CharsToUnicodeString("\\u58EC\\u8FB0\\u5E74\\u958F\\u56DB\\u6708\\u4E8C\\u65E5"), 3896 CharsToUnicodeString("\\u58EC\\u8FB0\\u5E74\\u4E94\\u6708\\u4E8C\\u65E5") } }, 3897 { "zh_Hant@calendar=chinese", DateFormat::kShort, { CharsToUnicodeString("\\u58EC\\u8FB0/4/2"), 3898 CharsToUnicodeString("\\u58EC\\u8FB0/\\u958F4/2"), 3899 CharsToUnicodeString("\\u58EC\\u8FB0/5/2") } }, 3900 { "fr@calendar=chinese", DateFormat::kLong, { CharsToUnicodeString("2 s\\u00ECyu\\u00E8 ren-chen"), 3901 CharsToUnicodeString("2 s\\u00ECyu\\u00E8bis ren-chen"), 3902 CharsToUnicodeString("2 w\\u01D4yu\\u00E8 ren-chen") } }, 3903 { "fr@calendar=chinese", DateFormat::kShort, { UnicodeString("2/4/29"), UnicodeString("2/4bis/29"), UnicodeString("2/5/29") } }, 3904 // terminator 3905 { NULL, 0, { UnicodeString(""), UnicodeString(""), UnicodeString("") } } 3906 }; 3907 3908 //. style: -1 -2 -3 -4 3909 const UnicodeString customPatterns[] = { "y-Ml-d", "G'x'y-Ml-d", "U-M-d", "U MMM d" }; // like old root pattern, using 'l' 3910 3911 UErrorCode status = U_ZERO_ERROR; 3912 Locale rootChineseCalLocale = Locale::createFromName("root@calendar=chinese"); 3913 Calendar * rootChineseCalendar = Calendar::createInstance(rootChineseCalLocale, status); 3914 if (U_SUCCESS(status)) { 3915 const MonthPatternItem * itemPtr; 3916 for (itemPtr = items; itemPtr->locale != NULL; itemPtr++ ) { 3917 Locale locale = Locale::createFromName(itemPtr->locale); 3918 DateFormat * dmft = (itemPtr->style >= 0)? 3919 DateFormat::createDateInstance((DateFormat::EStyle)itemPtr->style, locale): 3920 new SimpleDateFormat(customPatterns[-itemPtr->style - 1], locale, status); 3921 if ( dmft != NULL ) { 3922 if (U_SUCCESS(status)) { 3923 const ChineseCalTestDate * datePtr = dates; 3924 int32_t idate; 3925 for (idate = 0; idate < NUM_TEST_DATES; idate++, datePtr++) { 3926 rootChineseCalendar->clear(); 3927 rootChineseCalendar->set(UCAL_ERA, datePtr->era); 3928 rootChineseCalendar->set(datePtr->year, datePtr->month-1, datePtr->day); 3929 rootChineseCalendar->set(UCAL_IS_LEAP_MONTH, datePtr->isLeapMonth); 3930 UnicodeString result; 3931 FieldPosition fpos(0); 3932 dmft->format(*rootChineseCalendar, result, fpos); 3933 if ( result.compare(itemPtr->dateString[idate]) != 0 ) { 3934 errln( UnicodeString("FAIL: Chinese calendar format for locale ") + UnicodeString(itemPtr->locale) + ", style " + itemPtr->style + 3935 ", expected \"" + itemPtr->dateString[idate] + "\", got \"" + result + "\""); 3936 } else { 3937 // formatted OK, try parse 3938 ParsePosition ppos(0); 3939 // ensure we are really parsing the fields we should be 3940 rootChineseCalendar->set(UCAL_YEAR, 1); 3941 rootChineseCalendar->set(UCAL_MONTH, 0); 3942 rootChineseCalendar->set(UCAL_IS_LEAP_MONTH, 0); 3943 rootChineseCalendar->set(UCAL_DATE, 1); 3944 // 3945 dmft->parse(result, *rootChineseCalendar, ppos); 3946 int32_t year = rootChineseCalendar->get(UCAL_YEAR, status); 3947 int32_t month = rootChineseCalendar->get(UCAL_MONTH, status) + 1; 3948 int32_t isLeapMonth = rootChineseCalendar->get(UCAL_IS_LEAP_MONTH, status); 3949 int32_t day = rootChineseCalendar->get(UCAL_DATE, status); 3950 if ( ppos.getIndex() < result.length() || year != datePtr->year || month != datePtr->month || isLeapMonth != datePtr->isLeapMonth || day != datePtr->day ) { 3951 errln( UnicodeString("FAIL: Chinese calendar parse for locale ") + UnicodeString(itemPtr->locale) + ", style " + itemPtr->style + 3952 ", string \"" + result + "\", expected " + datePtr->year +"-"+datePtr->month+"("+datePtr->isLeapMonth+")-"+datePtr->day + ", got pos " + 3953 ppos.getIndex() + " " + year +"-"+month+"("+isLeapMonth+")-"+day); 3954 } 3955 } 3956 } 3957 } else { 3958 dataerrln("Error creating SimpleDateFormat for Chinese calendar- %s", u_errorName(status)); 3959 } 3960 delete dmft; 3961 } else { 3962 dataerrln("FAIL: Unable to create DateFormat for Chinese calendar- %s", u_errorName(status)); 3963 } 3964 } 3965 delete rootChineseCalendar; 3966 } else { 3967 errln(UnicodeString("FAIL: Unable to create Calendar for root@calendar=chinese")); 3968 } 3969 } 3970 3971 typedef struct { 3972 const char * locale; 3973 UnicodeString pattern; 3974 UDisplayContext capitalizationContext; 3975 UnicodeString expectedFormat; 3976 } TestContextItem; 3977 3978 void DateFormatTest::TestContext() 3979 { 3980 const UDate july022008 = 1215000001979.0; 3981 const TestContextItem items[] = { 3982 //locale pattern capitalizationContext expected formatted date 3983 { "fr", UnicodeString("MMMM y"), UDISPCTX_CAPITALIZATION_NONE, UnicodeString("juillet 2008") }, 3984 #if !UCONFIG_NO_BREAK_ITERATION 3985 { "fr", UnicodeString("MMMM y"), UDISPCTX_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE, UnicodeString("juillet 2008") }, 3986 { "fr", UnicodeString("MMMM y"), UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE, UnicodeString("Juillet 2008") }, 3987 { "fr", UnicodeString("MMMM y"), UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU, UnicodeString("juillet 2008") }, 3988 { "fr", UnicodeString("MMMM y"), UDISPCTX_CAPITALIZATION_FOR_STANDALONE, UnicodeString("Juillet 2008") }, 3989 #endif 3990 { "cs", UnicodeString("LLLL y"), UDISPCTX_CAPITALIZATION_NONE, CharsToUnicodeString("\\u010Dervenec 2008") }, 3991 #if !UCONFIG_NO_BREAK_ITERATION 3992 { "cs", UnicodeString("LLLL y"), UDISPCTX_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE, CharsToUnicodeString("\\u010Dervenec 2008") }, 3993 { "cs", UnicodeString("LLLL y"), UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE, CharsToUnicodeString("\\u010Cervenec 2008") }, 3994 { "cs", UnicodeString("LLLL y"), UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU, CharsToUnicodeString("\\u010Cervenec 2008") }, 3995 { "cs", UnicodeString("LLLL y"), UDISPCTX_CAPITALIZATION_FOR_STANDALONE, CharsToUnicodeString("\\u010Dervenec 2008") }, 3996 #endif 3997 // terminator 3998 { NULL, UnicodeString(""), (UDisplayContext)0, UnicodeString("") } 3999 }; 4000 UErrorCode status = U_ZERO_ERROR; 4001 Calendar* cal = Calendar::createInstance(status); 4002 if (U_FAILURE(status)) { 4003 dataerrln(UnicodeString("FAIL: Unable to create Calendar for default timezone and locale.")); 4004 } else { 4005 cal->setTime(july022008, status); 4006 const TestContextItem * itemPtr; 4007 for (itemPtr = items; itemPtr->locale != NULL; itemPtr++ ) { 4008 Locale locale = Locale::createFromName(itemPtr->locale); 4009 status = U_ZERO_ERROR; 4010 SimpleDateFormat * sdmft = new SimpleDateFormat(itemPtr->pattern, locale, status); 4011 if (U_FAILURE(status)) { 4012 dataerrln(UnicodeString("FAIL: Unable to create SimpleDateFormat for specified pattern with locale ") + UnicodeString(itemPtr->locale)); 4013 } else { 4014 sdmft->setContext(itemPtr->capitalizationContext, status); 4015 UnicodeString result; 4016 FieldPosition pos(0); 4017 sdmft->format(*cal, result, pos); 4018 if (result.compare(itemPtr->expectedFormat) != 0) { 4019 errln(UnicodeString("FAIL: format for locale ") + UnicodeString(itemPtr->locale) + 4020 ", status " + (int)status + 4021 ", capitalizationContext " + (int)itemPtr->capitalizationContext + 4022 ", expected " + itemPtr->expectedFormat + ", got " + result); 4023 } 4024 } 4025 if (sdmft) { 4026 delete sdmft; 4027 } 4028 } 4029 } 4030 if (cal) { 4031 delete cal; 4032 } 4033 } 4034 4035 // test item for a particular locale + calendar and date format 4036 typedef struct { 4037 int32_t year; 4038 int32_t month; 4039 int32_t day; 4040 int32_t hour; 4041 int32_t minute; 4042 UnicodeString formattedDate; 4043 } CalAndFmtTestItem; 4044 4045 // test item giving locale + calendar, date format, and CalAndFmtTestItems 4046 typedef struct { 4047 const char * locale; // with calendar 4048 DateFormat::EStyle style; 4049 const CalAndFmtTestItem *caftItems; 4050 } TestNonGregoItem; 4051 4052 void DateFormatTest::TestNonGregoFmtParse() 4053 { 4054 // test items for he@calendar=hebrew, long date format 4055 const CalAndFmtTestItem cafti_he_hebrew_long[] = { 4056 { 4999, 12, 29, 12, 0, CharsToUnicodeString("\\u05DB\\u05F4\\u05D8 \\u05D1\\u05D0\\u05DC\\u05D5\\u05DC \\u05D3\\u05F3\\u05EA\\u05EA\\u05E7\\u05E6\\u05F4\\u05D8") }, 4057 { 5100, 0, 1, 12, 0, CharsToUnicodeString("\\u05D0\\u05F3 \\u05D1\\u05EA\\u05E9\\u05E8\\u05D9 \\u05E7\\u05F3") }, 4058 { 5774, 5, 1, 12, 0, CharsToUnicodeString("\\u05D0\\u05F3 \\u05D1\\u05D0\\u05D3\\u05E8 \\u05D0\\u05F3 \\u05EA\\u05E9\\u05E2\\u05F4\\u05D3") }, 4059 { 5999, 12, 29, 12, 0, CharsToUnicodeString("\\u05DB\\u05F4\\u05D8 \\u05D1\\u05D0\\u05DC\\u05D5\\u05DC \\u05EA\\u05EA\\u05E7\\u05E6\\u05F4\\u05D8") }, 4060 { 6100, 0, 1, 12, 0, CharsToUnicodeString("\\u05D0\\u05F3 \\u05D1\\u05EA\\u05E9\\u05E8\\u05D9 \\u05D5\\u05F3\\u05E7\\u05F3") }, 4061 { 0, 0, 0, 0, 0, UnicodeString("") } // terminator 4062 }; 4063 // overal test items 4064 const TestNonGregoItem items[] = { 4065 { "he@calendar=hebrew", DateFormat::kLong, cafti_he_hebrew_long }, 4066 { NULL, DateFormat::kNone, NULL } // terminator 4067 }; 4068 const TestNonGregoItem * itemPtr; 4069 for (itemPtr = items; itemPtr->locale != NULL; itemPtr++) { 4070 Locale locale = Locale::createFromName(itemPtr->locale); 4071 DateFormat * dfmt = DateFormat::createDateInstance(itemPtr->style, locale); 4072 if (dfmt == NULL) { 4073 dataerrln("DateFormat::createDateInstance fails for locale %s", itemPtr->locale); 4074 } else { 4075 Calendar * cal = (dfmt->getCalendar())->clone(); 4076 if (cal == NULL) { 4077 dataerrln("(DateFormat::getCalendar)->clone() fails for locale %s", itemPtr->locale); 4078 } else { 4079 const CalAndFmtTestItem * caftItemPtr; 4080 for (caftItemPtr = itemPtr->caftItems; caftItemPtr->year != 0; caftItemPtr++) { 4081 cal->clear(); 4082 cal->set(UCAL_YEAR, caftItemPtr->year); 4083 cal->set(UCAL_MONTH, caftItemPtr->month); 4084 cal->set(UCAL_DATE, caftItemPtr->day); 4085 cal->set(UCAL_HOUR_OF_DAY, caftItemPtr->hour); 4086 cal->set(UCAL_MINUTE, caftItemPtr->minute); 4087 UnicodeString result; 4088 FieldPosition fpos(0); 4089 dfmt->format(*cal, result, fpos); 4090 if ( result.compare(caftItemPtr->formattedDate) != 0 ) { 4091 errln( UnicodeString("FAIL: date format for locale ") + UnicodeString(itemPtr->locale) + ", style " + itemPtr->style + 4092 ", expected \"" + caftItemPtr->formattedDate + "\", got \"" + result + "\""); 4093 } else { 4094 // formatted OK, try parse 4095 ParsePosition ppos(0); 4096 dfmt->parse(result, *cal, ppos); 4097 UErrorCode status = U_ZERO_ERROR; 4098 int32_t year = cal->get(UCAL_YEAR, status); 4099 int32_t month = cal->get(UCAL_MONTH, status); 4100 int32_t day = cal->get(UCAL_DATE, status); 4101 if ( U_FAILURE(status) || ppos.getIndex() < result.length() || year != caftItemPtr->year || month != caftItemPtr->month || day != caftItemPtr->day ) { 4102 errln( UnicodeString("FAIL: date parse for locale ") + UnicodeString(itemPtr->locale) + ", style " + itemPtr->style + 4103 ", string \"" + result + "\", expected " + caftItemPtr->year +"-"+caftItemPtr->month+"-"+caftItemPtr->day + ", got pos " + 4104 ppos.getIndex() + " " + year +"-"+month+"-"+day + " status " + UnicodeString(u_errorName(status)) ); 4105 } 4106 } 4107 } 4108 delete cal; 4109 } 4110 delete dfmt; 4111 } 4112 } 4113 } 4114 4115 static const UDate TEST_DATE = 1326585600000.; // 2012-jan-15 4116 4117 void DateFormatTest::TestDotAndAtLeniency() { 4118 // Test for date/time parsing regression with CLDR 22.1/ICU 50 pattern strings. 4119 // For details see http://bugs.icu-project.org/trac/ticket/9789 4120 static const char *locales[] = { "en", "fr" }; 4121 for (int32_t i = 0; i < LENGTHOF(locales); ++i) { 4122 Locale locale(locales[i]); 4123 4124 for (DateFormat::EStyle dateStyle = DateFormat::FULL; dateStyle <= DateFormat::SHORT; 4125 dateStyle = static_cast<DateFormat::EStyle>(dateStyle + 1)) { 4126 LocalPointer<DateFormat> dateFormat(DateFormat::createDateInstance(dateStyle, locale)); 4127 4128 for (DateFormat::EStyle timeStyle = DateFormat::FULL; timeStyle <= DateFormat::SHORT; 4129 timeStyle = static_cast<DateFormat::EStyle>(timeStyle + 1)) { 4130 LocalPointer<DateFormat> format(DateFormat::createDateTimeInstance(dateStyle, timeStyle, locale)); 4131 LocalPointer<DateFormat> timeFormat(DateFormat::createTimeInstance(timeStyle, locale)); 4132 UnicodeString formattedString; 4133 if (format.isNull()) { 4134 dataerrln("Unable to create DateFormat"); 4135 continue; 4136 } 4137 format->format(TEST_DATE, formattedString); 4138 4139 if (!showParse(*format, formattedString)) { 4140 errln(UnicodeString(" with date-time: dateStyle=") + dateStyle + " timeStyle=" + timeStyle); 4141 } 4142 4143 UnicodeString ds, ts; 4144 formattedString = dateFormat->format(TEST_DATE, ds) + " " + timeFormat->format(TEST_DATE, ts); 4145 if (!showParse(*format, formattedString)) { 4146 errln(UnicodeString(" with date sp sp time: dateStyle=") + dateStyle + " timeStyle=" + timeStyle); 4147 } 4148 if (formattedString.indexOf("n ") >= 0) { // will add "." after the end of text ending in 'n', like Jan. 4149 UnicodeString plusDot(formattedString); 4150 plusDot.findAndReplace("n ", "n. ").append("."); 4151 if (!showParse(*format, plusDot)) { 4152 errln(UnicodeString(" with date plus-dot time: dateStyle=") + dateStyle + " timeStyle=" + timeStyle); 4153 } 4154 } 4155 if (formattedString.indexOf(". ") >= 0) { // will subtract "." at the end of strings. 4156 UnicodeString minusDot(formattedString); 4157 minusDot.findAndReplace(". ", " "); 4158 if (!showParse(*format, minusDot)) { 4159 errln(UnicodeString(" with date minus-dot time: dateStyle=") + dateStyle + " timeStyle=" + timeStyle); 4160 } 4161 } 4162 } 4163 } 4164 } 4165 } 4166 4167 UBool DateFormatTest::showParse(DateFormat &format, const UnicodeString &formattedString) { 4168 ParsePosition parsePosition; 4169 UDate parsed = format.parse(formattedString, parsePosition); 4170 UBool ok = TEST_DATE == parsed && parsePosition.getIndex() == formattedString.length(); 4171 UnicodeString pattern; 4172 static_cast<SimpleDateFormat &>(format).toPattern(pattern); 4173 if (ok) { 4174 logln(pattern + " parsed: " + formattedString); 4175 } else { 4176 errln(pattern + " fails to parse: " + formattedString); 4177 } 4178 return ok; 4179 } 4180 4181 #endif /* #if !UCONFIG_NO_FORMATTING */ 4182 4183 //eof 4184