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