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