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