1 /********************************************************************
2 * COPYRIGHT:
3 * Copyright (c) 1997-2007, International Business Machines Corporation and
4 * 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/timezone.h"
13 #include "unicode/gregocal.h"
14 #include "unicode/smpdtfmt.h"
15 #include "unicode/datefmt.h"
16 #include "unicode/simpletz.h"
17 #include "unicode/strenum.h"
18 #include "unicode/dtfmtsym.h"
19 #include "cmemory.h"
20 #include "cstring.h"
21 #include "caltest.h" // for fieldName
22 #include <stdio.h> // for sprintf
23
24 #ifdef U_WINDOWS
25 #include "windttst.h"
26 #endif
27
28 #define ARRAY_SIZE(array) (sizeof array / sizeof array[0])
29
30 #define ASSERT_OK(status) if(U_FAILURE(status)) {errln(#status " = %s @ %s:%d", u_errorName(status), __FILE__, __LINE__); return; }
31
32 //--------------------------------------------------------------------
33 // Time bomb - allows temporary behavior that expires at a given
34 // release
35 //--------------------------------------------------------------------
36 static const UVersionInfo ICU_39 = {3,9,0,0};
37
38 // *****************************************************************************
39 // class DateFormatTest
40 // *****************************************************************************
41
runIndexedTest(int32_t index,UBool exec,const char * & name,char *)42 void DateFormatTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
43 {
44 // if (exec) logln((UnicodeString)"TestSuite DateFormatTest");
45 switch (index) {
46 TESTCASE(0,TestEquals);
47 TESTCASE(1,TestTwoDigitYearDSTParse);
48 TESTCASE(2,TestFieldPosition);
49 TESTCASE(3,TestPartialParse994);
50 TESTCASE(4,TestRunTogetherPattern985);
51 TESTCASE(5,TestRunTogetherPattern917);
52 TESTCASE(6,TestCzechMonths459);
53 TESTCASE(7,TestLetterDPattern212);
54 TESTCASE(8,TestDayOfYearPattern195);
55 TESTCASE(9,TestQuotePattern161);
56 TESTCASE(10,TestBadInput135);
57 TESTCASE(11,TestBadInput135a);
58 TESTCASE(12,TestTwoDigitYear);
59 TESTCASE(13,TestDateFormatZone061);
60 TESTCASE(14,TestDateFormatZone146);
61 TESTCASE(15,TestLocaleDateFormat);
62 TESTCASE(16,TestWallyWedel);
63 TESTCASE(17,TestDateFormatCalendar);
64 TESTCASE(18,TestSpaceParsing);
65 TESTCASE(19,TestExactCountFormat);
66 TESTCASE(20,TestWhiteSpaceParsing);
67 TESTCASE(21,TestInvalidPattern);
68 TESTCASE(22,TestGeneral);
69 TESTCASE(23,TestGreekMay);
70 TESTCASE(24,TestGenericTime);
71 TESTCASE(25,TestGenericTimeZoneOrder);
72 TESTCASE(26,TestHost);
73 TESTCASE(27,TestEras);
74 TESTCASE(28,TestNarrowNames);
75 TESTCASE(29,TestStandAloneDays);
76 TESTCASE(30,TestStandAloneMonths);
77 TESTCASE(31,TestQuarters);
78 TESTCASE(32,TestZTimeZoneParsing);
79 TESTCASE(33,TestRelative);
80 TESTCASE(34,TestRelativeClone);
81 TESTCASE(35,TestHostClone);
82 TESTCASE(36,TestTimeZoneDisplayName);
83 /*
84 TESTCASE(37,TestRelativeError);
85 TESTCASE(38,TestRelativeOther);
86 */
87 default: name = ""; break;
88 }
89 }
90
91 // Test written by Wally Wedel and emailed to me.
TestWallyWedel()92 void DateFormatTest::TestWallyWedel()
93 {
94 UErrorCode status = U_ZERO_ERROR;
95 /*
96 * Instantiate a TimeZone so we can get the ids.
97 */
98 TimeZone *tz = new SimpleTimeZone(7,"");
99 /*
100 * Computational variables.
101 */
102 int32_t offset, hours, minutes, seconds;
103 /*
104 * Instantiate a SimpleDateFormat set up to produce a full time
105 zone name.
106 */
107 SimpleDateFormat *sdf = new SimpleDateFormat((UnicodeString)"zzzz", status);
108 /*
109 * A String array for the time zone ids.
110 */
111 int32_t ids_length;
112 StringEnumeration* ids = TimeZone::createEnumeration();
113 ids_length = ids->count(status);
114 /*
115 * How many ids do we have?
116 */
117 logln("Time Zone IDs size: %d", ids_length);
118 /*
119 * Column headings (sort of)
120 */
121 logln("Ordinal ID offset(h:m) name");
122 /*
123 * Loop through the tzs.
124 */
125 UDate today = Calendar::getNow();
126 Calendar *cal = Calendar::createInstance(status);
127 for (int32_t i = 0; i < ids_length; i++) {
128 // logln(i + " " + ids[i]);
129 const UnicodeString* id = ids->snext(status);
130 TimeZone *ttz = TimeZone::createTimeZone(*id);
131 // offset = ttz.getRawOffset();
132 cal->setTimeZone(*ttz);
133 cal->setTime(today, status);
134 offset = cal->get(UCAL_ZONE_OFFSET, status) + cal->get(UCAL_DST_OFFSET, status);
135 // logln(i + " " + ids[i] + " offset " + offset);
136 const char* sign = "+";
137 if (offset < 0) {
138 sign = "-";
139 offset = -offset;
140 }
141 hours = offset/3600000;
142 minutes = (offset%3600000)/60000;
143 seconds = (offset%60000)/1000;
144 UnicodeString dstOffset = (UnicodeString)"" + sign + (hours < 10 ? "0" : "") +
145 (int32_t)hours + ":" + (minutes < 10 ? "0" : "") + (int32_t)minutes;
146 if (seconds != 0) {
147 dstOffset = dstOffset + ":" + (seconds < 10 ? "0" : "") + seconds;
148 }
149 /*
150 * Instantiate a date so we can display the time zone name.
151 */
152 sdf->setTimeZone(*ttz);
153 /*
154 * Format the output.
155 */
156 UnicodeString fmtOffset;
157 FieldPosition pos(0);
158 sdf->format(today,fmtOffset, pos);
159 // UnicodeString fmtOffset = tzS.toString();
160 UnicodeString *fmtDstOffset = 0;
161 if (fmtOffset.startsWith("GMT"))
162 {
163 //fmtDstOffset = fmtOffset->substring(3);
164 fmtDstOffset = new UnicodeString();
165 fmtOffset.extract(3, fmtOffset.length(), *fmtDstOffset);
166 }
167 /*
168 * Show our result.
169 */
170 UBool ok = fmtDstOffset == 0 || *fmtDstOffset == dstOffset;
171 if (ok)
172 {
173 logln(UnicodeString() + i + " " + *id + " " + dstOffset +
174 " " + fmtOffset +
175 (fmtDstOffset != 0 ? " ok" : " ?"));
176 }
177 else
178 {
179 errln(UnicodeString() + i + " " + *id + " " + dstOffset +
180 " " + fmtOffset + " *** FAIL ***");
181 }
182 delete ttz;
183 delete fmtDstOffset;
184 }
185 delete cal;
186 // delete ids; // TODO: BAD API
187 delete ids;
188 delete sdf;
189 delete tz;
190 }
191
192 // -------------------------------------
193
194 /**
195 * Test operator==
196 */
197 void
TestEquals()198 DateFormatTest::TestEquals()
199 {
200 DateFormat* fmtA = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::FULL);
201 DateFormat* fmtB = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::FULL);
202 if ( fmtA == NULL || fmtB == NULL){
203 dataerrln("Error calling DateFormat::createDateTimeInstance");
204 delete fmtA;
205 delete fmtB;
206 return;
207 }
208
209 if (!(*fmtA == *fmtB)) errln((UnicodeString)"FAIL");
210 delete fmtA;
211 delete fmtB;
212
213 TimeZone* test = TimeZone::createTimeZone("PDT");
214 delete test;
215 }
216
217 // -------------------------------------
218
219 /**
220 * Test the parsing of 2-digit years.
221 */
222 void
TestTwoDigitYearDSTParse(void)223 DateFormatTest::TestTwoDigitYearDSTParse(void)
224 {
225 UErrorCode status = U_ZERO_ERROR;
226 SimpleDateFormat* fullFmt = new SimpleDateFormat((UnicodeString)"EEE MMM dd HH:mm:ss.SSS zzz yyyy G", status);
227 SimpleDateFormat *fmt = new SimpleDateFormat((UnicodeString)"dd-MMM-yy h:mm:ss 'o''clock' a z", Locale::getEnglish(), status);
228 //DateFormat* fmt = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::FULL, Locale::ENGLISH);
229 UnicodeString* s = new UnicodeString("03-Apr-04 2:20:47 o'clock AM PST", "");
230 TimeZone* defaultTZ = TimeZone::createDefault();
231 TimeZone* PST = TimeZone::createTimeZone("PST");
232 int32_t defaultOffset = defaultTZ->getRawOffset();
233 int32_t PSTOffset = PST->getRawOffset();
234 int32_t hour = 2 + (defaultOffset - PSTOffset) / (60*60*1000);
235 // hour is the expected hour of day, in units of seconds
236 hour = ((hour < 0) ? hour + 24 : hour) * 60*60;
237
238 UnicodeString str;
239
240 if(U_FAILURE(status)) {
241 errln("Could not set up test. exitting");
242 return;
243 }
244
245 UDate d = fmt->parse(*s, status);
246 logln(*s + " P> " + ((DateFormat*)fullFmt)->format(d, str));
247 int32_t y, m, day, hr, min, sec;
248 dateToFields(d, y, m, day, hr, min, sec);
249 hour += defaultTZ->inDaylightTime(d, status) ? 1 : 0;
250 hr = hr*60*60;
251 if (hr != hour)
252 errln((UnicodeString)"FAIL: Should parse to hour " + hour + " but got " + hr);
253
254 if (U_FAILURE(status))
255 errln((UnicodeString)"FAIL: " + (int32_t)status);
256
257 delete s;
258 delete fmt;
259 delete fullFmt;
260 delete PST;
261 delete defaultTZ;
262 }
263
264 // -------------------------------------
265
toHexString(int32_t i)266 UChar toHexString(int32_t i) { return (UChar)(i + (i < 10 ? 0x30 : (0x41 - 10))); }
267
268 UnicodeString&
escape(UnicodeString & s)269 DateFormatTest::escape(UnicodeString& s)
270 {
271 UnicodeString buf;
272 for (int32_t i=0; i<s.length(); ++i)
273 {
274 UChar c = s[(int32_t)i];
275 if (c <= (UChar)0x7F) buf += c;
276 else {
277 buf += (UChar)0x5c; buf += (UChar)0x55;
278 buf += toHexString((c & 0xF000) >> 12);
279 buf += toHexString((c & 0x0F00) >> 8);
280 buf += toHexString((c & 0x00F0) >> 4);
281 buf += toHexString(c & 0x000F);
282 }
283 }
284 return (s = buf);
285 }
286
287 // -------------------------------------
288
289 /**
290 * This MUST be kept in sync with DateFormatSymbols.gPatternChars.
291 */
292 static const char* PATTERN_CHARS = "GyMdkHmsSEDFwWahKzYeugAZvcLQqV";
293
294 /**
295 * A list of the names of all the fields in DateFormat.
296 * This MUST be kept in sync with DateFormat.
297 */
298 static const char* DATEFORMAT_FIELD_NAMES[] = {
299 "ERA_FIELD",
300 "YEAR_FIELD",
301 "MONTH_FIELD",
302 "DATE_FIELD",
303 "HOUR_OF_DAY1_FIELD",
304 "HOUR_OF_DAY0_FIELD",
305 "MINUTE_FIELD",
306 "SECOND_FIELD",
307 "MILLISECOND_FIELD",
308 "DAY_OF_WEEK_FIELD",
309 "DAY_OF_YEAR_FIELD",
310 "DAY_OF_WEEK_IN_MONTH_FIELD",
311 "WEEK_OF_YEAR_FIELD",
312 "WEEK_OF_MONTH_FIELD",
313 "AM_PM_FIELD",
314 "HOUR1_FIELD",
315 "HOUR0_FIELD",
316 "TIMEZONE_FIELD",
317 "YEAR_WOY_FIELD",
318 "DOW_LOCAL_FIELD",
319 "EXTENDED_YEAR_FIELD",
320 "JULIAN_DAY_FIELD",
321 "MILLISECONDS_IN_DAY_FIELD",
322 "TIMEZONE_RFC_FIELD",
323 "GENERIC_TIMEZONE_FIELD",
324 "STAND_ALONE_DAY_FIELD",
325 "STAND_ALONE_MONTH_FIELD",
326 "QUARTER_FIELD",
327 "STAND_ALONE_QUARTER_FIELD",
328 "TIMEZONE_SPECIAL_FIELD"
329 };
330
331 static const int32_t DATEFORMAT_FIELD_NAMES_LENGTH =
332 sizeof(DATEFORMAT_FIELD_NAMES) / sizeof(DATEFORMAT_FIELD_NAMES[0]);
333
334 /**
335 * Verify that returned field position indices are correct.
336 */
TestFieldPosition()337 void DateFormatTest::TestFieldPosition() {
338 UErrorCode ec = U_ZERO_ERROR;
339 int32_t i, j, exp;
340 UnicodeString buf;
341
342 // Verify data
343 DateFormatSymbols rootSyms(Locale(""), ec);
344 assertSuccess("DateFormatSymbols", ec);
345
346 // local pattern chars data is not longer loaded
347 // from icu locale bundle
348 assertEquals("patternChars", PATTERN_CHARS, rootSyms.getLocalPatternChars(buf));
349 assertEquals("patternChars", PATTERN_CHARS, DateFormatSymbols::getPatternUChars());
350 assertTrue("DATEFORMAT_FIELD_NAMES", DATEFORMAT_FIELD_NAMES_LENGTH == UDAT_FIELD_COUNT);
351 assertTrue("Data", UDAT_FIELD_COUNT == uprv_strlen(PATTERN_CHARS));
352
353 // Create test formatters
354 const int32_t COUNT = 4;
355 DateFormat* dateFormats[COUNT];
356 dateFormats[0] = DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, Locale::getUS());
357 dateFormats[1] = DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, Locale::getFrance());
358 // Make the pattern "G y M d..."
359 buf.remove().append(PATTERN_CHARS);
360 for (j=buf.length()-1; j>=0; --j) buf.insert(j, (UChar)32/*' '*/);
361 dateFormats[2] = new SimpleDateFormat(buf, Locale::getUS(), ec);
362 // Make the pattern "GGGG yyyy MMMM dddd..."
363 for (j=buf.length()-1; j>=0; j-=2) {
364 for (i=0; i<3; ++i) {
365 buf.insert(j, buf.charAt(j));
366 }
367 }
368 dateFormats[3] = new SimpleDateFormat(buf, Locale::getUS(), ec);
369 if(U_FAILURE(ec)){
370 errln(UnicodeString("Could not create SimpleDateFormat object for locale en_US. Error: " )+ UnicodeString(u_errorName(ec)));
371 return;
372 }
373 UDate aug13 = 871508052513.0;
374
375 // Expected output field values for above DateFormats on aug13
376 // Fields are given in order of DateFormat field number
377 const char* EXPECTED[] = {
378 "", "1997", "August", "13", "", "", "34", "12", "",
379 "Wednesday", "", "", "", "", "PM", "2", "", "", "", "", "", "", "", "", "PT", "", "", "", "","",
380
381 "", "1997", "ao\\u00FBt", "13", "", "14", "34", "12", "",
382 "mercredi", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "\\u00C9tats-Unis (Los Angeles)", "", "", "", "", "",
383
384 "AD", "1997", "8", "13", "14", "14", "34", "12", "5",
385 "Wed", "225", "2", "33", "3", "PM", "2", "2", "PDT", "1997", "4", "1997", "2450674", "52452513", "-0700", "PT", "4", "8", "3", "3","PDT",
386
387 "Anno Domini", "1997", "August", "0013", "0014", "0014", "0034", "0012", "5130",
388 "Wednesday", "0225", "0002", "0033", "0003", "PM", "0002", "0002", "Pacific Daylight Time", "1997", "0004", "1997", "2450674", "52452513", "GMT-07:00",
389 "Pacific Time", "Wednesday", "August", "3rd quarter", "3rd quarter", "United States (Los Angeles)"
390 };
391
392 const int32_t EXPECTED_LENGTH = sizeof(EXPECTED)/sizeof(EXPECTED[0]);
393
394 assertTrue("data size", EXPECTED_LENGTH == COUNT * UDAT_FIELD_COUNT);
395
396 TimeZone* PT = TimeZone::createTimeZone("America/Los_Angeles");
397 for (j = 0, exp = 0; j < COUNT; ++j) {
398 // String str;
399 DateFormat* df = dateFormats[j];
400 df->setTimeZone(*PT);
401 if (df->getDynamicClassID() == SimpleDateFormat::getStaticClassID()) {
402 logln(" Pattern = " + ((SimpleDateFormat*) df)->toPattern(buf.remove()));
403 } else {
404 logln(" Pattern = ? (not a SimpleDateFormat)");
405 }
406 logln((UnicodeString)" Result = " + df->format(aug13, buf.remove()));
407
408 for (i = 0; i < UDAT_FIELD_COUNT; ++i, ++exp) {
409 FieldPosition pos(i);
410 buf.remove();
411 df->format(aug13, buf, pos);
412 UnicodeString field;
413 buf.extractBetween(pos.getBeginIndex(), pos.getEndIndex(), field);
414 assertEquals((UnicodeString)"field #" + i + " " + DATEFORMAT_FIELD_NAMES[i],
415 ctou(EXPECTED[exp]), field);
416 }
417 }
418
419 for (i=0; i<COUNT; ++i) {
420 delete dateFormats[i];
421 }
422 delete PT;
423 }
424
425 // -------------------------------------
426
427 /**
428 * General parse/format tests. Add test cases as needed.
429 */
TestGeneral()430 void DateFormatTest::TestGeneral() {
431 const char* DATA[] = {
432 "yyyy MM dd HH:mm:ss.SSS",
433
434 // Milliseconds are left-justified, since they format as fractions of a second
435 "y/M/d H:mm:ss.S", "fp", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.6", "2004 03 10 16:36:31.600",
436 "y/M/d H:mm:ss.SS", "fp", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.57", "2004 03 10 16:36:31.570",
437 "y/M/d H:mm:ss.SSS", "F", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.567",
438 "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",
439 };
440 expect(DATA, ARRAY_SIZE(DATA), Locale("en", "", ""));
441 }
442
443 // -------------------------------------
444
445 /**
446 * Verify that strings which contain incomplete specifications are parsed
447 * correctly. In some instances, this means not being parsed at all, and
448 * returning an appropriate error.
449 */
450 void
TestPartialParse994()451 DateFormatTest::TestPartialParse994()
452 {
453 UErrorCode status = U_ZERO_ERROR;
454 SimpleDateFormat* f = new SimpleDateFormat(status);
455 ASSERT_OK(status);
456 UDate null = 0;
457 tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17 10:11:42", date(97, 1 - 1, 17, 10, 11, 42));
458 tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17 10:", null);
459 tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17 10", null);
460 tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17 ", null);
461 tryPat994(f, "yy/MM/dd HH:mm:ss", "97/01/17", null);
462 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
463 delete f;
464 }
465
466 // -------------------------------------
467
468 void
tryPat994(SimpleDateFormat * format,const char * pat,const char * str,UDate expected)469 DateFormatTest::tryPat994(SimpleDateFormat* format, const char* pat, const char* str, UDate expected)
470 {
471 UErrorCode status = U_ZERO_ERROR;
472 UDate null = 0;
473 logln(UnicodeString("Pattern \"") + pat + "\" String \"" + str + "\"");
474 //try {
475 format->applyPattern(pat);
476 UDate date = format->parse(str, status);
477 if (U_FAILURE(status) || date == null)
478 {
479 logln((UnicodeString)"ParseException: " + (int32_t)status);
480 if (expected != null) errln((UnicodeString)"FAIL: Expected " + dateToString(expected));
481 }
482 else
483 {
484 UnicodeString f;
485 ((DateFormat*)format)->format(date, f);
486 logln(UnicodeString(" parse(") + str + ") -> " + dateToString(date));
487 logln((UnicodeString)" format -> " + f);
488 if (expected == null ||
489 !(date == expected)) errln((UnicodeString)"FAIL: Expected null");//" + expected);
490 if (!(f == str)) errln(UnicodeString("FAIL: Expected ") + str);
491 }
492 //}
493 //catch(ParseException e) {
494 // logln((UnicodeString)"ParseException: " + e.getMessage());
495 // if (expected != null) errln((UnicodeString)"FAIL: Expected " + dateToString(expected));
496 //}
497 //catch(Exception e) {
498 // errln((UnicodeString)"*** Exception:");
499 // e.printStackTrace();
500 //}
501 }
502
503 // -------------------------------------
504
505 /**
506 * Verify the behavior of patterns in which digits for different fields run together
507 * without intervening separators.
508 */
509 void
TestRunTogetherPattern985()510 DateFormatTest::TestRunTogetherPattern985()
511 {
512 UErrorCode status = U_ZERO_ERROR;
513 UnicodeString format("yyyyMMddHHmmssSSS");
514 UnicodeString now, then;
515 //UBool flag;
516 SimpleDateFormat *formatter = new SimpleDateFormat(format, status);
517 ASSERT_OK(status);
518 UDate date1 = Calendar::getNow();
519 ((DateFormat*)formatter)->format(date1, now);
520 logln(now);
521 ParsePosition pos(0);
522 UDate date2 = formatter->parse(now, pos);
523 if (date2 == 0) then = "Parse stopped at " + pos.getIndex();
524 else ((DateFormat*)formatter)->format(date2, then);
525 logln(then);
526 if (!(date2 == date1)) errln((UnicodeString)"FAIL");
527 delete formatter;
528 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
529 }
530
531 // -------------------------------------
532
533 /**
534 * Verify the behavior of patterns in which digits for different fields run together
535 * without intervening separators.
536 */
537 void
TestRunTogetherPattern917()538 DateFormatTest::TestRunTogetherPattern917()
539 {
540 UErrorCode status = U_ZERO_ERROR;
541 SimpleDateFormat* fmt;
542 UnicodeString myDate;
543 fmt = new SimpleDateFormat((UnicodeString)"yyyy/MM/dd", status);
544 ASSERT_OK(status);
545 myDate = "1997/02/03";
546 testIt917(fmt, myDate, date(97, 2 - 1, 3));
547 delete fmt;
548 fmt = new SimpleDateFormat((UnicodeString)"yyyyMMdd", status);
549 myDate = "19970304";
550 testIt917(fmt, myDate, date(97, 3 - 1, 4));
551 delete fmt;
552 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
553 }
554
555 // -------------------------------------
556
557 void
testIt917(SimpleDateFormat * fmt,UnicodeString & str,UDate expected)558 DateFormatTest::testIt917(SimpleDateFormat* fmt, UnicodeString& str, UDate expected)
559 {
560 UErrorCode status = U_ZERO_ERROR;
561 UnicodeString pattern;
562 logln((UnicodeString)"pattern=" + fmt->toPattern(pattern) + " string=" + str);
563 Formattable o;
564 //try {
565 ((Format*)fmt)->parseObject(str, o, status);
566 //}
567 if (U_FAILURE(status)) return;
568 //catch(ParseException e) {
569 // e.printStackTrace();
570 // return;
571 //}
572 logln((UnicodeString)"Parsed object: " + dateToString(o.getDate()));
573 if (!(o.getDate() == expected)) errln((UnicodeString)"FAIL: Expected " + dateToString(expected));
574 UnicodeString formatted; ((Format*)fmt)->format(o, formatted, status);
575 logln((UnicodeString)"Formatted string: " + formatted);
576 if (!(formatted == str)) errln((UnicodeString)"FAIL: Expected " + str);
577 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
578 }
579
580 // -------------------------------------
581
582 /**
583 * Verify the handling of Czech June and July, which have the unique attribute that
584 * one is a proper prefix substring of the other.
585 */
586 void
TestCzechMonths459()587 DateFormatTest::TestCzechMonths459()
588 {
589 UErrorCode status = U_ZERO_ERROR;
590 DateFormat* fmt = DateFormat::createDateInstance(DateFormat::FULL, Locale("cs", "", ""));
591 if (fmt == NULL){
592 dataerrln("Error calling DateFormat::createDateInstance()");
593 return;
594 }
595
596 UnicodeString pattern;
597 logln((UnicodeString)"Pattern " + ((SimpleDateFormat*) fmt)->toPattern(pattern));
598 UDate june = date(97, UCAL_JUNE, 15);
599 UDate july = date(97, UCAL_JULY, 15);
600 UnicodeString juneStr; fmt->format(june, juneStr);
601 UnicodeString julyStr; fmt->format(july, julyStr);
602 //try {
603 logln((UnicodeString)"format(June 15 1997) = " + juneStr);
604 UDate d = fmt->parse(juneStr, status);
605 UnicodeString s; fmt->format(d, s);
606 int32_t month,yr,day,hr,min,sec; dateToFields(d,yr,month,day,hr,min,sec);
607 logln((UnicodeString)" -> parse -> " + s + " (month = " + month + ")");
608 if (month != UCAL_JUNE) errln((UnicodeString)"FAIL: Month should be June");
609 logln((UnicodeString)"format(July 15 1997) = " + julyStr);
610 d = fmt->parse(julyStr, status);
611 fmt->format(d, s);
612 dateToFields(d,yr,month,day,hr,min,sec);
613 logln((UnicodeString)" -> parse -> " + s + " (month = " + month + ")");
614 if (month != UCAL_JULY) errln((UnicodeString)"FAIL: Month should be July");
615 //}
616 //catch(ParseException e) {
617 if (U_FAILURE(status))
618 errln((UnicodeString)"Exception: " + (int32_t)status);
619 //}
620 delete fmt;
621 }
622
623 // -------------------------------------
624
625 /**
626 * Test the handling of 'D' in patterns.
627 */
628 void
TestLetterDPattern212()629 DateFormatTest::TestLetterDPattern212()
630 {
631 UErrorCode status = U_ZERO_ERROR;
632 UnicodeString dateString("1995-040.05:01:29");
633 UnicodeString bigD("yyyy-DDD.hh:mm:ss");
634 UnicodeString littleD("yyyy-ddd.hh:mm:ss");
635 UDate expLittleD = date(95, 0, 1, 5, 1, 29);
636 UDate expBigD = expLittleD + 39 * 24 * 3600000.0;
637 expLittleD = expBigD; // Expect the same, with default lenient parsing
638 logln((UnicodeString)"dateString= " + dateString);
639 SimpleDateFormat *formatter = new SimpleDateFormat(bigD, status);
640 ASSERT_OK(status);
641 ParsePosition pos(0);
642 UDate myDate = formatter->parse(dateString, pos);
643 logln((UnicodeString)"Using " + bigD + " -> " + myDate);
644 if (myDate != expBigD) errln((UnicodeString)"FAIL: Expected " + dateToString(expBigD));
645 delete formatter;
646 formatter = new SimpleDateFormat(littleD, status);
647 ASSERT_OK(status);
648 pos = ParsePosition(0);
649 myDate = formatter->parse(dateString, pos);
650 logln((UnicodeString)"Using " + littleD + " -> " + dateToString(myDate));
651 if (myDate != expLittleD) errln((UnicodeString)"FAIL: Expected " + dateToString(expLittleD));
652 delete formatter;
653 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
654 }
655
656 // -------------------------------------
657
658 /**
659 * Test the day of year pattern.
660 */
661 void
TestDayOfYearPattern195()662 DateFormatTest::TestDayOfYearPattern195()
663 {
664 UErrorCode status = U_ZERO_ERROR;
665 UDate today = Calendar::getNow();
666 int32_t year,month,day,hour,min,sec; dateToFields(today,year,month,day,hour,min,sec);
667 UDate expected = date(year, month, day);
668 logln((UnicodeString)"Test Date: " + dateToString(today));
669 SimpleDateFormat* sdf = (SimpleDateFormat*)DateFormat::createDateInstance();
670 if (sdf == NULL){
671 dataerrln("Error calling DateFormat::createDateInstance()");
672 return;
673 }
674 tryPattern(*sdf, today, 0, expected);
675 tryPattern(*sdf, today, "G yyyy DDD", expected);
676 delete sdf;
677 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
678 }
679
680 // -------------------------------------
681
682 void
tryPattern(SimpleDateFormat & sdf,UDate d,const char * pattern,UDate expected)683 DateFormatTest::tryPattern(SimpleDateFormat& sdf, UDate d, const char* pattern, UDate expected)
684 {
685 UErrorCode status = U_ZERO_ERROR;
686 if (pattern != 0) sdf.applyPattern(pattern);
687 UnicodeString thePat;
688 logln((UnicodeString)"pattern: " + sdf.toPattern(thePat));
689 UnicodeString formatResult; (*(DateFormat*)&sdf).format(d, formatResult);
690 logln((UnicodeString)" format -> " + formatResult);
691 // try {
692 UDate d2 = sdf.parse(formatResult, status);
693 logln((UnicodeString)" parse(" + formatResult + ") -> " + dateToString(d2));
694 if (d2 != expected) errln((UnicodeString)"FAIL: Expected " + dateToString(expected));
695 UnicodeString format2; (*(DateFormat*)&sdf).format(d2, format2);
696 logln((UnicodeString)" format -> " + format2);
697 if (!(formatResult == format2)) errln((UnicodeString)"FAIL: Round trip drift");
698 //}
699 //catch(Exception e) {
700 if (U_FAILURE(status))
701 errln((UnicodeString)"Error: " + (int32_t)status);
702 //}
703 }
704
705 // -------------------------------------
706
707 /**
708 * Test the handling of single quotes in patterns.
709 */
710 void
TestQuotePattern161()711 DateFormatTest::TestQuotePattern161()
712 {
713 UErrorCode status = U_ZERO_ERROR;
714 SimpleDateFormat* formatter = new SimpleDateFormat((UnicodeString)"MM/dd/yyyy 'at' hh:mm:ss a zzz", status);
715 ASSERT_OK(status);
716 UDate currentTime_1 = date(97, UCAL_AUGUST, 13, 10, 42, 28);
717 UnicodeString dateString; ((DateFormat*)formatter)->format(currentTime_1, dateString);
718 UnicodeString exp("08/13/1997 at 10:42:28 AM ");
719 logln((UnicodeString)"format(" + dateToString(currentTime_1) + ") = " + dateString);
720 if (0 != dateString.compareBetween(0, exp.length(), exp, 0, exp.length())) errln((UnicodeString)"FAIL: Expected " + exp);
721 delete formatter;
722 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
723 }
724
725 // -------------------------------------
726
727 /**
728 * Verify the correct behavior when handling invalid input strings.
729 */
730 void
TestBadInput135()731 DateFormatTest::TestBadInput135()
732 {
733 UErrorCode status = U_ZERO_ERROR;
734 DateFormat::EStyle looks[] = {
735 DateFormat::SHORT, DateFormat::MEDIUM, DateFormat::LONG, DateFormat::FULL
736 };
737 int32_t looks_length = (int32_t)(sizeof(looks) / sizeof(looks[0]));
738 const char* strings[] = {
739 "Mar 15", "Mar 15 1997", "asdf", "3/1/97 1:23:", "3/1/00 1:23:45 AM"
740 };
741 int32_t strings_length = (int32_t)(sizeof(strings) / sizeof(strings[0]));
742 DateFormat *full = DateFormat::createDateTimeInstance(DateFormat::LONG, DateFormat::LONG);
743 if(full==NULL) {
744 errln("could not create date time instance");
745 return;
746 }
747 UnicodeString expected("March 1, 2000 1:23:45 AM ");
748 for (int32_t i = 0; i < strings_length;++i) {
749 const char* text = strings[i];
750 for (int32_t j = 0; j < looks_length;++j) {
751 DateFormat::EStyle dateLook = looks[j];
752 for (int32_t k = 0; k < looks_length;++k) {
753 DateFormat::EStyle timeLook = looks[k];
754 DateFormat *df = DateFormat::createDateTimeInstance(dateLook, timeLook);
755 if (df == NULL){
756 dataerrln("Error calling DateFormat::createDateTimeInstance()");
757 continue;
758 }
759 UnicodeString prefix = UnicodeString(text) + ", " + dateLook + "/" + timeLook + ": ";
760 //try {
761 UDate when = df->parse(text, status);
762 if (when == 0 && U_SUCCESS(status)) {
763 errln(prefix + "SHOULD NOT HAPPEN: parse returned 0.");
764 continue;
765 }
766 if (U_SUCCESS(status))
767 {
768 UnicodeString format;
769 full->format(when, format);
770 logln(prefix + "OK: " + format);
771 if (0!=format.compareBetween(0, expected.length(), expected, 0, expected.length()))
772 errln((UnicodeString)"FAIL: Expected " + expected + " got " + format);
773 }
774 //}
775 //catch(ParseException e) {
776 else
777 status = U_ZERO_ERROR;
778 //}
779 //catch(StringIndexOutOfBoundsException e) {
780 // errln(prefix + "SHOULD NOT HAPPEN: " + (int)status);
781 //}
782 delete df;
783 }
784 }
785 }
786 delete full;
787 if (U_FAILURE(status))
788 errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
789 }
790
791 static const char* const parseFormats[] = {
792 "MMMM d, yyyy",
793 "MMMM d yyyy",
794 "M/d/yy",
795 "d MMMM, yyyy",
796 "d MMMM yyyy",
797 "d MMMM",
798 "MMMM d",
799 "yyyy",
800 "h:mm a MMMM d, yyyy"
801 };
802
803 static const char* const inputStrings[] = {
804 "bogus string", 0, 0, 0, 0, 0, 0, 0, 0, 0,
805 "April 1, 1997", "April 1, 1997", 0, 0, 0, 0, 0, "April 1", 0, 0,
806 "Jan 1, 1970", "January 1, 1970", 0, 0, 0, 0, 0, "January 1", 0, 0,
807 "Jan 1 2037", 0, "January 1 2037", 0, 0, 0, 0, "January 1", 0, 0,
808 "1/1/70", 0, 0, "1/1/70", 0, 0, 0, 0, "0001", 0,
809 "5 May 1997", 0, 0, 0, 0, "5 May 1997", "5 May", 0, "0005", 0,
810 "16 May", 0, 0, 0, 0, 0, "16 May", 0, "0016", 0,
811 "April 30", 0, 0, 0, 0, 0, 0, "April 30", 0, 0,
812 "1998", 0, 0, 0, 0, 0, 0, 0, "1998", 0,
813 "1", 0, 0, 0, 0, 0, 0, 0, "0001", 0,
814 "3:00 pm Jan 1, 1997", 0, 0, 0, 0, 0, 0, 0, "0003", "3:00 PM January 1, 1997",
815 };
816
817 // -------------------------------------
818
819 /**
820 * Verify the correct behavior when parsing an array of inputs against an
821 * array of patterns, with known results. The results are encoded after
822 * the input strings in each row.
823 */
824 void
TestBadInput135a()825 DateFormatTest::TestBadInput135a()
826 {
827 UErrorCode status = U_ZERO_ERROR;
828 SimpleDateFormat* dateParse = new SimpleDateFormat(status);
829 if(U_FAILURE(status)) {
830 errln("Failed creating SimpleDateFormat with %s. Quitting test", u_errorName(status));
831 delete dateParse;
832 return;
833 }
834 const char* s;
835 UDate date;
836 const uint32_t PF_LENGTH = (int32_t)(sizeof(parseFormats)/sizeof(parseFormats[0]));
837 const uint32_t INPUT_LENGTH = (int32_t)(sizeof(inputStrings)/sizeof(inputStrings[0]));
838
839 dateParse->applyPattern("d MMMM, yyyy");
840 dateParse->adoptTimeZone(TimeZone::createDefault());
841 s = "not parseable";
842 UnicodeString thePat;
843 logln(UnicodeString("Trying to parse \"") + s + "\" with " + dateParse->toPattern(thePat));
844 //try {
845 date = dateParse->parse(s, status);
846 if (U_SUCCESS(status))
847 errln((UnicodeString)"FAIL: Expected exception during parse");
848 //}
849 //catch(Exception ex) {
850 else
851 logln((UnicodeString)"Exception during parse: " + (int32_t)status);
852 status = U_ZERO_ERROR;
853 //}
854 for (uint32_t i = 0; i < INPUT_LENGTH; i += (PF_LENGTH + 1)) {
855 ParsePosition parsePosition(0);
856 UnicodeString s( inputStrings[i]);
857 for (uint32_t index = 0; index < PF_LENGTH;++index) {
858 const char* expected = inputStrings[i + 1 + index];
859 dateParse->applyPattern(parseFormats[index]);
860 dateParse->adoptTimeZone(TimeZone::createDefault());
861 //try {
862 parsePosition.setIndex(0);
863 date = dateParse->parse(s, parsePosition);
864 if (parsePosition.getIndex() != 0) {
865 UnicodeString s1, s2;
866 s.extract(0, parsePosition.getIndex(), s1);
867 s.extract(parsePosition.getIndex(), s.length(), s2);
868 if (date == 0) {
869 errln((UnicodeString)"ERROR: null result fmt=\"" +
870 parseFormats[index] +
871 "\" pos=" + parsePosition.getIndex() + " " +
872 s1 + "|" + s2);
873 }
874 else {
875 UnicodeString result;
876 ((DateFormat*)dateParse)->format(date, result);
877 logln((UnicodeString)"Parsed \"" + s + "\" using \"" + dateParse->toPattern(thePat) + "\" to: " + result);
878 if (expected == 0)
879 errln((UnicodeString)"FAIL: Expected parse failure");
880 else if (!(result == expected))
881 errln(UnicodeString("FAIL: Expected ") + expected);
882 }
883 }
884 else if (expected != 0) {
885 errln(UnicodeString("FAIL: Expected ") + expected + " from \"" +
886 s + "\" with \"" + dateParse->toPattern(thePat) + "\"");
887 }
888 //}
889 //catch(Exception ex) {
890 if (U_FAILURE(status))
891 errln((UnicodeString)"An exception was thrown during parse: " + (int32_t)status);
892 //}
893 }
894 }
895 delete dateParse;
896 if (U_FAILURE(status))
897 errln((UnicodeString)"FAIL: UErrorCode received during test: " + (int32_t)status);
898 }
899
900 // -------------------------------------
901
902 /**
903 * Test the parsing of two-digit years.
904 */
905 void
TestTwoDigitYear()906 DateFormatTest::TestTwoDigitYear()
907 {
908 UErrorCode ec = U_ZERO_ERROR;
909 SimpleDateFormat fmt("dd/MM/yy", Locale::getUK(), ec);
910 if (U_FAILURE(ec)) {
911 errln("FAIL: SimpleDateFormat constructor");
912 return;
913 }
914 parse2DigitYear(fmt, "5/6/17", date(117, UCAL_JUNE, 5));
915 parse2DigitYear(fmt, "4/6/34", date(34, UCAL_JUNE, 4));
916 }
917
918 // -------------------------------------
919
920 void
parse2DigitYear(DateFormat & fmt,const char * str,UDate expected)921 DateFormatTest::parse2DigitYear(DateFormat& fmt, const char* str, UDate expected)
922 {
923 UErrorCode status = U_ZERO_ERROR;
924 //try {
925 UDate d = fmt.parse(str, status);
926 UnicodeString thePat;
927 logln(UnicodeString("Parsing \"") + str + "\" with " + ((SimpleDateFormat*)&fmt)->toPattern(thePat) +
928 " => " + dateToString(d));
929 if (d != expected) errln((UnicodeString)"FAIL: Expected " + expected);
930 //}
931 //catch(ParseException e) {
932 if (U_FAILURE(status))
933 errln((UnicodeString)"FAIL: Got exception");
934 //}
935 }
936
937 // -------------------------------------
938
939 /**
940 * Test the formatting of time zones.
941 */
942 void
TestDateFormatZone061()943 DateFormatTest::TestDateFormatZone061()
944 {
945 UErrorCode status = U_ZERO_ERROR;
946 UDate date;
947 DateFormat *formatter;
948 date= 859248000000.0;
949 logln((UnicodeString)"Date 1997/3/25 00:00 GMT: " + date);
950 formatter = new SimpleDateFormat((UnicodeString)"dd-MMM-yyyyy HH:mm", Locale::getUK(), status);
951 if(U_FAILURE(status)) {
952 errln("Failed creating SimpleDateFormat with %s. Quitting test", u_errorName(status));
953 delete formatter;
954 return;
955 }
956 formatter->adoptTimeZone(TimeZone::createTimeZone("GMT"));
957 UnicodeString temp; formatter->format(date, temp);
958 logln((UnicodeString)"Formatted in GMT to: " + temp);
959 //try {
960 UDate tempDate = formatter->parse(temp, status);
961 logln((UnicodeString)"Parsed to: " + dateToString(tempDate));
962 if (tempDate != date) errln((UnicodeString)"FAIL: Expected " + dateToString(date));
963 //}
964 //catch(Throwable t) {
965 if (U_FAILURE(status))
966 errln((UnicodeString)"Date Formatter throws: " + (int32_t)status);
967 //}
968 delete formatter;
969 }
970
971 // -------------------------------------
972
973 /**
974 * Test the formatting of time zones.
975 */
976 void
TestDateFormatZone146()977 DateFormatTest::TestDateFormatZone146()
978 {
979 TimeZone *saveDefault = TimeZone::createDefault();
980
981 //try {
982 TimeZone *thedefault = TimeZone::createTimeZone("GMT");
983 TimeZone::setDefault(*thedefault);
984 // java.util.Locale.setDefault(new java.util.Locale("ar", "", ""));
985
986 // check to be sure... its GMT all right
987 TimeZone *testdefault = TimeZone::createDefault();
988 UnicodeString testtimezone;
989 testdefault->getID(testtimezone);
990 if (testtimezone == "GMT")
991 logln("Test timezone = " + testtimezone);
992 else
993 errln("Test timezone should be GMT, not " + testtimezone);
994
995 UErrorCode status = U_ZERO_ERROR;
996 // now try to use the default GMT time zone
997 GregorianCalendar *greenwichcalendar =
998 new GregorianCalendar(1997, 3, 4, 23, 0, status);
999 failure(status, "new GregorianCalendar");
1000 //*****************************greenwichcalendar.setTimeZone(TimeZone.getDefault());
1001 //greenwichcalendar.set(1997, 3, 4, 23, 0);
1002 // try anything to set hour to 23:00 !!!
1003 greenwichcalendar->set(UCAL_HOUR_OF_DAY, 23);
1004 // get time
1005 UDate greenwichdate = greenwichcalendar->getTime(status);
1006 // format every way
1007 UnicodeString DATA [] = {
1008 UnicodeString("simple format: "), UnicodeString("04/04/97 23:00 GMT+00:00"),
1009 UnicodeString("MM/dd/yy HH:mm z"),
1010 UnicodeString("full format: "), UnicodeString("Friday, April 4, 1997 11:00:00 o'clock PM GMT+00:00"),
1011 UnicodeString("EEEE, MMMM d, yyyy h:mm:ss 'o''clock' a z"),
1012 UnicodeString("long format: "), UnicodeString("April 4, 1997 11:00:00 PM GMT+00:00"),
1013 UnicodeString("MMMM d, yyyy h:mm:ss a z"),
1014 UnicodeString("default format: "), UnicodeString("04-Apr-97 11:00:00 PM"),
1015 UnicodeString("dd-MMM-yy h:mm:ss a"),
1016 UnicodeString("short format: "), UnicodeString("4/4/97 11:00 PM"),
1017 UnicodeString("M/d/yy h:mm a")
1018 };
1019 int32_t DATA_length = (int32_t)(sizeof(DATA) / sizeof(DATA[0]));
1020
1021 for (int32_t i=0; i<DATA_length; i+=3) {
1022 DateFormat *fmt = new SimpleDateFormat(DATA[i+2], Locale::getEnglish(), status);
1023 if(failure(status, "new SimpleDateFormat")) break;
1024 fmt->setCalendar(*greenwichcalendar);
1025 UnicodeString result;
1026 result = fmt->format(greenwichdate, result);
1027 logln(DATA[i] + result);
1028 if (result != DATA[i+1])
1029 errln("FAIL: Expected " + DATA[i+1] + ", got " + result);
1030 delete fmt;
1031 }
1032 //}
1033 //finally {
1034 TimeZone::adoptDefault(saveDefault);
1035 //}
1036 delete testdefault;
1037 delete greenwichcalendar;
1038 delete thedefault;
1039
1040
1041 }
1042
1043 // -------------------------------------
1044
1045 /**
1046 * Test the formatting of dates in different locales.
1047 */
1048 void
TestLocaleDateFormat()1049 DateFormatTest::TestLocaleDateFormat() // Bug 495
1050 {
1051 UDate testDate = date(97, UCAL_SEPTEMBER, 15);
1052 DateFormat *dfFrench = DateFormat::createDateTimeInstance(DateFormat::FULL,
1053 DateFormat::FULL, Locale::getFrench());
1054 DateFormat *dfUS = DateFormat::createDateTimeInstance(DateFormat::FULL,
1055 DateFormat::FULL, Locale::getUS());
1056 UnicodeString expectedFRENCH ( "lundi 15 septembre 1997 00:00:00 \\u00C9tats-Unis (Los Angeles)" );
1057 expectedFRENCH = expectedFRENCH.unescape();
1058 //UnicodeString expectedUS ( "Monday, September 15, 1997 12:00:00 o'clock AM PDT" );
1059 UnicodeString expectedUS ( "Monday, September 15, 1997 12:00:00 AM PT" );
1060 logln((UnicodeString)"Date set to : " + dateToString(testDate));
1061 UnicodeString out;
1062 if (dfUS == NULL || dfFrench == NULL){
1063 dataerrln("Error calling DateFormat::createDateTimeInstance)");
1064 delete dfUS;
1065 delete dfFrench;
1066 return;
1067 }
1068
1069 dfFrench->format(testDate, out);
1070 logln((UnicodeString)"Date Formated with French Locale " + out);
1071 if (!(out == expectedFRENCH))
1072 errln((UnicodeString)"FAIL: Expected " + expectedFRENCH);
1073 out.truncate(0);
1074 dfUS->format(testDate, out);
1075 logln((UnicodeString)"Date Formated with US Locale " + out);
1076 if (!(out == expectedUS))
1077 errln((UnicodeString)"FAIL: Expected " + expectedUS);
1078 delete dfUS;
1079 delete dfFrench;
1080 }
1081
1082 /**
1083 * Test DateFormat(Calendar) API
1084 */
TestDateFormatCalendar()1085 void DateFormatTest::TestDateFormatCalendar() {
1086 DateFormat *date=0, *time=0, *full=0;
1087 Calendar *cal=0;
1088 UnicodeString str;
1089 ParsePosition pos;
1090 UDate when;
1091 UErrorCode ec = U_ZERO_ERROR;
1092
1093 /* Create a formatter for date fields. */
1094 date = DateFormat::createDateInstance(DateFormat::kShort, Locale::getUS());
1095 if (date == NULL) {
1096 errln("FAIL: createDateInstance failed");
1097 goto FAIL;
1098 }
1099
1100 /* Create a formatter for time fields. */
1101 time = DateFormat::createTimeInstance(DateFormat::kShort, Locale::getUS());
1102 if (time == NULL) {
1103 errln("FAIL: createTimeInstance failed");
1104 goto FAIL;
1105 }
1106
1107 /* Create a full format for output */
1108 full = DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull,
1109 Locale::getUS());
1110 if (full == NULL) {
1111 errln("FAIL: createInstance failed");
1112 goto FAIL;
1113 }
1114
1115 /* Create a calendar */
1116 cal = Calendar::createInstance(Locale::getUS(), ec);
1117 if (cal == NULL || U_FAILURE(ec)) {
1118 errln((UnicodeString)"FAIL: Calendar::createInstance failed with " +
1119 u_errorName(ec));
1120 goto FAIL;
1121 }
1122
1123 /* Parse the date */
1124 cal->clear();
1125 str = UnicodeString("4/5/2001", "");
1126 pos.setIndex(0);
1127 date->parse(str, *cal, pos);
1128 if (pos.getIndex() != str.length()) {
1129 errln((UnicodeString)"FAIL: DateFormat::parse(4/5/2001) failed at " +
1130 pos.getIndex());
1131 goto FAIL;
1132 }
1133
1134 /* Parse the time */
1135 str = UnicodeString("5:45 PM", "");
1136 pos.setIndex(0);
1137 time->parse(str, *cal, pos);
1138 if (pos.getIndex() != str.length()) {
1139 errln((UnicodeString)"FAIL: DateFormat::parse(17:45) failed at " +
1140 pos.getIndex());
1141 goto FAIL;
1142 }
1143
1144 /* Check result */
1145 when = cal->getTime(ec);
1146 if (U_FAILURE(ec)) {
1147 errln((UnicodeString)"FAIL: cal->getTime() failed with " + u_errorName(ec));
1148 goto FAIL;
1149 }
1150 str.truncate(0);
1151 full->format(when, str);
1152 // Thursday, April 5, 2001 5:45:00 PM PDT 986517900000
1153 if (when == 986517900000.0) {
1154 logln("Ok: Parsed result: " + str);
1155 } else {
1156 errln("FAIL: Parsed result: " + str + ", exp 4/5/2001 5:45 PM");
1157 }
1158
1159 FAIL:
1160 delete date;
1161 delete time;
1162 delete full;
1163 delete cal;
1164 }
1165
1166 /**
1167 * Test DateFormat's parsing of space characters. See jitterbug 1916.
1168 */
TestSpaceParsing()1169 void DateFormatTest::TestSpaceParsing() {
1170 const char* DATA[] = {
1171 "yyyy MM dd HH:mm:ss",
1172
1173 // pattern, input, expected parse or NULL if expect parse failure
1174 "MMMM d yy", " 04 05 06", NULL, // MMMM wants Apr/April
1175 NULL, "04 05 06", NULL,
1176 "MM d yy", " 04 05 06", "2006 04 05 00:00:00",
1177 NULL, "04 05 06", "2006 04 05 00:00:00",
1178 "MMMM d yy", " Apr 05 06", "2006 04 05 00:00:00",
1179 NULL, "Apr 05 06", "2006 04 05 00:00:00",
1180 };
1181 const int32_t DATA_len = sizeof(DATA)/sizeof(DATA[0]);
1182
1183 expectParse(DATA, DATA_len, Locale("en"));
1184 }
1185
1186 /**
1187 * Test handling of "HHmmss" pattern.
1188 */
TestExactCountFormat()1189 void DateFormatTest::TestExactCountFormat() {
1190 const char* DATA[] = {
1191 "yyyy MM dd HH:mm:ss",
1192
1193 // pattern, input, expected parse or NULL if expect parse failure
1194 "HHmmss", "123456", "1970 01 01 12:34:56",
1195 NULL, "12345", "1970 01 01 01:23:45",
1196 NULL, "1234", NULL,
1197 NULL, "00-05", NULL,
1198 NULL, "12-34", NULL,
1199 NULL, "00+05", NULL,
1200 "ahhmm", "PM730", "1970 01 01 19:30:00",
1201 };
1202 const int32_t DATA_len = sizeof(DATA)/sizeof(DATA[0]);
1203
1204 expectParse(DATA, DATA_len, Locale("en"));
1205 }
1206
1207 /**
1208 * Test handling of white space.
1209 */
TestWhiteSpaceParsing()1210 void DateFormatTest::TestWhiteSpaceParsing() {
1211 const char* DATA[] = {
1212 "yyyy MM dd",
1213
1214 // pattern, input, expected parse or null if expect parse failure
1215
1216 // Pattern space run should parse input text space run
1217 "MM d yy", " 04 01 03", "2003 04 01",
1218 NULL, " 04 01 03 ", "2003 04 01",
1219 };
1220 const int32_t DATA_len = sizeof(DATA)/sizeof(DATA[0]);
1221
1222 expectParse(DATA, DATA_len, Locale("en"));
1223 }
1224
1225
TestInvalidPattern()1226 void DateFormatTest::TestInvalidPattern() {
1227 UErrorCode ec = U_ZERO_ERROR;
1228 SimpleDateFormat f(UnicodeString("Yesterday"), ec);
1229 ASSERT_OK(ec);
1230 UnicodeString out;
1231 FieldPosition pos;
1232 f.format((UDate)0, out, pos);
1233 logln(out);
1234 // The bug is that the call to format() will crash. By not
1235 // crashing, the test passes.
1236 }
1237
TestGreekMay()1238 void DateFormatTest::TestGreekMay() {
1239 UErrorCode ec = U_ZERO_ERROR;
1240 UDate date = -9896080848000.0;
1241 SimpleDateFormat fmt("EEEE, dd MMMM yyyy h:mm:ss a", Locale("el", "", ""), ec);
1242 if (!assertSuccess("SimpleDateFormat::ct", ec)) return;
1243 UnicodeString str;
1244 fmt.format(date, str);
1245 ParsePosition pos(0);
1246 UDate d2 = fmt.parse(str, pos);
1247 if (date != d2) {
1248 errln("FAIL: unable to parse strings where case-folding changes length");
1249 }
1250 }
1251
TestStandAloneMonths()1252 void DateFormatTest::TestStandAloneMonths()
1253 {
1254 const char *EN_DATA[] = {
1255 "yyyy MM dd HH:mm:ss",
1256
1257 "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",
1258 "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",
1259 "yyyy LLLL dd H:mm:ss", "F", "2004 03 10 16:36:31", "2004 March 10 16:36:31",
1260 "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",
1261
1262 "LLLL", "fp", "1970 01 01 0:00:00", "January", "1970 01 01 0:00:00",
1263 "LLLL", "fp", "1970 02 01 0:00:00", "February", "1970 02 01 0:00:00",
1264 "LLLL", "fp", "1970 03 01 0:00:00", "March", "1970 03 01 0:00:00",
1265 "LLLL", "fp", "1970 04 01 0:00:00", "April", "1970 04 01 0:00:00",
1266 "LLLL", "fp", "1970 05 01 0:00:00", "May", "1970 05 01 0:00:00",
1267 "LLLL", "fp", "1970 06 01 0:00:00", "June", "1970 06 01 0:00:00",
1268 "LLLL", "fp", "1970 07 01 0:00:00", "July", "1970 07 01 0:00:00",
1269 "LLLL", "fp", "1970 08 01 0:00:00", "August", "1970 08 01 0:00:00",
1270 "LLLL", "fp", "1970 09 01 0:00:00", "September", "1970 09 01 0:00:00",
1271 "LLLL", "fp", "1970 10 01 0:00:00", "October", "1970 10 01 0:00:00",
1272 "LLLL", "fp", "1970 11 01 0:00:00", "November", "1970 11 01 0:00:00",
1273 "LLLL", "fp", "1970 12 01 0:00:00", "December", "1970 12 01 0:00:00",
1274
1275 "LLL", "fp", "1970 01 01 0:00:00", "Jan", "1970 01 01 0:00:00",
1276 "LLL", "fp", "1970 02 01 0:00:00", "Feb", "1970 02 01 0:00:00",
1277 "LLL", "fp", "1970 03 01 0:00:00", "Mar", "1970 03 01 0:00:00",
1278 "LLL", "fp", "1970 04 01 0:00:00", "Apr", "1970 04 01 0:00:00",
1279 "LLL", "fp", "1970 05 01 0:00:00", "May", "1970 05 01 0:00:00",
1280 "LLL", "fp", "1970 06 01 0:00:00", "Jun", "1970 06 01 0:00:00",
1281 "LLL", "fp", "1970 07 01 0:00:00", "Jul", "1970 07 01 0:00:00",
1282 "LLL", "fp", "1970 08 01 0:00:00", "Aug", "1970 08 01 0:00:00",
1283 "LLL", "fp", "1970 09 01 0:00:00", "Sep", "1970 09 01 0:00:00",
1284 "LLL", "fp", "1970 10 01 0:00:00", "Oct", "1970 10 01 0:00:00",
1285 "LLL", "fp", "1970 11 01 0:00:00", "Nov", "1970 11 01 0:00:00",
1286 "LLL", "fp", "1970 12 01 0:00:00", "Dec", "1970 12 01 0:00:00",
1287 };
1288
1289 const char *CS_DATA[] = {
1290 "yyyy MM dd HH:mm:ss",
1291
1292 "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",
1293 "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",
1294 "yyyy LLL dd H:mm:ss", "fp", "2004 04 10 16:36:31", "2004 4. 10 16:36:31", "2004 04 10 16:36:31",
1295 "yyyy LLLL dd H:mm:ss", "F", "2004 04 10 16:36:31", "2004 duben 10 16:36:31",
1296 "yyyy MMMM dd H:mm:ss", "F", "2004 04 10 16:36:31", "2004 dubna 10 16:36:31",
1297 "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",
1298 "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",
1299
1300 "LLLL", "fp", "1970 01 01 0:00:00", "leden", "1970 01 01 0:00:00",
1301 "LLLL", "fp", "1970 02 01 0:00:00", "\\u00FAnor", "1970 02 01 0:00:00",
1302 "LLLL", "fp", "1970 03 01 0:00:00", "b\\u0159ezen", "1970 03 01 0:00:00",
1303 "LLLL", "fp", "1970 04 01 0:00:00", "duben", "1970 04 01 0:00:00",
1304 "LLLL", "fp", "1970 05 01 0:00:00", "kv\\u011Bten", "1970 05 01 0:00:00",
1305 "LLLL", "fp", "1970 06 01 0:00:00", "\\u010Derven", "1970 06 01 0:00:00",
1306 "LLLL", "fp", "1970 07 01 0:00:00", "\\u010Dervenec", "1970 07 01 0:00:00",
1307 "LLLL", "fp", "1970 08 01 0:00:00", "srpen", "1970 08 01 0:00:00",
1308 "LLLL", "fp", "1970 09 01 0:00:00", "z\\u00E1\\u0159\\u00ED", "1970 09 01 0:00:00",
1309 "LLLL", "fp", "1970 10 01 0:00:00", "\\u0159\\u00EDjen", "1970 10 01 0:00:00",
1310 "LLLL", "fp", "1970 11 01 0:00:00", "listopad", "1970 11 01 0:00:00",
1311 "LLLL", "fp", "1970 12 01 0:00:00", "prosinec", "1970 12 01 0:00:00",
1312
1313 "LLL", "fp", "1970 01 01 0:00:00", "1.", "1970 01 01 0:00:00",
1314 "LLL", "fp", "1970 02 01 0:00:00", "2.", "1970 02 01 0:00:00",
1315 "LLL", "fp", "1970 03 01 0:00:00", "3.", "1970 03 01 0:00:00",
1316 "LLL", "fp", "1970 04 01 0:00:00", "4.", "1970 04 01 0:00:00",
1317 "LLL", "fp", "1970 05 01 0:00:00", "5.", "1970 05 01 0:00:00",
1318 "LLL", "fp", "1970 06 01 0:00:00", "6.", "1970 06 01 0:00:00",
1319 "LLL", "fp", "1970 07 01 0:00:00", "7.", "1970 07 01 0:00:00",
1320 "LLL", "fp", "1970 08 01 0:00:00", "8.", "1970 08 01 0:00:00",
1321 "LLL", "fp", "1970 09 01 0:00:00", "9.", "1970 09 01 0:00:00",
1322 "LLL", "fp", "1970 10 01 0:00:00", "10.", "1970 10 01 0:00:00",
1323 "LLL", "fp", "1970 11 01 0:00:00", "11.", "1970 11 01 0:00:00",
1324 "LLL", "fp", "1970 12 01 0:00:00", "12.", "1970 12 01 0:00:00",
1325 };
1326
1327 expect(EN_DATA, ARRAY_SIZE(EN_DATA), Locale("en", "", ""));
1328 expect(CS_DATA, ARRAY_SIZE(CS_DATA), Locale("cs", "", ""));
1329 }
1330
TestStandAloneDays()1331 void DateFormatTest::TestStandAloneDays()
1332 {
1333 const char *EN_DATA[] = {
1334 "yyyy MM dd HH:mm:ss",
1335
1336 "cccc", "fp", "1970 01 04 0:00:00", "Sunday", "1970 01 04 0:00:00",
1337 "cccc", "fp", "1970 01 05 0:00:00", "Monday", "1970 01 05 0:00:00",
1338 "cccc", "fp", "1970 01 06 0:00:00", "Tuesday", "1970 01 06 0:00:00",
1339 "cccc", "fp", "1970 01 07 0:00:00", "Wednesday", "1970 01 07 0:00:00",
1340 "cccc", "fp", "1970 01 01 0:00:00", "Thursday", "1970 01 01 0:00:00",
1341 "cccc", "fp", "1970 01 02 0:00:00", "Friday", "1970 01 02 0:00:00",
1342 "cccc", "fp", "1970 01 03 0:00:00", "Saturday", "1970 01 03 0:00:00",
1343
1344 "ccc", "fp", "1970 01 04 0:00:00", "Sun", "1970 01 04 0:00:00",
1345 "ccc", "fp", "1970 01 05 0:00:00", "Mon", "1970 01 05 0:00:00",
1346 "ccc", "fp", "1970 01 06 0:00:00", "Tue", "1970 01 06 0:00:00",
1347 "ccc", "fp", "1970 01 07 0:00:00", "Wed", "1970 01 07 0:00:00",
1348 "ccc", "fp", "1970 01 01 0:00:00", "Thu", "1970 01 01 0:00:00",
1349 "ccc", "fp", "1970 01 02 0:00:00", "Fri", "1970 01 02 0:00:00",
1350 "ccc", "fp", "1970 01 03 0:00:00", "Sat", "1970 01 03 0:00:00",
1351 };
1352
1353 const char *CS_DATA[] = {
1354 "yyyy MM dd HH:mm:ss",
1355
1356 "cccc", "fp", "1970 01 04 0:00:00", "ned\\u011Ble", "1970 01 04 0:00:00",
1357 "cccc", "fp", "1970 01 05 0:00:00", "pond\\u011Bl\\u00ED", "1970 01 05 0:00:00",
1358 "cccc", "fp", "1970 01 06 0:00:00", "\\u00FAter\\u00FD", "1970 01 06 0:00:00",
1359 "cccc", "fp", "1970 01 07 0:00:00", "st\\u0159eda", "1970 01 07 0:00:00",
1360 "cccc", "fp", "1970 01 01 0:00:00", "\\u010Dtvrtek", "1970 01 01 0:00:00",
1361 "cccc", "fp", "1970 01 02 0:00:00", "p\\u00E1tek", "1970 01 02 0:00:00",
1362 "cccc", "fp", "1970 01 03 0:00:00", "sobota", "1970 01 03 0:00:00",
1363
1364 "ccc", "fp", "1970 01 04 0:00:00", "ne", "1970 01 04 0:00:00",
1365 "ccc", "fp", "1970 01 05 0:00:00", "po", "1970 01 05 0:00:00",
1366 "ccc", "fp", "1970 01 06 0:00:00", "\\u00FAt", "1970 01 06 0:00:00",
1367 "ccc", "fp", "1970 01 07 0:00:00", "st", "1970 01 07 0:00:00",
1368 "ccc", "fp", "1970 01 01 0:00:00", "\\u010Dt", "1970 01 01 0:00:00",
1369 "ccc", "fp", "1970 01 02 0:00:00", "p\\u00E1", "1970 01 02 0:00:00",
1370 "ccc", "fp", "1970 01 03 0:00:00", "so", "1970 01 03 0:00:00",
1371 };
1372
1373 expect(EN_DATA, ARRAY_SIZE(EN_DATA), Locale("en", "", ""));
1374 expect(CS_DATA, ARRAY_SIZE(CS_DATA), Locale("cs", "", ""));
1375 }
1376
TestNarrowNames()1377 void DateFormatTest::TestNarrowNames()
1378 {
1379 const char *EN_DATA[] = {
1380 "yyyy MM dd HH:mm:ss",
1381
1382 "yyyy MMMMM dd H:mm:ss", "2004 03 10 16:36:31", "2004 M 10 16:36:31",
1383 "yyyy LLLLL dd H:mm:ss", "2004 03 10 16:36:31", "2004 M 10 16:36:31",
1384
1385 "MMMMM", "1970 01 01 0:00:00", "J",
1386 "MMMMM", "1970 02 01 0:00:00", "F",
1387 "MMMMM", "1970 03 01 0:00:00", "M",
1388 "MMMMM", "1970 04 01 0:00:00", "A",
1389 "MMMMM", "1970 05 01 0:00:00", "M",
1390 "MMMMM", "1970 06 01 0:00:00", "J",
1391 "MMMMM", "1970 07 01 0:00:00", "J",
1392 "MMMMM", "1970 08 01 0:00:00", "A",
1393 "MMMMM", "1970 09 01 0:00:00", "S",
1394 "MMMMM", "1970 10 01 0:00:00", "O",
1395 "MMMMM", "1970 11 01 0:00:00", "N",
1396 "MMMMM", "1970 12 01 0:00:00", "D",
1397
1398 "LLLLL", "1970 01 01 0:00:00", "J",
1399 "LLLLL", "1970 02 01 0:00:00", "F",
1400 "LLLLL", "1970 03 01 0:00:00", "M",
1401 "LLLLL", "1970 04 01 0:00:00", "A",
1402 "LLLLL", "1970 05 01 0:00:00", "M",
1403 "LLLLL", "1970 06 01 0:00:00", "J",
1404 "LLLLL", "1970 07 01 0:00:00", "J",
1405 "LLLLL", "1970 08 01 0:00:00", "A",
1406 "LLLLL", "1970 09 01 0:00:00", "S",
1407 "LLLLL", "1970 10 01 0:00:00", "O",
1408 "LLLLL", "1970 11 01 0:00:00", "N",
1409 "LLLLL", "1970 12 01 0:00:00", "D",
1410
1411 "EEEEE", "1970 01 04 0:00:00", "S",
1412 "EEEEE", "1970 01 05 0:00:00", "M",
1413 "EEEEE", "1970 01 06 0:00:00", "T",
1414 "EEEEE", "1970 01 07 0:00:00", "W",
1415 "EEEEE", "1970 01 01 0:00:00", "T",
1416 "EEEEE", "1970 01 02 0:00:00", "F",
1417 "EEEEE", "1970 01 03 0:00:00", "S",
1418
1419 "ccccc", "1970 01 04 0:00:00", "S",
1420 "ccccc", "1970 01 05 0:00:00", "M",
1421 "ccccc", "1970 01 06 0:00:00", "T",
1422 "ccccc", "1970 01 07 0:00:00", "W",
1423 "ccccc", "1970 01 01 0:00:00", "T",
1424 "ccccc", "1970 01 02 0:00:00", "F",
1425 "ccccc", "1970 01 03 0:00:00", "S",
1426 };
1427
1428 const char *CS_DATA[] = {
1429 "yyyy MM dd HH:mm:ss",
1430
1431 "yyyy LLLLL dd H:mm:ss", "2004 04 10 16:36:31", "2004 d 10 16:36:31",
1432 "yyyy MMMMM dd H:mm:ss", "2004 04 10 16:36:31", "2004 d 10 16:36:31",
1433
1434 "MMMMM", "1970 01 01 0:00:00", "l",
1435 "MMMMM", "1970 02 01 0:00:00", "\\u00FA",
1436 "MMMMM", "1970 03 01 0:00:00", "b",
1437 "MMMMM", "1970 04 01 0:00:00", "d",
1438 "MMMMM", "1970 05 01 0:00:00", "k",
1439 "MMMMM", "1970 06 01 0:00:00", "\\u010D",
1440 "MMMMM", "1970 07 01 0:00:00", "\\u010D",
1441 "MMMMM", "1970 08 01 0:00:00", "s",
1442 "MMMMM", "1970 09 01 0:00:00", "z",
1443 "MMMMM", "1970 10 01 0:00:00", "\\u0159",
1444 "MMMMM", "1970 11 01 0:00:00", "l",
1445 "MMMMM", "1970 12 01 0:00:00", "p",
1446
1447 "LLLLL", "1970 01 01 0:00:00", "l",
1448 "LLLLL", "1970 02 01 0:00:00", "\\u00FA",
1449 "LLLLL", "1970 03 01 0:00:00", "b",
1450 "LLLLL", "1970 04 01 0:00:00", "d",
1451 "LLLLL", "1970 05 01 0:00:00", "k",
1452 "LLLLL", "1970 06 01 0:00:00", "\\u010D",
1453 "LLLLL", "1970 07 01 0:00:00", "\\u010D",
1454 "LLLLL", "1970 08 01 0:00:00", "s",
1455 "LLLLL", "1970 09 01 0:00:00", "z",
1456 "LLLLL", "1970 10 01 0:00:00", "\\u0159",
1457 "LLLLL", "1970 11 01 0:00:00", "l",
1458 "LLLLL", "1970 12 01 0:00:00", "p",
1459
1460 "EEEEE", "1970 01 04 0:00:00", "N",
1461 "EEEEE", "1970 01 05 0:00:00", "P",
1462 "EEEEE", "1970 01 06 0:00:00", "\\u00DA",
1463 "EEEEE", "1970 01 07 0:00:00", "S",
1464 "EEEEE", "1970 01 01 0:00:00", "\\u010C",
1465 "EEEEE", "1970 01 02 0:00:00", "P",
1466 "EEEEE", "1970 01 03 0:00:00", "S",
1467
1468 "ccccc", "1970 01 04 0:00:00", "N",
1469 "ccccc", "1970 01 05 0:00:00", "P",
1470 "ccccc", "1970 01 06 0:00:00", "\\u00DA",
1471 "ccccc", "1970 01 07 0:00:00", "S",
1472 "ccccc", "1970 01 01 0:00:00", "\\u010C",
1473 "ccccc", "1970 01 02 0:00:00", "P",
1474 "ccccc", "1970 01 03 0:00:00", "S",
1475 };
1476
1477 expectFormat(EN_DATA, ARRAY_SIZE(EN_DATA), Locale("en", "", ""));
1478 expectFormat(CS_DATA, ARRAY_SIZE(CS_DATA), Locale("cs", "", ""));
1479 }
1480
TestEras()1481 void DateFormatTest::TestEras()
1482 {
1483 const char *EN_DATA[] = {
1484 "yyyy MM dd",
1485
1486 "MMMM dd yyyy G", "fp", "1951 07 17", "July 17 1951 AD", "1951 07 17",
1487 "MMMM dd yyyy GG", "fp", "1951 07 17", "July 17 1951 AD", "1951 07 17",
1488 "MMMM dd yyyy GGG", "fp", "1951 07 17", "July 17 1951 AD", "1951 07 17",
1489 "MMMM dd yyyy GGGG", "fp", "1951 07 17", "July 17 1951 Anno Domini", "1951 07 17",
1490
1491 "MMMM dd yyyy G", "fp", "-438 07 17", "July 17 0439 BC", "-438 07 17",
1492 "MMMM dd yyyy GG", "fp", "-438 07 17", "July 17 0439 BC", "-438 07 17",
1493 "MMMM dd yyyy GGG", "fp", "-438 07 17", "July 17 0439 BC", "-438 07 17",
1494 "MMMM dd yyyy GGGG", "fp", "-438 07 17", "July 17 0439 Before Christ", "-438 07 17",
1495 };
1496
1497 expect(EN_DATA, ARRAY_SIZE(EN_DATA), Locale("en", "", ""));
1498 }
1499
TestQuarters()1500 void DateFormatTest::TestQuarters()
1501 {
1502 const char *EN_DATA[] = {
1503 "yyyy MM dd",
1504
1505 "Q", "fp", "1970 01 01", "1", "1970 01 01",
1506 "QQ", "fp", "1970 04 01", "02", "1970 04 01",
1507 "QQQ", "fp", "1970 07 01", "Q3", "1970 07 01",
1508 "QQQQ", "fp", "1970 10 01", "4th quarter", "1970 10 01",
1509
1510 "q", "fp", "1970 01 01", "1", "1970 01 01",
1511 "qq", "fp", "1970 04 01", "02", "1970 04 01",
1512 "qqq", "fp", "1970 07 01", "Q3", "1970 07 01",
1513 "qqqq", "fp", "1970 10 01", "4th quarter", "1970 10 01",
1514 };
1515
1516 expect(EN_DATA, ARRAY_SIZE(EN_DATA), Locale("en", "", ""));
1517 }
1518
1519 /**
1520 * Test parsing. Input is an array that starts with the following
1521 * header:
1522 *
1523 * [0] = pattern string to parse [i+2] with
1524 *
1525 * followed by test cases, each of which is 3 array elements:
1526 *
1527 * [i] = pattern, or NULL to reuse prior pattern
1528 * [i+1] = input string
1529 * [i+2] = expected parse result (parsed with pattern [0])
1530 *
1531 * If expect parse failure, then [i+2] should be NULL.
1532 */
expectParse(const char ** data,int32_t data_length,const Locale & loc)1533 void DateFormatTest::expectParse(const char** data, int32_t data_length,
1534 const Locale& loc) {
1535 const UDate FAIL = (UDate) -1;
1536 const UnicodeString FAIL_STR("parse failure");
1537 int32_t i = 0;
1538
1539 UErrorCode ec = U_ZERO_ERROR;
1540 SimpleDateFormat fmt("", loc, ec);
1541 SimpleDateFormat ref(data[i++], loc, ec);
1542 SimpleDateFormat gotfmt("G yyyy MM dd HH:mm:ss z", loc, ec);
1543 if (U_FAILURE(ec)) {
1544 errln("FAIL: SimpleDateFormat constructor");
1545 return;
1546 }
1547
1548 const char* currentPat = NULL;
1549 while (i<data_length) {
1550 const char* pattern = data[i++];
1551 const char* input = data[i++];
1552 const char* expected = data[i++];
1553
1554 ec = U_ZERO_ERROR;
1555 if (pattern != NULL) {
1556 fmt.applyPattern(pattern);
1557 currentPat = pattern;
1558 }
1559 UDate got = fmt.parse(input, ec);
1560 UnicodeString gotstr(FAIL_STR);
1561 if (U_FAILURE(ec)) {
1562 got = FAIL;
1563 } else {
1564 gotstr.remove();
1565 gotfmt.format(got, gotstr);
1566 }
1567
1568 UErrorCode ec2 = U_ZERO_ERROR;
1569 UDate exp = FAIL;
1570 UnicodeString expstr(FAIL_STR);
1571 if (expected != NULL) {
1572 expstr = expected;
1573 exp = ref.parse(expstr, ec2);
1574 if (U_FAILURE(ec2)) {
1575 // This only happens if expected is in wrong format --
1576 // should never happen once test is debugged.
1577 errln("FAIL: Internal test error");
1578 return;
1579 }
1580 }
1581
1582 if (got == exp) {
1583 logln((UnicodeString)"Ok: " + input + " x " +
1584 currentPat + " => " + gotstr);
1585 } else {
1586 errln((UnicodeString)"FAIL: " + input + " x " +
1587 currentPat + " => " + gotstr + ", expected " +
1588 expstr);
1589 }
1590 }
1591 }
1592
1593 /**
1594 * Test formatting and parsing. Input is an array that starts
1595 * with the following header:
1596 *
1597 * [0] = pattern string to parse [i+2] with
1598 *
1599 * followed by test cases, each of which is 3 array elements:
1600 *
1601 * [i] = pattern, or null to reuse prior pattern
1602 * [i+1] = control string, either "fp", "pf", or "F".
1603 * [i+2..] = data strings
1604 *
1605 * The number of data strings depends on the control string.
1606 * Examples:
1607 * 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",
1608 * 'f': Format date [i+2] (as parsed using pattern [0]) and expect string [i+3].
1609 * 'p': Parse string [i+3] and expect date [i+4].
1610 *
1611 * 2. "y/M/d H:mm:ss.SSS", "F", "2004 03 10 16:36:31.567", "2004/3/10 16:36:31.567"
1612 * 'F': Format date [i+2] and expect string [i+3],
1613 * then parse string [i+3] and expect date [i+2].
1614 *
1615 * 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",
1616 * 'p': Parse string [i+2] and expect date [i+3].
1617 * 'f': Format date [i+3] and expect string [i+4].
1618 */
expect(const char ** data,int32_t data_length,const Locale & loc)1619 void DateFormatTest::expect(const char** data, int32_t data_length,
1620 const Locale& loc) {
1621 int32_t i = 0;
1622 UErrorCode ec = U_ZERO_ERROR;
1623 UnicodeString str, str2;
1624 SimpleDateFormat fmt("", loc, ec);
1625 SimpleDateFormat ref(data[i++], loc, ec);
1626 SimpleDateFormat univ("EE G yyyy MM dd HH:mm:ss.SSS z", loc, ec);
1627 if (!assertSuccess("construct SimpleDateFormat", ec)) return;
1628
1629 UnicodeString currentPat;
1630 while (i<data_length) {
1631 const char* pattern = data[i++];
1632 if (pattern != NULL) {
1633 fmt.applyPattern(pattern);
1634 currentPat = pattern;
1635 }
1636
1637 const char* control = data[i++];
1638
1639 if (uprv_strcmp(control, "fp") == 0) {
1640 // 'f'
1641 const char* datestr = data[i++];
1642 const char* string = data[i++];
1643 UDate date = ref.parse(ctou(datestr), ec);
1644 if (!assertSuccess("parse", ec)) return;
1645 assertEquals((UnicodeString)"\"" + currentPat + "\".format(" + datestr + ")",
1646 ctou(string),
1647 fmt.format(date, str.remove()));
1648 // 'p'
1649 datestr = data[i++];
1650 date = ref.parse(ctou(datestr), ec);
1651 if (!assertSuccess("parse", ec)) return;
1652 UDate parsedate = fmt.parse(ctou(string), ec);
1653 if (assertSuccess((UnicodeString)"\"" + currentPat + "\".parse(" + string + ")", ec)) {
1654 assertEquals((UnicodeString)"\"" + currentPat + "\".parse(" + string + ")",
1655 univ.format(date, str.remove()),
1656 univ.format(parsedate, str2.remove()));
1657 }
1658 }
1659
1660 else if (uprv_strcmp(control, "pf") == 0) {
1661 // 'p'
1662 const char* string = data[i++];
1663 const char* datestr = data[i++];
1664 UDate date = ref.parse(ctou(datestr), ec);
1665 if (!assertSuccess("parse", ec)) return;
1666 UDate parsedate = fmt.parse(ctou(string), ec);
1667 if (assertSuccess((UnicodeString)"\"" + currentPat + "\".parse(" + string + ")", ec)) {
1668 assertEquals((UnicodeString)"\"" + currentPat + "\".parse(" + string + ")",
1669 univ.format(date, str.remove()),
1670 univ.format(parsedate, str2.remove()));
1671 }
1672 // 'f'
1673 string = data[i++];
1674 assertEquals((UnicodeString)"\"" + currentPat + "\".format(" + datestr + ")",
1675 ctou(string),
1676 fmt.format(date, str.remove()));
1677 }
1678
1679 else if (uprv_strcmp(control, "F") == 0) {
1680 const char* datestr = data[i++];
1681 const char* string = data[i++];
1682 UDate date = ref.parse(ctou(datestr), ec);
1683 if (!assertSuccess("parse", ec)) return;
1684 assertEquals((UnicodeString)"\"" + currentPat + "\".format(" + datestr + ")",
1685 ctou(string),
1686 fmt.format(date, str.remove()));
1687
1688 UDate parsedate = fmt.parse(string, ec);
1689 if (assertSuccess((UnicodeString)"\"" + currentPat + "\".parse(" + string + ")", ec)) {
1690 assertEquals((UnicodeString)"\"" + currentPat + "\".parse(" + string + ")",
1691 univ.format(date, str.remove()),
1692 univ.format(parsedate, str2.remove()));
1693 }
1694 }
1695
1696 else {
1697 errln((UnicodeString)"FAIL: Invalid control string " + control);
1698 return;
1699 }
1700 }
1701 }
1702
1703 /**
1704 * Test formatting. Input is an array that starts
1705 * with the following header:
1706 *
1707 * [0] = pattern string to parse [i+2] with
1708 *
1709 * followed by test cases, each of which is 3 array elements:
1710 *
1711 * [i] = pattern, or null to reuse prior pattern
1712 * [i+1] = data string a
1713 * [i+2] = data string b
1714 *
1715 * Examples:
1716 * Format date [i+1] and expect string [i+2].
1717 *
1718 * "y/M/d H:mm:ss.SSSS", "2004/3/10 16:36:31.5679", "2004 03 10 16:36:31.567"
1719 */
expectFormat(const char ** data,int32_t data_length,const Locale & loc)1720 void DateFormatTest::expectFormat(const char** data, int32_t data_length,
1721 const Locale& loc) {
1722 int32_t i = 0;
1723 UErrorCode ec = U_ZERO_ERROR;
1724 UnicodeString str, str2;
1725 SimpleDateFormat fmt("", loc, ec);
1726 SimpleDateFormat ref(data[i++], loc, ec);
1727 SimpleDateFormat univ("EE G yyyy MM dd HH:mm:ss.SSS z", loc, ec);
1728 if (!assertSuccess("construct SimpleDateFormat", ec)) return;
1729
1730 UnicodeString currentPat;
1731
1732 while (i<data_length) {
1733 const char* pattern = data[i++];
1734 if (pattern != NULL) {
1735 fmt.applyPattern(pattern);
1736 currentPat = pattern;
1737 }
1738
1739 const char* datestr = data[i++];
1740 const char* string = data[i++];
1741 UDate date = ref.parse(ctou(datestr), ec);
1742 if (!assertSuccess("parse", ec)) return;
1743 assertEquals((UnicodeString)"\"" + currentPat + "\".format(" + datestr + ")",
1744 ctou(string),
1745 fmt.format(date, str.remove()));
1746 }
1747 }
1748
TestGenericTime()1749 void DateFormatTest::TestGenericTime() {
1750 // any zone pattern should parse any zone
1751 const Locale en("en");
1752 const char* ZDATA[] = {
1753 "yyyy MM dd HH:mm zzz",
1754 // round trip
1755 "y/M/d H:mm zzzz", "F", "2004 01 01 01:00 PST", "2004/1/1 1:00 Pacific Standard Time",
1756 "y/M/d H:mm zzz", "F", "2004 01 01 01:00 PST", "2004/1/1 1:00 PST",
1757 "y/M/d H:mm vvvv", "F", "2004 01 01 01:00 PST", "2004/1/1 1:00 Pacific Time",
1758 "y/M/d H:mm v", "F", "2004 01 01 01:00 PST", "2004/1/1 1:00 PT",
1759 // non-generic timezone string influences dst offset even if wrong for date/time
1760 "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",
1761 "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",
1762 "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",
1763 "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",
1764 // generic timezone generates dst offset appropriate for local time
1765 "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",
1766 "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",
1767 "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",
1768 "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",
1769 // daylight savings time transition edge cases.
1770 // time to parse does not really exist, PT interpreted as earlier time
1771 "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",
1772 "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",
1773 "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",
1774 "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",
1775 "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",
1776 "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",
1777 "y/M/d H:mm", "pf", "2005/4/3 2:30", "2005 04 03 03:30 PDT", "2005/4/3 3:30",
1778 // time to parse is ambiguous, PT interpreted as later time
1779 "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",
1780 "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",
1781 "y/M/d H:mm", "pf", "2005/10/30 1:30 PT", "2005 10 30 01:30 PST", "2005/10/30 1:30",
1782
1783 "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",
1784 "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",
1785 "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",
1786 "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",
1787 "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",
1788 "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",
1789 "y/M/d H:mm", "pf", "2004/10/31 1:30", "2004 10 31 01:30 PST", "2004/10/31 1:30",
1790 };
1791 const int32_t ZDATA_length = sizeof(ZDATA)/ sizeof(ZDATA[0]);
1792 expect(ZDATA, ZDATA_length, en);
1793
1794 UErrorCode status = U_ZERO_ERROR;
1795
1796 logln("cross format/parse tests");
1797 UnicodeString basepat("yy/MM/dd H:mm ");
1798 SimpleDateFormat formats[] = {
1799 SimpleDateFormat(basepat + "vvv", en, status),
1800 SimpleDateFormat(basepat + "vvvv", en, status),
1801 SimpleDateFormat(basepat + "zzz", en, status),
1802 SimpleDateFormat(basepat + "zzzz", en, status)
1803 };
1804 ASSERT_OK(status);
1805 const int32_t formats_length = sizeof(formats)/sizeof(formats[0]);
1806
1807 UnicodeString test;
1808 SimpleDateFormat univ("yyyy MM dd HH:mm zzz", en, status);
1809 ASSERT_OK(status);
1810 const UnicodeString times[] = {
1811 "2004 01 02 03:04 PST",
1812 "2004 07 08 09:10 PDT"
1813 };
1814 int32_t times_length = sizeof(times)/sizeof(times[0]);
1815 for (int i = 0; i < times_length; ++i) {
1816 UDate d = univ.parse(times[i], status);
1817 logln(UnicodeString("\ntime: ") + d);
1818 for (int j = 0; j < formats_length; ++j) {
1819 test.remove();
1820 formats[j].format(d, test);
1821 logln("\ntest: '" + test + "'");
1822 for (int k = 0; k < formats_length; ++k) {
1823 UDate t = formats[k].parse(test, status);
1824 if (U_SUCCESS(status)) {
1825 if (d != t) {
1826 errln((UnicodeString)"FAIL: format " + k +
1827 " incorrectly parsed output of format " + j +
1828 " (" + test + "), returned " +
1829 dateToString(t) + " instead of " + dateToString(d));
1830 } else {
1831 logln((UnicodeString)"OK: format " + k + " parsed ok");
1832 }
1833 } else if (status == U_PARSE_ERROR) {
1834 errln((UnicodeString)"FAIL: format " + k +
1835 " could not parse output of format " + j +
1836 " (" + test + ")");
1837 }
1838 }
1839 }
1840 }
1841 }
1842
TestGenericTimeZoneOrder()1843 void DateFormatTest::TestGenericTimeZoneOrder() {
1844 // generic times should parse the same no matter what the placement of the time zone string
1845 // should work for standard and daylight times
1846
1847 const char* XDATA[] = {
1848 "yyyy MM dd HH:mm zzz",
1849 // standard time, explicit daylight/standard
1850 "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",
1851 "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",
1852 "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",
1853
1854 // standard time, generic
1855 "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",
1856 "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",
1857 "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",
1858
1859 // dahylight time, explicit daylight/standard
1860 "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",
1861 "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",
1862 "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",
1863
1864 // daylight time, generic
1865 "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",
1866 "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",
1867 "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",
1868 };
1869 const int32_t XDATA_length = sizeof(XDATA)/sizeof(XDATA[0]);
1870 Locale en("en");
1871 expect(XDATA, XDATA_length, en);
1872 }
1873
TestZTimeZoneParsing(void)1874 void DateFormatTest::TestZTimeZoneParsing(void) {
1875 UErrorCode status = U_ZERO_ERROR;
1876 const Locale en("en");
1877 UnicodeString test;
1878 //SimpleDateFormat univ("yyyy-MM-dd'T'HH:mm Z", en, status);
1879 SimpleDateFormat univ("HH:mm Z", en, status);
1880 const TimeZone *t = TimeZone::getGMT();
1881 univ.setTimeZone(*t);
1882
1883 univ.setLenient(false);
1884 ParsePosition pp(0);
1885 ASSERT_OK(status);
1886 struct {
1887 UnicodeString input;
1888 UnicodeString expected_result;
1889 } tests[] = {
1890 { "11:00 -0200", "13:00 +0000" },
1891 { "11:00 +0200", "09:00 +0000" },
1892 { "11:00 +0400", "07:00 +0000" },
1893 { "11:00 +0530", "05:30 +0000" }
1894 };
1895
1896 UnicodeString result;
1897 int32_t tests_length = sizeof(tests)/sizeof(tests[0]);
1898 for (int i = 0; i < tests_length; ++i) {
1899 pp.setIndex(0);
1900 UDate d = univ.parse(tests[i].input, pp);
1901 if(pp.getIndex() != tests[i].input.length()){
1902 errln("setZoneString() did not succeed. Consumed: %i instead of %i",
1903 pp.getIndex(), tests[i].input.length());
1904 return;
1905 }
1906 result.remove();
1907 univ.format(d, result);
1908 if(result != tests[i].expected_result) {
1909 errln("Expected " + tests[i].expected_result
1910 + " got " + result);
1911 return;
1912 }
1913 logln("SUCCESS: Parsed " + tests[i].input
1914 + " got " + result
1915 + " expected " + tests[i].expected_result);
1916 }
1917 }
1918
TestHost(void)1919 void DateFormatTest::TestHost(void)
1920 {
1921 #ifdef U_WINDOWS
1922 Win32DateTimeTest::testLocales(this);
1923 #endif
1924 }
1925
1926 // Relative Date Tests
1927
TestRelative(int daysdelta,const Locale & loc,const char * expectChars)1928 void DateFormatTest::TestRelative(int daysdelta,
1929 const Locale& loc,
1930 const char *expectChars) {
1931 char banner[25];
1932 sprintf(banner, "%d", daysdelta);
1933 UnicodeString bannerStr(banner, "");
1934
1935 UErrorCode status = U_ZERO_ERROR;
1936
1937 FieldPosition pos(0);
1938 UnicodeString test;
1939 Locale en("en");
1940 DateFormat *fullrelative = DateFormat::createDateInstance(DateFormat::kFullRelative, loc);
1941
1942 if (fullrelative == NULL) {
1943 errln("DateFormat::createDateInstance(DateFormat::kFullRelative, %s) returned NULL", loc.getName());
1944 return;
1945 }
1946
1947 DateFormat *full = DateFormat::createDateInstance(DateFormat::kFull , loc);
1948
1949 if (full == NULL) {
1950 errln("DateFormat::createDateInstance(DateFormat::kFull, %s) returned NULL", loc.getName());
1951 return;
1952 }
1953
1954 DateFormat *en_full = DateFormat::createDateInstance(DateFormat::kFull, en);
1955
1956 if (en_full == NULL) {
1957 errln("DateFormat::createDateInstance(DateFormat::kFull, en) returned NULL");
1958 return;
1959 }
1960
1961 DateFormat *en_fulltime = DateFormat::createDateTimeInstance(DateFormat::kFull,DateFormat::kFull,en);
1962
1963 if (en_fulltime == NULL) {
1964 errln("DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, en) returned NULL");
1965 return;
1966 }
1967
1968 UnicodeString result;
1969 UnicodeString normalResult;
1970 UnicodeString expect;
1971 UnicodeString parseResult;
1972
1973 Calendar *c = Calendar::createInstance(status);
1974
1975 // Today = Today
1976 c->setTime(Calendar::getNow(), status);
1977 if(daysdelta != 0) {
1978 c->add(Calendar::DATE,daysdelta,status);
1979 }
1980 ASSERT_OK(status);
1981
1982 // calculate the expected string
1983 if(expectChars != NULL) {
1984 expect = expectChars;
1985 } else {
1986 full->format(*c, expect, pos); // expected = normal full
1987 }
1988
1989 fullrelative ->format(*c, result, pos);
1990 en_full ->format(*c, normalResult, pos);
1991
1992 if(result != expect) {
1993 errln("FAIL: Relative Format ["+bannerStr+"] of "+normalResult+" failed, expected "+expect+" but got " + result);
1994 } else {
1995 logln("PASS: Relative Format ["+bannerStr+"] of "+normalResult+" got " + result);
1996 }
1997
1998
1999 //verify
2000 UDate d = fullrelative->parse(result, status);
2001 ASSERT_OK(status);
2002
2003 UnicodeString parseFormat; // parse rel->format full
2004 en_full->format(d, parseFormat, status);
2005
2006 UnicodeString origFormat;
2007 en_full->format(*c, origFormat, pos);
2008
2009 if(parseFormat!=origFormat) {
2010 errln("FAIL: Relative Parse ["+bannerStr+"] of "+result+" failed, expected "+parseFormat+" but got "+origFormat);
2011 } else {
2012 logln("PASS: Relative Parse ["+bannerStr+"] of "+result+" passed, got "+parseFormat);
2013 }
2014
2015 delete full;
2016 delete fullrelative;
2017 delete en_fulltime;
2018 delete en_full;
2019 delete c;
2020 }
2021
2022
TestRelative(void)2023 void DateFormatTest::TestRelative(void)
2024 {
2025 Locale en("en");
2026 TestRelative( 0, en, "Today");
2027 TestRelative(-1, en, "Yesterday");
2028 TestRelative( 1, en, "Tomorrow");
2029 TestRelative( 2, en, NULL);
2030 TestRelative( -2, en, NULL);
2031 TestRelative( 3, en, NULL);
2032 TestRelative( -3, en, NULL);
2033 TestRelative( 300, en, NULL);
2034 TestRelative( -300, en, NULL);
2035 }
2036
TestRelativeClone(void)2037 void DateFormatTest::TestRelativeClone(void)
2038 {
2039 /*
2040 Verify that a cloned formatter gives the same results
2041 and is useable after the original has been deleted.
2042 */
2043 UErrorCode status = U_ZERO_ERROR;
2044 Locale loc("en");
2045 UDate now = Calendar::getNow();
2046 DateFormat *full = DateFormat::createDateInstance(DateFormat::kFullRelative, loc);
2047 if (full == NULL) {
2048 errln("FAIL: Can't create Relative date instance");
2049 return;
2050 }
2051 UnicodeString result1;
2052 full->format(now, result1, status);
2053 Format *fullClone = full->clone();
2054 delete full;
2055 full = NULL;
2056
2057 UnicodeString result2;
2058 fullClone->format(now, result2, status);
2059 ASSERT_OK(status);
2060 if (result1 != result2) {
2061 errln("FAIL: Clone returned different result from non-clone.");
2062 }
2063 delete fullClone;
2064 }
2065
TestHostClone(void)2066 void DateFormatTest::TestHostClone(void)
2067 {
2068 /*
2069 Verify that a cloned formatter gives the same results
2070 and is useable after the original has been deleted.
2071 */
2072 // This is mainly important on Windows.
2073 UErrorCode status = U_ZERO_ERROR;
2074 Locale loc("en_US@compat=host");
2075 UDate now = Calendar::getNow();
2076 DateFormat *full = DateFormat::createDateInstance(DateFormat::kFull, loc);
2077 if (full == NULL) {
2078 errln("FAIL: Can't create Relative date instance");
2079 return;
2080 }
2081 UnicodeString result1;
2082 full->format(now, result1, status);
2083 Format *fullClone = full->clone();
2084 delete full;
2085 full = NULL;
2086
2087 UnicodeString result2;
2088 fullClone->format(now, result2, status);
2089 ASSERT_OK(status);
2090 if (result1 != result2) {
2091 errln("FAIL: Clone returned different result from non-clone.");
2092 }
2093 delete fullClone;
2094 }
2095
TestTimeZoneDisplayName()2096 void DateFormatTest::TestTimeZoneDisplayName()
2097 {
2098 // This test data was ported from ICU4J. Don't know why the 6th column in there because it's not being
2099 // used currently.
2100 const char *fallbackTests[][6] = {
2101 { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },
2102 { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-08:00", "-8:00" },
2103 { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "PST", "America/Los_Angeles" },
2104 { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "V", "PST", "America/Los_Angeles" },
2105 { "en", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "Pacific Standard Time", "America/Los_Angeles" },
2106 { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },
2107 { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" },
2108 { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "PDT", "America/Los_Angeles" },
2109 { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "V", "PDT", "America/Los_Angeles" },
2110 { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "Pacific Daylight Time", "America/Los_Angeles" },
2111 { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "PT", "America/Los_Angeles" },
2112 { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "Pacific Time", "America/Los_Angeles" },
2113 { "en", "America/Los_Angeles", "2004-07-15T00:00:00Z", "VVVV", "United States (Los Angeles)", "America/Los_Angeles" },
2114 { "en_GB", "America/Los_Angeles", "2004-01-15T12:00:00Z", "z", "PST", "America/Los_Angeles" },
2115 { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "Z", "-0700", "-7:00" },
2116 { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" },
2117 { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "z", "MST", "America/Phoenix" },
2118 { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "V", "MST", "America/Phoenix" },
2119 { "en", "America/Phoenix", "2004-01-15T00:00:00Z", "zzzz", "Mountain Standard Time", "America/Phoenix" },
2120 { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },
2121 { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" },
2122 { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "z", "MST", "America/Phoenix" },
2123 { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "V", "MST", "America/Phoenix" },
2124 { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "zzzz", "Mountain Standard Time", "America/Phoenix" },
2125 { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "v", "MST", "America/Phoenix" },
2126 { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "vvvv", "Mountain Standard Time", "America/Phoenix" },
2127 { "en", "America/Phoenix", "2004-07-15T00:00:00Z", "VVVV", "United States (Phoenix)", "America/Phoenix" },
2128
2129 { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2130 { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2131 { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2132 { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "V", "ART", "-3:00" },
2133 { "en", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "Argentina Time", "-3:00" },
2134 { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2135 { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2136 { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2137 { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "V", "ART", "-3:00" },
2138 { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "Argentina Time", "-3:00" },
2139 { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "Argentina (Buenos Aires)", "America/Buenos_Aires" },
2140 { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "Argentina Time", "America/Buenos_Aires" },
2141 { "en", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "VVVV", "Argentina (Buenos Aires)", "America/Buenos_Aires" },
2142
2143 { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2144 { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2145 { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2146 { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "V", "ART", "-3:00" },
2147 { "en", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "Argentina Time", "-3:00" },
2148 { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2149 { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2150 { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2151 { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "V", "ART", "-3:00" },
2152 { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "Argentina Time", "-3:00" },
2153 { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "Argentina (Buenos Aires)", "America/Buenos_Aires" },
2154 { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "Argentina Time", "America/Buenos_Aires" },
2155 { "en", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "VVVV", "Argentina (Buenos Aires)", "America/Buenos_Aires" },
2156
2157 { "en", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },
2158 { "en", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-05:00", "-5:00" },
2159 { "en", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-05:00", "-5:00" },
2160 { "en", "America/Havana", "2004-01-15T00:00:00Z", "V", "CST (Cuba)", "-5:00" },
2161 { "en", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "Cuba Standard Time", "-5:00" },
2162 { "en", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },
2163 { "en", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-04:00", "-4:00" },
2164 { "en", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-04:00", "-4:00" },
2165 { "en", "America/Havana", "2004-07-15T00:00:00Z", "V", "CDT (Cuba)", "-4:00" },
2166 { "en", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "Cuba Daylight Time", "-4:00" },
2167 { "en", "America/Havana", "2004-07-15T00:00:00Z", "v", "Cuba Time", "America/Havana" },
2168 { "en", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "Cuba Time", "America/Havana" },
2169 { "en", "America/Havana", "2004-07-15T00:00:00Z", "VVVV", "Cuba Time", "America/Havana" },
2170
2171 { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2172 { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },
2173 { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },
2174 { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "V", "AEDT", "+11:00" },
2175 { "en", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "Australian Eastern Daylight Time", "+11:00" },
2176 { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2177 { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },
2178 { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },
2179 { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "V", "AEST", "+10:00" },
2180 { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "Australian Eastern Standard Time", "+10:00" },
2181 { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "Australia (Sydney)", "Australia/Sydney" },
2182 { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "Eastern Australia Time", "Australia/Sydney" },
2183 { "en", "Australia/ACT", "2004-07-15T00:00:00Z", "VVVV", "Australia (Sydney)", "Australia/Sydney" },
2184
2185 { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2186 { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },
2187 { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },
2188 { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "V", "AEDT", "+11:00" },
2189 { "en", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "Australian Eastern Daylight Time", "+11:00" },
2190 { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2191 { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },
2192 { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },
2193 { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "V", "AEST", "+10:00" },
2194 { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "Australian Eastern Standard Time", "+10:00" },
2195 { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "Australia (Sydney)", "Australia/Sydney" },
2196 { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "Eastern Australia Time", "Australia/Sydney" },
2197 { "en", "Australia/Sydney", "2004-07-15T00:00:00Z", "VVVV", "Australia (Sydney)", "Australia/Sydney" },
2198
2199 { "en", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },
2200 { "en", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+00:00", "+0:00" },
2201 { "en", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT", "+0:00" },
2202 { "en", "Europe/London", "2004-01-15T00:00:00Z", "V", "GMT", "+0:00" },
2203 { "en", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "Greenwich Mean Time", "+0:00" },
2204 { "en", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },
2205 { "en", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+01:00", "+1:00" },
2206 { "en", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+01:00", "Europe/London" },
2207 { "en", "Europe/London", "2004-07-15T00:00:00Z", "V", "BST", "Europe/London" },
2208 { "en", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "British Summer Time", "Europe/London" },
2209 // icu en.txt has exemplar city for this time zone
2210 { "en", "Europe/London", "2004-07-15T00:00:00Z", "v", "United Kingdom Time", "Europe/London" },
2211 { "en", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "United Kingdom Time", "Europe/London" },
2212 { "en", "Europe/London", "2004-07-15T00:00:00Z", "VVVV", "United Kingdom Time", "Europe/London" },
2213
2214 { "en", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2215 { "en", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2216 { "en", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2217 { "en", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2218 { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2219 { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2220 { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2221 { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2222 { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-03:00", "-3:00" },
2223 { "en", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-03:00", "-3:00" },
2224
2225 // JB#5150
2226 { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },
2227 { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },
2228 { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "GMT+05:30", "+5:30" },
2229 { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "V", "IST", "+5:30" },
2230 { "en", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "India Standard Time", "+5:30" },
2231 { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },
2232 { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },
2233 { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "GMT+05:30", "+05:30" },
2234 { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "V", "IST", "+05:30" },
2235 { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "India Standard Time", "+5:30" },
2236 { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "India Time", "Asia/Calcutta" },
2237 { "en", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "India Standard Time", "Asia/Calcutta" },
2238
2239 // ==========
2240
2241 { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },
2242 { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-08:00", "-8:00" },
2243 { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-08:00", "-8:00" },
2244 { "de", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "GMT-08:00", "-8:00" },
2245 { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },
2246 { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" },
2247 { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-07:00", "-7:00" },
2248 { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "GMT-07:00", "-7:00" },
2249 { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "Vereinigte Staaten (Los Angeles)", "America/Los_Angeles" },
2250 { "de", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "Vereinigte Staaten (Los Angeles)", "America/Los_Angeles" },
2251
2252 { "de", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2253 { "de", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2254 { "de", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2255 { "de", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2256 { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2257 { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2258 { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2259 { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2260 { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "Argentinien (Buenos Aires)", "America/Buenos_Aires" },
2261 { "de", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "Argentinien (Buenos Aires)", "America/Buenos_Aires" },
2262
2263 { "de", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2264 { "de", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2265 { "de", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2266 { "de", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2267 { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2268 { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2269 { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2270 { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2271 { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "Argentinien (Buenos Aires)", "America/Buenos_Aires" },
2272 { "de", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "Argentinien (Buenos Aires)", "America/Buenos_Aires" },
2273
2274 { "de", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },
2275 { "de", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-05:00", "-5:00" },
2276 { "de", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-05:00", "-5:00" },
2277 { "de", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "GMT-05:00", "-5:00" },
2278 { "de", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },
2279 { "de", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-04:00", "-4:00" },
2280 { "de", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-04:00", "-4:00" },
2281 { "de", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "GMT-04:00", "-4:00" },
2282 { "de", "America/Havana", "2004-07-15T00:00:00Z", "v", "Kuba", "America/Havana" },
2283 { "de", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "Kuba", "America/Havana" },
2284 // added to test proper fallback of country name
2285 { "de_CH", "America/Havana", "2004-07-15T00:00:00Z", "v", "Kuba", "America/Havana" },
2286 { "de_CH", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "Kuba", "America/Havana" },
2287
2288 { "de", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2289 { "de", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },
2290 { "de", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },
2291 { "de", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "GMT+11:00", "+11:00" },
2292 { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2293 { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },
2294 { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },
2295 { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "GMT+10:00", "+10:00" },
2296 { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "Australien (Sydney)", "Australia/Sydney" },
2297 { "de", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "Australien (Sydney)", "Australia/Sydney" },
2298
2299 { "de", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2300 { "de", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },
2301 { "de", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },
2302 { "de", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "GMT+11:00", "+11:00" },
2303 { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2304 { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },
2305 { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },
2306 { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "GMT+10:00", "+10:00" },
2307 { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "Australien (Sydney)", "Australia/Sydney" },
2308 { "de", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "Australien (Sydney)", "Australia/Sydney" },
2309
2310 { "de", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },
2311 { "de", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+00:00", "+0:00" },
2312 { "de", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT+00:00", "+0:00" },
2313 { "de", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "GMT+00:00", "+0:00" },
2314 { "de", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },
2315 { "de", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+01:00", "+1:00" },
2316 { "de", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+01:00", "+1:00" },
2317 { "de", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "GMT+01:00", "+1:00" },
2318 { "de", "Europe/London", "2004-07-15T00:00:00Z", "v", "Vereinigtes K\\u00f6nigreich", "Europe/London" },
2319 { "de", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "Vereinigtes K\\u00f6nigreich", "Europe/London" },
2320
2321 { "de", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2322 { "de", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2323 { "de", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2324 { "de", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2325 { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2326 { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2327 { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2328 { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2329 { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-03:00", "-3:00" },
2330 { "de", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-03:00", "-3:00" },
2331
2332 // JB#5150
2333 { "de", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },
2334 { "de", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },
2335 { "de", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "GMT+05:30", "+5:30" },
2336 { "de", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "GMT+05:30", "+5:30" },
2337 { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },
2338 { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },
2339 { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "GMT+05:30", "+05:30" },
2340 { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "GMT+05:30", "+5:30" },
2341 { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "Indien", "Asia/Calcutta" },
2342 { "de", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "Indien", "Asia/Calcutta" },
2343
2344 // ==========
2345
2346 { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },
2347 { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-0800", "-8:00" },
2348 { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-0800", "America/Los_Angeles" },
2349 { "zh", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "\\u592a\\u5e73\\u6d0b\\u6807\\u51c6\\u65f6\\u95f4", "America/Los_Angeles" },
2350 { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },
2351 { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-0700", "-7:00" },
2352 { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-0700", "America/Los_Angeles" },
2353 { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "\\u592a\\u5e73\\u6d0b\\u590f\\u4ee4\\u65f6\\u95f4", "America/Los_Angeles" },
2354 // icu zh.txt has exemplar city for this time zone
2355 { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\\u7f8e\\u56fd (\\u6d1b\\u6749\\u77f6)", "America/Los_Angeles" },
2356 { "zh", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\\u7f8e\\u56fd (\\u6d1b\\u6749\\u77f6)", "America/Los_Angeles" },
2357
2358 { "zh", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2359 { "zh", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-0300", "-3:00" },
2360 { "zh", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-0300", "-3:00" },
2361 { "zh", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-0300", "-3:00" },
2362 { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2363 { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-0300", "-3:00" },
2364 { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-0300", "-3:00" },
2365 { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-0300", "-3:00" },
2366 // icu zh.txt does not have info for this time zone
2367 { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\\u963f\\u6839\\u5ef7 (\\u5e03\\u5b9c\\u8bfa\\u65af\\u827e\\u5229\\u65af)", "America/Buenos_Aires" },
2368 { "zh", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\\u963f\\u6839\\u5ef7 (\\u5e03\\u5b9c\\u8bfa\\u65af\\u827e\\u5229\\u65af)", "America/Buenos_Aires" },
2369
2370 { "zh", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2371 { "zh", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-0300", "-3:00" },
2372 { "zh", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-0300", "-3:00" },
2373 { "zh", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-0300", "-3:00" },
2374 { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2375 { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-0300", "-3:00" },
2376 { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-0300", "-3:00" },
2377 { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-0300", "-3:00" },
2378 { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\\u963f\\u6839\\u5ef7 (\\u5e03\\u5b9c\\u8bfa\\u65af\\u827e\\u5229\\u65af)", "America/Buenos_Aires" },
2379 { "zh", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\\u963f\\u6839\\u5ef7 (\\u5e03\\u5b9c\\u8bfa\\u65af\\u827e\\u5229\\u65af)", "America/Buenos_Aires" },
2380
2381 { "zh", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },
2382 { "zh", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-0500", "-5:00" },
2383 { "zh", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-0500", "-5:00" },
2384 { "zh", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "GMT-0500", "-5:00" },
2385 { "zh", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },
2386 { "zh", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-0400", "-4:00" },
2387 { "zh", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-0400", "-4:00" },
2388 { "zh", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "GMT-0400", "-4:00" },
2389 { "zh", "America/Havana", "2004-07-15T00:00:00Z", "v", "\\u53e4\\u5df4", "America/Havana" },
2390 { "zh", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "\\u53e4\\u5df4", "America/Havana" },
2391
2392 { "zh", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2393 { "zh", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+1100", "+11:00" },
2394 { "zh", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+1100", "+11:00" },
2395 { "zh", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "\\u6fb3\\u5927\\u5229\\u4e9a\\u4e1c\\u90e8\\u590f\\u4ee4\\u65f6\\u95f4", "+11:00" },
2396 { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2397 { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+1000", "+10:00" },
2398 { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+1000", "+10:00" },
2399 { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "GMT+1000", "+10:00" },
2400 // icu zh.txt does not have info for this time zone
2401 { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "\\u6fb3\\u5927\\u5229\\u4e9a (\\u6089\\u5c3c)", "Australia/Sydney" },
2402 { "zh", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "\\u6fb3\\u5927\\u5229\\u4e9a (\\u6089\\u5c3c)", "Australia/Sydney" },
2403
2404 { "zh", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2405 { "zh", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+1100", "+11:00" },
2406 { "zh", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+1100", "+11:00" },
2407 { "zh", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "\\u6fb3\\u5927\\u5229\\u4e9a\\u4e1c\\u90e8\\u590f\\u4ee4\\u65f6\\u95f4", "+11:00" },
2408 { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2409 { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+1000", "+10:00" },
2410 { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+1000", "+10:00" },
2411 { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "GMT+1000", "+10:00" },
2412 { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "\\u6fb3\\u5927\\u5229\\u4e9a (\\u6089\\u5c3c)", "Australia/Sydney" },
2413 { "zh", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "\\u6fb3\\u5927\\u5229\\u4e9a (\\u6089\\u5c3c)", "Australia/Sydney" },
2414
2415 { "zh", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },
2416 { "zh", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+0000", "+0:00" },
2417 { "zh", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT+0000", "+0:00" },
2418 { "zh", "Europe/London", "2004-01-15T00:00:00Z", "V", "GMT", "+0:00" },
2419 { "zh", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "\\u683C\\u6797\\u5C3C\\u6CBB\\u6807\\u51C6\\u65F6\\u95F4", "+0:00" },
2420 { "zh", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },
2421 { "zh", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+0100", "+1:00" },
2422 { "zh", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+0100", "+1:00" },
2423 { "zh", "Europe/London", "2004-07-15T00:00:00Z", "V", "BST", "+1:00" },
2424 { "zh", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "GMT+0100", "+1:00" },
2425 { "zh", "Europe/London", "2004-07-15T00:00:00Z", "v", "\\u82f1\\u56fd", "Europe/London" },
2426 { "zh", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "\\u82f1\\u56fd", "Europe/London" },
2427 { "zh", "Europe/London", "2004-07-15T00:00:00Z", "VVVV", "\\u82f1\\u56fd", "Europe/London" },
2428
2429 { "zh", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2430 { "zh", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-0300", "-3:00" },
2431 { "zh", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-0300", "-3:00" },
2432 { "zh", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-0300", "-3:00" },
2433 { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2434 { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-0300", "-3:00" },
2435 { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-0300", "-3:00" },
2436 { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-0300", "-3:00" },
2437 { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-0300", "-3:00" },
2438 { "zh", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-0300", "-3:00" },
2439
2440 // JB#5150
2441 { "zh", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },
2442 { "zh", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+0530", "+5:30" },
2443 { "zh", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "GMT+0530", "+5:30" },
2444 { "zh", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "GMT+0530", "+5:30" },
2445 { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },
2446 { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+0530", "+5:30" },
2447 { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "GMT+0530", "+05:30" },
2448 { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "GMT+0530", "+5:30" },
2449 { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "\\u5370\\u5ea6", "Asia/Calcutta" },
2450 { "zh", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "\\u5370\\u5EA6", "Asia/Calcutta" },
2451
2452 // ==========
2453
2454 { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },
2455 { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-\\u0966\\u096e:\\u0966\\u0966", "-8:00" },
2456 { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-\\u0966\\u096e:\\u0966\\u0966", "-8:00" },
2457 { "hi", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "GMT-\\u0966\\u096e:\\u0966\\u0966", "-8:00" },
2458 { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },
2459 { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-\\u0966\\u096d:\\u0966\\u0966", "-7:00" },
2460 { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-\\u0966\\u096d:\\u0966\\u0966", "-7:00" },
2461 { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "GMT-\\u0966\\u096d:\\u0966\\u0966", "-7:00" },
2462 { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\\u0938\\u0902\\u092f\\u0941\\u0915\\u094d\\u0924 \\u0930\\u093e\\u091c\\u094d\\u092f \\u0905\\u092e\\u0930\\u093f\\u0915\\u093e (Los Angeles)", "America/Los_Angeles" },
2463 { "hi", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\\u0938\\u0902\\u092f\\u0941\\u0915\\u094d\\u0924 \\u0930\\u093e\\u091c\\u094d\\u092f \\u0905\\u092e\\u0930\\u093f\\u0915\\u093e (Los Angeles)", "America/Los_Angeles" },
2464
2465 { "hi", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2466 { "hi", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2467 { "hi", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2468 { "hi", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2469 { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2470 { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2471 { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2472 { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2473 { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\\u0905\\u0930\\u094d\\u091c\\u0947\\u0928\\u094d\\u091f\\u0940\\u0928\\u093e (Buenos Aires)", "America/Buenos_Aires" },
2474 { "hi", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\\u0905\\u0930\\u094d\\u091c\\u0947\\u0928\\u094d\\u091f\\u0940\\u0928\\u093e (Buenos Aires)", "America/Buenos_Aires" },
2475
2476 { "hi", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2477 { "hi", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2478 { "hi", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2479 { "hi", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2480 { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2481 { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2482 { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2483 { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2484 { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\\u0905\\u0930\\u094d\\u091c\\u0947\\u0928\\u094d\\u091f\\u0940\\u0928\\u093e (Buenos Aires)", "America/Buenos_Aires" },
2485 { "hi", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\\u0905\\u0930\\u094d\\u091c\\u0947\\u0928\\u094d\\u091f\\u0940\\u0928\\u093e (Buenos Aires)", "America/Buenos_Aires" },
2486
2487 { "hi", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },
2488 { "hi", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-\\u0966\\u096b:\\u0966\\u0966", "-5:00" },
2489 { "hi", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-\\u0966\\u096b:\\u0966\\u0966", "-5:00" },
2490 { "hi", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "GMT-\\u0966\\u096b:\\u0966\\u0966", "-5:00" },
2491 { "hi", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },
2492 { "hi", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-\\u0966\\u096a:\\u0966\\u0966", "-4:00" },
2493 { "hi", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-\\u0966\\u096a:\\u0966\\u0966", "-4:00" },
2494 { "hi", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "GMT-\\u0966\\u096a:\\u0966\\u0966", "-4:00" },
2495 { "hi", "America/Havana", "2004-07-15T00:00:00Z", "v", "\\u0915\\u094d\\u092f\\u0942\\u092c\\u093e", "America/Havana" },
2496 { "hi", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "\\u0915\\u094d\\u092f\\u0942\\u092c\\u093e", "America/Havana" },
2497
2498 { "hi", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2499 { "hi", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+\\u0967\\u0967:\\u0966\\u0966", "+11:00" },
2500 { "hi", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+\\u0967\\u0967:\\u0966\\u0966", "+11:00" },
2501 { "hi", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "GMT+\\u0967\\u0967:\\u0966\\u0966", "+11:00" },
2502 { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2503 { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+\\u0967\\u0966:\\u0966\\u0966", "+10:00" },
2504 { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+\\u0967\\u0966:\\u0966\\u0966", "+10:00" },
2505 { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "GMT+\\u0967\\u0966:\\u0966\\u0966", "+10:00" },
2506 { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "\\u0911\\u0938\\u094d\\u091f\\u094d\\u0930\\u0947\\u0932\\u093f\\u092f\\u093e (Sydney)", "Australia/Sydney" },
2507 { "hi", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "\\u0911\\u0938\\u094d\\u091f\\u094d\\u0930\\u0947\\u0932\\u093f\\u092f\\u093e (Sydney)", "Australia/Sydney" },
2508
2509 { "hi", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2510 { "hi", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+\\u0967\\u0967:\\u0966\\u0966", "+11:00" },
2511 { "hi", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+\\u0967\\u0967:\\u0966\\u0966", "+11:00" },
2512 { "hi", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "GMT+\\u0967\\u0967:\\u0966\\u0966", "+11:00" },
2513 { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2514 { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+\\u0967\\u0966:\\u0966\\u0966", "+10:00" },
2515 { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+\\u0967\\u0966:\\u0966\\u0966", "+10:00" },
2516 { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "GMT+\\u0967\\u0966:\\u0966\\u0966", "+10:00" },
2517 { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "\\u0911\\u0938\\u094d\\u091f\\u094d\\u0930\\u0947\\u0932\\u093f\\u092f\\u093e (Sydney)", "Australia/Sydney" },
2518 { "hi", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "\\u0911\\u0938\\u094d\\u091f\\u094d\\u0930\\u0947\\u0932\\u093f\\u092f\\u093e (Sydney)", "Australia/Sydney" },
2519
2520 { "hi", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },
2521 { "hi", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+\\u0966\\u0966:\\u0966\\u0966", "+0:00" },
2522 { "hi", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT+\\u0966\\u0966:\\u0966\\u0966", "+0:00" },
2523 { "hi", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "GMT+\\u0966\\u0966:\\u0966\\u0966", "+0:00" },
2524 { "hi", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },
2525 { "hi", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+\\u0966\\u0967:\\u0966\\u0966", "+1:00" },
2526 { "hi", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+\\u0966\\u0967:\\u0966\\u0966", "+1:00" },
2527 { "hi", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "GMT+\\u0966\\u0967:\\u0966\\u0966", "+1:00" },
2528 { "hi", "Europe/London", "2004-07-15T00:00:00Z", "v", "\\u092C\\u094D\\u0930\\u093F\\u0924\\u0928", "Europe/London" },
2529 { "hi", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "\\u092C\\u094D\\u0930\\u093F\\u0924\\u0928", "Europe/London" },
2530
2531 { "hi", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2532 { "hi", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2533 { "hi", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2534 { "hi", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2535 { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2536 { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2537 { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2538 { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2539 { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2540 { "hi", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-\\u0966\\u0969:\\u0966\\u0966", "-3:00" },
2541
2542 { "hi", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },
2543 { "hi", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+\\u0966\\u096B:\\u0969\\u0966", "+5:30" },
2544 { "hi", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "IST", "+5:30" },
2545 { "hi", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "\\u092D\\u093E\\u0930\\u0924\\u0940\\u092F \\u0938\\u092E\\u092F", "+5:30" },
2546 { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },
2547 { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+\\u0966\\u096B:\\u0969\\u0966", "+5:30" },
2548 { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "IST", "+05:30" },
2549 { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "\\u092D\\u093E\\u0930\\u0924\\u0940\\u092F \\u0938\\u092E\\u092F", "+5:30" },
2550 { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "IST", "Asia/Calcutta" },
2551 { "hi", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "\\u092D\\u093E\\u0930\\u0924\\u0940\\u092F \\u0938\\u092E\\u092F", "Asia/Calcutta" },
2552
2553 // ==========
2554
2555 { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },
2556 { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-0800", "-8:00" },
2557 { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-0800", "America/Los_Angeles" },
2558 { "bg", "America/Los_Angeles", "2004-01-15T00:00:00Z", "V", "PST", "America/Los_Angeles" },
2559 { "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" },
2560 { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },
2561 { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-0700", "-7:00" },
2562 { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-0700", "America/Los_Angeles" },
2563 { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "V", "PDT", "America/Los_Angeles" },
2564 { "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" },
2565 // icu bg.txt has exemplar city for this time zone
2566 { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\\u0421\\u0410\\u0429 (\\u041b\\u043e\\u0441 \\u0410\\u043d\\u0436\\u0435\\u043b\\u0438\\u0441)", "America/Los_Angeles" },
2567 { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\\u0421\\u0410\\u0429 (\\u041b\\u043e\\u0441 \\u0410\\u043d\\u0436\\u0435\\u043b\\u0438\\u0441)", "America/Los_Angeles" },
2568 { "bg", "America/Los_Angeles", "2004-07-15T00:00:00Z", "VVVV", "\\u0421\\u0410\\u0429 (\\u041b\\u043e\\u0441 \\u0410\\u043d\\u0436\\u0435\\u043b\\u0438\\u0441)", "America/Los_Angeles" },
2569
2570 { "bg", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2571 { "bg", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-0300", "-3:00" },
2572 { "bg", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-0300", "-3:00" },
2573 { "bg", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-0300", "-3:00" },
2574 { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2575 { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-0300", "-3:00" },
2576 { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-0300", "-3:00" },
2577 { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-0300", "-3:00" },
2578 { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\\u0410\\u0440\\u0436\\u0435\\u043d\\u0442\\u0438\\u043d\\u0430 (\\u0411\\u0443\\u0435\\u043D\\u043E\\u0441 \\u0410\\u0439\\u0440\\u0435\\u0441)", "America/Buenos_Aires" },
2579 { "bg", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\\u0410\\u0440\\u0436\\u0435\\u043d\\u0442\\u0438\\u043d\\u0430 (\\u0411\\u0443\\u0435\\u043D\\u043E\\u0441 \\u0410\\u0439\\u0440\\u0435\\u0441)", "America/Buenos_Aires" },
2580
2581 { "bg", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2582 { "bg", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-0300", "-3:00" },
2583 { "bg", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-0300", "-3:00" },
2584 { "bg", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-0300", "-3:00" },
2585 { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2586 { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-0300", "-3:00" },
2587 { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-0300", "-3:00" },
2588 { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-0300", "-3:00" },
2589 // icu bg.txt does not have info for this time zone
2590 { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\\u0410\\u0440\\u0436\\u0435\\u043d\\u0442\\u0438\\u043d\\u0430 (\\u0411\\u0443\\u0435\\u043D\\u043E\\u0441 \\u0410\\u0439\\u0440\\u0435\\u0441)", "America/Buenos_Aires" },
2591 { "bg", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\\u0410\\u0440\\u0436\\u0435\\u043d\\u0442\\u0438\\u043d\\u0430 (\\u0411\\u0443\\u0435\\u043D\\u043E\\u0441 \\u0410\\u0439\\u0440\\u0435\\u0441)", "America/Buenos_Aires" },
2592
2593 { "bg", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },
2594 { "bg", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-0500", "-5:00" },
2595 { "bg", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-0500", "-5:00" },
2596 { "bg", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "GMT-0500", "-5:00" },
2597 { "bg", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },
2598 { "bg", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-0400", "-4:00" },
2599 { "bg", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-0400", "-4:00" },
2600 { "bg", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "GMT-0400", "-4:00" },
2601 { "bg", "America/Havana", "2004-07-15T00:00:00Z", "v", "\\u041a\\u0443\\u0431\\u0430", "America/Havana" },
2602 { "bg", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "\\u041a\\u0443\\u0431\\u0430", "America/Havana" },
2603
2604 { "bg", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2605 { "bg", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+1100", "+11:00" },
2606 { "bg", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+1100", "+11:00" },
2607 { "bg", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "GMT+1100", "+11:00" },
2608 { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2609 { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+1000", "+10:00" },
2610 { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+1000", "+10:00" },
2611 { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "GMT+1000", "+10:00" },
2612 { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "\\u0410\\u0432\\u0441\\u0442\\u0440\\u0430\\u043b\\u0438\\u044f (\\u0421\\u0438\\u0434\\u043D\\u0438)", "Australia/Sydney" },
2613 { "bg", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "\\u0410\\u0432\\u0441\\u0442\\u0440\\u0430\\u043b\\u0438\\u044f (\\u0421\\u0438\\u0434\\u043D\\u0438)", "Australia/Sydney" },
2614
2615 { "bg", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2616 { "bg", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+1100", "+11:00" },
2617 { "bg", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+1100", "+11:00" },
2618 { "bg", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "GMT+1100", "+11:00" },
2619 { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2620 { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+1000", "+10:00" },
2621 { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+1000", "+10:00" },
2622 { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "GMT+1000", "+10:00" },
2623 { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "\\u0410\\u0432\\u0441\\u0442\\u0440\\u0430\\u043b\\u0438\\u044f (\\u0421\\u0438\\u0434\\u043D\\u0438)", "Australia/Sydney" },
2624 { "bg", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "\\u0410\\u0432\\u0441\\u0442\\u0440\\u0430\\u043b\\u0438\\u044f (\\u0421\\u0438\\u0434\\u043D\\u0438)", "Australia/Sydney" },
2625
2626 { "bg", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },
2627 { "bg", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+0000", "+0:00" },
2628 { "bg", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT+0000", "+0:00" },
2629 { "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" },
2630 { "bg", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },
2631 { "bg", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+0100", "+1:00" },
2632 { "bg", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+0100", "+1:00" },
2633 { "bg", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "GMT+0100", "+1:00" },
2634 { "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", "Europe/London" },
2635 { "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", "Europe/London" },
2636
2637 { "bg", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2638 { "bg", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-0300", "-3:00" },
2639 { "bg", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-0300", "-3:00" },
2640 { "bg", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-0300", "-3:00" },
2641 { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2642 { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-0300", "-3:00" },
2643 { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-0300", "-3:00" },
2644 { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-0300", "-3:00" },
2645 { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-0300", "-3:00" },
2646 { "bg", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-0300", "-3:00" },
2647
2648 // JB#5150
2649 { "bg", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },
2650 { "bg", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+0530", "+5:30" },
2651 { "bg", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "GMT+0530", "+5:30" },
2652 { "bg", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "GMT+0530", "+5:30" },
2653 { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },
2654 { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+0530", "+5:30" },
2655 { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "GMT+0530", "+05:30" },
2656 { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "GMT+0530", "+5:30" },
2657 { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "\\u0418\\u043D\\u0434\\u0438\\u044F", "Asia/Calcutta" },
2658 { "bg", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "\\u0418\\u043D\\u0434\\u0438\\u044F", "Asia/Calcutta" },
2659
2660 // ==========
2661
2662 { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },
2663 { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-0800", "-8:00" },
2664 { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-0800", "America/Los_Angeles" },
2665 { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "V", "PST", "America/Los_Angeles" },
2666 { "ja", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "\\u592a\\u5e73\\u6d0b\\u6a19\\u6e96\\u6642", "America/Los_Angeles" },
2667 { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },
2668 { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-0700", "-7:00" },
2669 { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-0700", "America/Los_Angeles" },
2670 { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "V", "PDT", "America/Los_Angeles" },
2671 { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "\\u592a\\u5e73\\u6d0b\\u590f\\u6642\\u9593", "America/Los_Angeles" },
2672 // icu ja.txt has exemplar city for this time zone
2673 { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "\\u30A2\\u30E1\\u30EA\\u30AB\\u5408\\u8846\\u56FD (\\u30ed\\u30b5\\u30f3\\u30bc\\u30eb\\u30b9)", "America/Los_Angeles" },
2674 { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "\\u30A2\\u30E1\\u30EA\\u30AB\\u5408\\u8846\\u56FD (\\u30ed\\u30b5\\u30f3\\u30bc\\u30eb\\u30b9)", "America/Los_Angeles" },
2675 { "ja", "America/Los_Angeles", "2004-07-15T00:00:00Z", "VVVV", "\\u30A2\\u30E1\\u30EA\\u30AB\\u5408\\u8846\\u56FD (\\u30ed\\u30b5\\u30f3\\u30bc\\u30eb\\u30b9)", "America/Los_Angeles" },
2676
2677 { "ja", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2678 { "ja", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-0300", "-3:00" },
2679 { "ja", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-0300", "-3:00" },
2680 { "ja", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-0300", "-3:00" },
2681 { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2682 { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-0300", "-3:00" },
2683 { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-0300", "-3:00" },
2684 { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-0300", "-3:00" },
2685 // icu ja.txt does not have info for this time zone
2686 { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\\u30a2\\u30eb\\u30bc\\u30f3\\u30c1\\u30f3 (\\u30A2\\u30E1\\u30EA\\u30AB/\\u30D6\\u30A8\\u30CE\\u30B9\\u30A2\\u30A4\\u30EC\\u30B9)", "America/Buenos_Aires" },
2687 { "ja", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\\u30a2\\u30eb\\u30bc\\u30f3\\u30c1\\u30f3 (\\u30A2\\u30E1\\u30EA\\u30AB/\\u30D6\\u30A8\\u30CE\\u30B9\\u30A2\\u30A4\\u30EC\\u30B9)", "America/Buenos_Aires" },
2688
2689 { "ja", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2690 { "ja", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-0300", "-3:00" },
2691 { "ja", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-0300", "-3:00" },
2692 { "ja", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-0300", "-3:00" },
2693 { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2694 { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-0300", "-3:00" },
2695 { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-0300", "-3:00" },
2696 { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-0300", "-3:00" },
2697 // icu ja.txt does not have info for this time zone
2698 { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "\\u30a2\\u30eb\\u30bc\\u30f3\\u30c1\\u30f3 (\\u30A2\\u30E1\\u30EA\\u30AB/\\u30D6\\u30A8\\u30CE\\u30B9\\u30A2\\u30A4\\u30EC\\u30B9)", "America/Buenos_Aires" },
2699 { "ja", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "\\u30a2\\u30eb\\u30bc\\u30f3\\u30c1\\u30f3 (\\u30A2\\u30E1\\u30EA\\u30AB/\\u30D6\\u30A8\\u30CE\\u30B9\\u30A2\\u30A4\\u30EC\\u30B9)", "America/Buenos_Aires" },
2700
2701 { "ja", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },
2702 { "ja", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-0500", "-5:00" },
2703 { "ja", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-0500", "-5:00" },
2704 { "ja", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "GMT-0500", "-5:00" },
2705 { "ja", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },
2706 { "ja", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-0400", "-4:00" },
2707 { "ja", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-0400", "-4:00" },
2708 { "ja", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "GMT-0400", "-4:00" },
2709 { "ja", "America/Havana", "2004-07-15T00:00:00Z", "v", "\\u30ad\\u30e5\\u30fc\\u30d0\\u6642\\u9593", "America/Havana" },
2710 { "ja", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "\\u30ad\\u30e5\\u30fc\\u30d0\\u6642\\u9593", "America/Havana" },
2711
2712 { "ja", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2713 { "ja", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+1100", "+11:00" },
2714 { "ja", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+1100", "+11:00" },
2715 { "ja", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "GMT+1100", "+11:00" },
2716 { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2717 { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+1000", "+10:00" },
2718 { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+1000", "+10:00" },
2719 { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "GMT+1000", "+10:00" },
2720 // icu ja.txt does not have info for this time zone
2721 { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "\\u30aa\\u30fc\\u30b9\\u30c8\\u30e9\\u30ea\\u30a2 (\\u30AA\\u30FC\\u30B9\\u30C8\\u30E9\\u30EA\\u30A2/\\u30B7\\u30C9\\u30CB\\u30FC)", "Australia/Sydney" },
2722 { "ja", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "\\u30aa\\u30fc\\u30b9\\u30c8\\u30e9\\u30ea\\u30a2 (\\u30AA\\u30FC\\u30B9\\u30C8\\u30E9\\u30EA\\u30A2/\\u30B7\\u30C9\\u30CB\\u30FC)", "Australia/Sydney" },
2723
2724 { "ja", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2725 { "ja", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+1100", "+11:00" },
2726 { "ja", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+1100", "+11:00" },
2727 { "ja", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "GMT+1100", "+11:00" },
2728 { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2729 { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+1000", "+10:00" },
2730 { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+1000", "+10:00" },
2731 { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "GMT+1000", "+10:00" },
2732 { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "\\u30aa\\u30fc\\u30b9\\u30c8\\u30e9\\u30ea\\u30a2 (\\u30AA\\u30FC\\u30B9\\u30C8\\u30E9\\u30EA\\u30A2/\\u30B7\\u30C9\\u30CB\\u30FC)", "Australia/Sydney" },
2733 { "ja", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "\\u30aa\\u30fc\\u30b9\\u30c8\\u30e9\\u30ea\\u30a2 (\\u30AA\\u30FC\\u30B9\\u30C8\\u30E9\\u30EA\\u30A2/\\u30B7\\u30C9\\u30CB\\u30FC)", "Australia/Sydney" },
2734
2735 { "ja", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },
2736 { "ja", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+0000", "+0:00" },
2737 { "ja", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT+0000", "+0:00" },
2738 { "ja", "Europe/London", "2004-01-15T00:00:00Z", "V", "GMT", "+0:00" },
2739 { "ja", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "\\u30B0\\u30EA\\u30CB\\u30C3\\u30B8\\u6A19\\u6E96\\u6642", "+0:00" },
2740 { "ja", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },
2741 { "ja", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+0100", "+1:00" },
2742 { "ja", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+0100", "+1:00" },
2743 { "ja", "Europe/London", "2004-07-15T00:00:00Z", "V", "GMT+0100", "+1:00" },
2744 { "ja", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "GMT+0100", "+1:00" },
2745 { "ja", "Europe/London", "2004-07-15T00:00:00Z", "v", "\\u30a4\\u30ae\\u30ea\\u30b9\\u6642\\u9593", "Europe/London" },
2746 { "ja", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "\\u30a4\\u30ae\\u30ea\\u30b9\\u6642\\u9593", "Europe/London" },
2747 { "ja", "Europe/London", "2004-07-15T00:00:00Z", "VVVV", "\\u30a4\\u30ae\\u30ea\\u30b9\\u6642\\u9593", "Europe/London" },
2748
2749 { "ja", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2750 { "ja", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-0300", "-3:00" },
2751 { "ja", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-0300", "-3:00" },
2752 { "ja", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-0300", "-3:00" },
2753 { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2754 { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-0300", "-3:00" },
2755 { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-0300", "-3:00" },
2756 { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-0300", "-3:00" },
2757 { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-0300", "-3:00" },
2758 { "ja", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-0300", "-3:00" },
2759
2760 // JB#5150
2761 { "ja", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },
2762 { "ja", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+0530", "+5:30" },
2763 { "ja", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "GMT+0530", "+5:30" },
2764 { "ja", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "GMT+0530", "+5:30" },
2765 { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },
2766 { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+0530", "+5:30" },
2767 { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "GMT+0530", "+05:30" },
2768 { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "GMT+0530", "+5:30" },
2769 { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "\\u30A4\\u30F3\\u30C9\\u6642\\u9593", "Asia/Calcutta" },
2770 { "ja", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "\\u30A4\\u30F3\\u30C9\\u6642\\u9593", "Asia/Calcutta" },
2771
2772 // ==========
2773
2774 { "as", "America/Los_Angeles", "2004-01-15T00:00:00Z", "Z", "-0800", "-8:00" },
2775 { "as", "America/Los_Angeles", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-08:00", "-8:00" },
2776 { "as", "America/Los_Angeles", "2004-01-15T00:00:00Z", "z", "GMT-08:00", "-8:00" },
2777 { "as", "America/Los_Angeles", "2004-01-15T00:00:00Z", "zzzz", "GMT-08:00", "-8:00" },
2778 { "as", "America/Los_Angeles", "2004-07-15T00:00:00Z", "Z", "-0700", "-7:00" },
2779 { "as", "America/Los_Angeles", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-07:00", "-7:00" },
2780 { "as", "America/Los_Angeles", "2004-07-15T00:00:00Z", "z", "GMT-07:00", "-7:00" },
2781 { "as", "America/Los_Angeles", "2004-07-15T00:00:00Z", "zzzz", "GMT-07:00", "-7:00" },
2782 { "as", "America/Los_Angeles", "2004-07-15T00:00:00Z", "v", "US (Los Angeles)", "America/Los_Angeles" },
2783 { "as", "America/Los_Angeles", "2004-07-15T00:00:00Z", "vvvv", "US (Los Angeles)", "America/Los_Angeles" },
2784
2785 { "as", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2786 { "as", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2787 { "as", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2788 { "as", "America/Argentina/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2789 { "as", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2790 { "as", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2791 { "as", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2792 { "as", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2793 { "as", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "AR (Buenos Aires)", "America/Buenos_Aires" },
2794 { "as", "America/Argentina/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "AR (Buenos Aires)", "America/Buenos_Aires" },
2795
2796 { "as", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2797 { "as", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2798 { "as", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2799 { "as", "America/Buenos_Aires", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2800 { "as", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2801 { "as", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2802 { "as", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2803 { "as", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2804 { "as", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "v", "AR (Buenos Aires)", "America/Buenos_Aires" },
2805 { "as", "America/Buenos_Aires", "2004-07-15T00:00:00Z", "vvvv", "AR (Buenos Aires)", "America/Buenos_Aires" },
2806
2807 { "as", "America/Havana", "2004-01-15T00:00:00Z", "Z", "-0500", "-5:00" },
2808 { "as", "America/Havana", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-05:00", "-5:00" },
2809 { "as", "America/Havana", "2004-01-15T00:00:00Z", "z", "GMT-05:00", "-5:00" },
2810 { "as", "America/Havana", "2004-01-15T00:00:00Z", "zzzz", "GMT-05:00", "-5:00" },
2811 { "as", "America/Havana", "2004-07-15T00:00:00Z", "Z", "-0400", "-4:00" },
2812 { "as", "America/Havana", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-04:00", "-4:00" },
2813 { "as", "America/Havana", "2004-07-15T00:00:00Z", "z", "GMT-04:00", "-4:00" },
2814 { "as", "America/Havana", "2004-07-15T00:00:00Z", "zzzz", "GMT-04:00", "-4:00" },
2815 { "as", "America/Havana", "2004-07-15T00:00:00Z", "v", "CU", "America/Havana" },
2816 { "as", "America/Havana", "2004-07-15T00:00:00Z", "vvvv", "CU", "America/Havana" },
2817
2818 { "as", "Australia/ACT", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2819 { "as", "Australia/ACT", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },
2820 { "as", "Australia/ACT", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },
2821 { "as", "Australia/ACT", "2004-01-15T00:00:00Z", "zzzz", "GMT+11:00", "+11:00" },
2822 { "as", "Australia/ACT", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2823 { "as", "Australia/ACT", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },
2824 { "as", "Australia/ACT", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },
2825 { "as", "Australia/ACT", "2004-07-15T00:00:00Z", "zzzz", "GMT+10:00", "+10:00" },
2826 { "as", "Australia/ACT", "2004-07-15T00:00:00Z", "v", "AU (Sydney)", "Australia/Sydney" },
2827 { "as", "Australia/ACT", "2004-07-15T00:00:00Z", "vvvv", "AU (Sydney)", "Australia/Sydney" },
2828
2829 { "as", "Australia/Sydney", "2004-01-15T00:00:00Z", "Z", "+1100", "+11:00" },
2830 { "as", "Australia/Sydney", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+11:00", "+11:00" },
2831 { "as", "Australia/Sydney", "2004-01-15T00:00:00Z", "z", "GMT+11:00", "+11:00" },
2832 { "as", "Australia/Sydney", "2004-01-15T00:00:00Z", "zzzz", "GMT+11:00", "+11:00" },
2833 { "as", "Australia/Sydney", "2004-07-15T00:00:00Z", "Z", "+1000", "+10:00" },
2834 { "as", "Australia/Sydney", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+10:00", "+10:00" },
2835 { "as", "Australia/Sydney", "2004-07-15T00:00:00Z", "z", "GMT+10:00", "+10:00" },
2836 { "as", "Australia/Sydney", "2004-07-15T00:00:00Z", "zzzz", "GMT+10:00", "+10:00" },
2837 { "as", "Australia/Sydney", "2004-07-15T00:00:00Z", "v", "AU (Sydney)", "Australia/Sydney" },
2838 { "as", "Australia/Sydney", "2004-07-15T00:00:00Z", "vvvv", "AU (Sydney)", "Australia/Sydney" },
2839
2840 { "as", "Europe/London", "2004-01-15T00:00:00Z", "Z", "+0000", "+0:00" },
2841 { "as", "Europe/London", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+00:00", "+0:00" },
2842 { "as", "Europe/London", "2004-01-15T00:00:00Z", "z", "GMT+00:00", "+0:00" },
2843 { "as", "Europe/London", "2004-01-15T00:00:00Z", "zzzz", "GMT+00:00", "+0:00" },
2844 { "as", "Europe/London", "2004-07-15T00:00:00Z", "Z", "+0100", "+1:00" },
2845 { "as", "Europe/London", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+01:00", "+1:00" },
2846 { "as", "Europe/London", "2004-07-15T00:00:00Z", "z", "GMT+01:00", "+1:00" },
2847 { "as", "Europe/London", "2004-07-15T00:00:00Z", "zzzz", "GMT+01:00", "+1:00" },
2848 { "as", "Europe/London", "2004-07-15T00:00:00Z", "v", "GB", "Europe/London" },
2849 { "as", "Europe/London", "2004-07-15T00:00:00Z", "vvvv", "GB", "Europe/London" },
2850
2851 { "as", "Etc/GMT+3", "2004-01-15T00:00:00Z", "Z", "-0300", "-3:00" },
2852 { "as", "Etc/GMT+3", "2004-01-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2853 { "as", "Etc/GMT+3", "2004-01-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2854 { "as", "Etc/GMT+3", "2004-01-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2855 { "as", "Etc/GMT+3", "2004-07-15T00:00:00Z", "Z", "-0300", "-3:00" },
2856 { "as", "Etc/GMT+3", "2004-07-15T00:00:00Z", "ZZZZ", "GMT-03:00", "-3:00" },
2857 { "as", "Etc/GMT+3", "2004-07-15T00:00:00Z", "z", "GMT-03:00", "-3:00" },
2858 { "as", "Etc/GMT+3", "2004-07-15T00:00:00Z", "zzzz", "GMT-03:00", "-3:00" },
2859 { "as", "Etc/GMT+3", "2004-07-15T00:00:00Z", "v", "GMT-03:00", "-3:00" },
2860 { "as", "Etc/GMT+3", "2004-07-15T00:00:00Z", "vvvv", "GMT-03:00", "-3:00" },
2861
2862 // JB#5150
2863 { "as", "Asia/Calcutta", "2004-01-15T00:00:00Z", "Z", "+0530", "+5:30" },
2864 { "as", "Asia/Calcutta", "2004-01-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },
2865 { "as", "Asia/Calcutta", "2004-01-15T00:00:00Z", "z", "\\u09AD\\u09BE. \\u09B8.", "+5:30" },
2866 { "as", "Asia/Calcutta", "2004-01-15T00:00:00Z", "zzzz", "\\u09AD\\u09BE\\u09F0\\u09A4\\u09C0\\u09AF\\u09BC \\u09B8\\u09AE\\u09AF\\u09BC", "+5:30" },
2867 { "as", "Asia/Calcutta", "2004-07-15T00:00:00Z", "Z", "+0530", "+5:30" },
2868 { "as", "Asia/Calcutta", "2004-07-15T00:00:00Z", "ZZZZ", "GMT+05:30", "+5:30" },
2869 { "as", "Asia/Calcutta", "2004-07-15T00:00:00Z", "z", "\\u09AD\\u09BE. \\u09B8.", "+05:30" },
2870 { "as", "Asia/Calcutta", "2004-07-15T00:00:00Z", "zzzz", "\\u09AD\\u09BE\\u09F0\\u09A4\\u09C0\\u09AF\\u09BC \\u09B8\\u09AE\\u09AF\\u09BC", "+5:30" },
2871 { "as", "Asia/Calcutta", "2004-07-15T00:00:00Z", "v", "\\u09AD\\u09BE. \\u09B8.", "Asia/Calcutta" },
2872 { "as", "Asia/Calcutta", "2004-07-15T00:00:00Z", "vvvv", "\\u09AD\\u09BE\\u09F0\\u09A4\\u09C0\\u09AF\\u09BC \\u09B8\\u09AE\\u09AF\\u09BC", "Asia/Calcutta" },
2873 { "", "", "", "", "", "" },
2874 };
2875
2876 if (isICUVersionAtLeast(ICU_39))
2877 {
2878 UErrorCode status;
2879 Calendar *cal = GregorianCalendar::createInstance(status);
2880 for (int i = 0; fallbackTests[i][0][0]; i++) {
2881 UnicodeString info[5];
2882 for ( int j = 0 ; j < 5 ; j++ ) {
2883 UnicodeString value(fallbackTests[i][j],"");
2884 value = value.unescape();
2885 info[j].setTo(value);
2886 }
2887 logln(info[0] + ";" + info[1] + ";" + info[2] + ";" + info[3]);
2888
2889 TimeZone *tz = TimeZone::createTimeZone(info[1]);
2890
2891 if ( info[2] == UNICODE_STRING_SIMPLE("2004-07-15T00:00:00Z")) {
2892 cal->set(2004,6,15,0,0,0);
2893 } else {
2894 cal->set(2004,0,15,0,0,0);
2895 }
2896
2897 SimpleDateFormat *fmt = new SimpleDateFormat(info[3], Locale(fallbackTests[i][0]),status);
2898 cal->setTimeZone(*tz);
2899 UnicodeString result;
2900 FieldPosition pos(0);
2901 fmt->format(*cal,result,pos);
2902 if (result != info[4]) {
2903 errln(info[0] + ";" + info[1] + ";" + info[2] + ";" + info[3] + " expected: '" +
2904 info[4] + "' but got: '" + result + "'");
2905 }
2906 }
2907 } else {
2908 logln("Warning: Skipping TestTimeZoneDisplayName. TODO: Fix in ICU 4.0");
2909 }
2910 }
2911
2912 /*
2913 void DateFormatTest::TestRelativeError(void)
2914 {
2915 UErrorCode status;
2916 Locale en("en");
2917
2918 DateFormat *en_reltime_reldate = DateFormat::createDateTimeInstance(DateFormat::kFullRelative,DateFormat::kFullRelative,en);
2919 if(en_reltime_reldate == NULL) {
2920 logln("PASS: rel date/rel time failed");
2921 } else {
2922 errln("FAIL: rel date/rel time created, should have failed.");
2923 delete en_reltime_reldate;
2924 }
2925 }
2926
2927 void DateFormatTest::TestRelativeOther(void)
2928 {
2929 logln("Nothing in this test. When we get more data from CLDR, put in some tests of -2, +2, etc. ");
2930 }
2931 */
2932
2933
2934
2935 #endif /* #if !UCONFIG_NO_FORMATTING */
2936
2937 //eof
2938