Home | History | Annotate | Download | only in intltest
      1 
      2 /********************************************************************
      3  * COPYRIGHT:
      4  * Copyright (c) 1997-2012, International Business Machines Corporation and
      5  * others. All Rights Reserved.
      6  ********************************************************************/
      7 
      8 #include "unicode/utypes.h"
      9 
     10 #if !UCONFIG_NO_FORMATTING
     11 
     12 
     13 //TODO: define it in compiler flag
     14 //#define DTIFMTTS_DEBUG 1
     15 
     16 
     17 #ifdef DTIFMTTS_DEBUG
     18 #include <iostream>
     19 #endif
     20 
     21 
     22 #include "cstring.h"
     23 #include "dtifmtts.h"
     24 #include "unicode/gregocal.h"
     25 #include "unicode/dtintrv.h"
     26 #include "unicode/dtitvinf.h"
     27 #include "unicode/dtitvfmt.h"
     28 #include "unicode/timezone.h"
     29 
     30 
     31 
     32 #ifdef DTIFMTTS_DEBUG
     33 //#define PRINTMESG(msg) { std::cout << "(" << __FILE__ << ":" << __LINE__ << ") " << msg << "\n"; }
     34 #define PRINTMESG(msg) { std::cout << msg; }
     35 #endif
     36 
     37 #define ARRAY_SIZE(array) (sizeof array / sizeof array[0])
     38 
     39 #include <stdio.h>
     40 
     41 
     42 void DateIntervalFormatTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ ) {
     43     if (exec) logln("TestSuite DateIntervalFormat");
     44     switch (index) {
     45         TESTCASE(0, testAPI);
     46         TESTCASE(1, testFormat);
     47         TESTCASE(2, testFormatUserDII);
     48         TESTCASE(3, testStress);
     49         default: name = ""; break;
     50     }
     51 }
     52 
     53 /**
     54  * Test various generic API methods of DateIntervalFormat for API coverage.
     55  */
     56 void DateIntervalFormatTest::testAPI() {
     57 
     58     /* ====== Test create interval instance with default locale and skeleton
     59      */
     60     UErrorCode status = U_ZERO_ERROR;
     61     logln("Testing DateIntervalFormat create instance with default locale and skeleton");
     62 
     63     DateIntervalFormat* dtitvfmt = DateIntervalFormat::createInstance(UDAT_YEAR_MONTH_DAY, status);
     64     if(U_FAILURE(status)) {
     65         dataerrln("ERROR: Could not create DateIntervalFormat (skeleton + default locale) - exitting");
     66         return;
     67     } else {
     68         delete dtitvfmt;
     69     }
     70 
     71 
     72     /* ====== Test create interval instance with given locale and skeleton
     73      */
     74     status = U_ZERO_ERROR;
     75     logln("Testing DateIntervalFormat create instance with given locale and skeleton");
     76 
     77     dtitvfmt = DateIntervalFormat::createInstance(UDAT_YEAR_MONTH_DAY, Locale::getJapanese(), status);
     78     if(U_FAILURE(status)) {
     79         dataerrln("ERROR: Could not create DateIntervalFormat (skeleton + locale) - exitting");
     80         return;
     81     } else {
     82         delete dtitvfmt;
     83     }
     84 
     85 
     86     /* ====== Test create interval instance with dateIntervalInfo and skeleton
     87      */
     88     status = U_ZERO_ERROR;
     89     logln("Testing DateIntervalFormat create instance with dateIntervalInfo  and skeleton");
     90 
     91     DateIntervalInfo* dtitvinf = new DateIntervalInfo(Locale::getSimplifiedChinese(), status);
     92 
     93     dtitvfmt = DateIntervalFormat::createInstance("EEEdMMMyhms", *dtitvinf, status);
     94     delete dtitvinf;
     95 
     96     if(U_FAILURE(status)) {
     97         dataerrln("ERROR: Could not create DateIntervalFormat (skeleton + DateIntervalInfo + default locale) - exitting");
     98         return;
     99     } else {
    100         delete dtitvfmt;
    101     }
    102 
    103 
    104     /* ====== Test create interval instance with dateIntervalInfo and skeleton
    105      */
    106     status = U_ZERO_ERROR;
    107     logln("Testing DateIntervalFormat create instance with dateIntervalInfo  and skeleton");
    108 
    109     dtitvinf = new DateIntervalInfo(Locale::getSimplifiedChinese(), status);
    110 
    111     dtitvfmt = DateIntervalFormat::createInstance("EEEdMMMyhms", Locale::getSimplifiedChinese(), *dtitvinf, status);
    112     delete dtitvinf;
    113     if(U_FAILURE(status)) {
    114         dataerrln("ERROR: Could not create DateIntervalFormat (skeleton + DateIntervalInfo + locale) - exitting");
    115         return;
    116     }
    117     // not deleted, test clone
    118 
    119 
    120     // ====== Test clone()
    121     status = U_ZERO_ERROR;
    122     logln("Testing DateIntervalFormat clone");
    123 
    124     DateIntervalFormat* another = (DateIntervalFormat*)dtitvfmt->clone();
    125     if ( (*another) != (*dtitvfmt) ) {
    126         dataerrln("ERROR: clone failed");
    127     }
    128 
    129 
    130     // ====== Test getDateIntervalInfo, setDateIntervalInfo, adoptDateIntervalInfo
    131     status = U_ZERO_ERROR;
    132     logln("Testing DateIntervalFormat getDateIntervalInfo");
    133     const DateIntervalInfo* inf = another->getDateIntervalInfo();
    134     dtitvfmt->setDateIntervalInfo(*inf, status);
    135     const DateIntervalInfo* anotherInf = dtitvfmt->getDateIntervalInfo();
    136     if ( (*inf) != (*anotherInf) || U_FAILURE(status) ) {
    137         dataerrln("ERROR: getDateIntervalInfo/setDateIntervalInfo failed");
    138     }
    139 
    140     /*
    141     status = U_ZERO_ERROR;
    142     DateIntervalInfo* nonConstInf = inf->clone();
    143     dtitvfmt->adoptDateIntervalInfo(nonConstInf, status);
    144     anotherInf = dtitvfmt->getDateIntervalInfo();
    145     if ( (*inf) != (*anotherInf) || U_FAILURE(status) ) {
    146         dataerrln("ERROR: adoptDateIntervalInfo failed");
    147     }
    148     */
    149 
    150     // ====== Test getDateFormat, setDateFormat, adoptDateFormat
    151 
    152     status = U_ZERO_ERROR;
    153     logln("Testing DateIntervalFormat getDateFormat");
    154     /*
    155     const DateFormat* fmt = another->getDateFormat();
    156     dtitvfmt->setDateFormat(*fmt, status);
    157     const DateFormat* anotherFmt = dtitvfmt->getDateFormat();
    158     if ( (*fmt) != (*anotherFmt) || U_FAILURE(status) ) {
    159         dataerrln("ERROR: getDateFormat/setDateFormat failed");
    160     }
    161 
    162     status = U_ZERO_ERROR;
    163     DateFormat* nonConstFmt = (DateFormat*)fmt->clone();
    164     dtitvfmt->adoptDateFormat(nonConstFmt, status);
    165     anotherFmt = dtitvfmt->getDateFormat();
    166     if ( (*fmt) != (*anotherFmt) || U_FAILURE(status) ) {
    167         dataerrln("ERROR: adoptDateFormat failed");
    168     }
    169     delete fmt;
    170     */
    171 
    172 
    173     // ======= Test getStaticClassID()
    174 
    175     logln("Testing getStaticClassID()");
    176 
    177 
    178     if(dtitvfmt->getDynamicClassID() != DateIntervalFormat::getStaticClassID()) {
    179         errln("ERROR: getDynamicClassID() didn't return the expected value");
    180     }
    181 
    182     delete another;
    183 
    184     // ====== test constructor/copy constructor and assignment
    185     /* they are protected, no test
    186     logln("Testing DateIntervalFormat constructor and assigment operator");
    187     status = U_ZERO_ERROR;
    188 
    189     DateFormat* constFmt = (constFmt*)dtitvfmt->getDateFormat()->clone();
    190     inf = dtitvfmt->getDateIntervalInfo()->clone();
    191 
    192 
    193     DateIntervalFormat* dtifmt = new DateIntervalFormat(fmt, inf, status);
    194     if(U_FAILURE(status)) {
    195         dataerrln("ERROR: Could not create DateIntervalFormat (default) - exitting");
    196         return;
    197     }
    198 
    199     DateIntervalFormat* dtifmt2 = new(dtifmt);
    200     if ( (*dtifmt) != (*dtifmt2) ) {
    201         dataerrln("ERROR: Could not create DateIntervalFormat (default) - exitting");
    202         return;
    203     }
    204 
    205     DateIntervalFormat dtifmt3 = (*dtifmt);
    206     if ( (*dtifmt) != dtifmt3 ) {
    207         dataerrln("ERROR: Could not create DateIntervalFormat (default) - exitting");
    208         return;
    209     }
    210 
    211     delete dtifmt2;
    212     delete dtifmt3;
    213     delete dtifmt;
    214     */
    215 
    216 
    217     //===== test format and parse ==================
    218     Formattable formattable;
    219     formattable.setInt64(10);
    220     UnicodeString res;
    221     FieldPosition pos = 0;
    222     status = U_ZERO_ERROR;
    223     dtitvfmt->format(formattable, res, pos, status);
    224     if ( status != U_ILLEGAL_ARGUMENT_ERROR ) {
    225         dataerrln("ERROR: format non-date-interval object should set U_ILLEGAL_ARGUMENT_ERROR - exitting");
    226         return;
    227     }
    228 
    229     DateInterval* dtitv = new DateInterval(3600*24*365, 3600*24*366);
    230     formattable.adoptObject(dtitv);
    231     res.remove();
    232     pos = 0;
    233     status = U_ZERO_ERROR;
    234     dtitvfmt->format(formattable, res, pos, status);
    235     if ( U_FAILURE(status) ) {
    236         dataerrln("ERROR: format date interval failed - exitting");
    237         return;
    238     }
    239 
    240     const DateFormat* dfmt = dtitvfmt->getDateFormat();
    241     Calendar* fromCal = dfmt->getCalendar()->clone();
    242     Calendar* toCal = dfmt->getCalendar()->clone();
    243     res.remove();
    244     pos = 0;
    245     status = U_ZERO_ERROR;
    246     dtitvfmt->format(*fromCal, *toCal, res, pos, status);
    247     if ( U_FAILURE(status) ) {
    248         dataerrln("ERROR: format date interval failed - exitting");
    249         return;
    250     }
    251     delete fromCal;
    252     delete toCal;
    253 
    254 
    255     Formattable fmttable;
    256     status = U_ZERO_ERROR;
    257     // TODO: why do I need cast?
    258     ((Format*)dtitvfmt)->parseObject(res, fmttable, status);
    259     if ( status != U_INVALID_FORMAT_ERROR ) {
    260         dataerrln("ERROR: parse should set U_INVALID_FORMAT_ERROR - exitting");
    261         return;
    262     }
    263 
    264     delete dtitvfmt;
    265 
    266     //====== test setting time zone
    267     logln("Testing DateIntervalFormat set & format with different time zones, get time zone");
    268     status = U_ZERO_ERROR;
    269     dtitvfmt = DateIntervalFormat::createInstance("MMMdHHmm", Locale::getEnglish(), status);
    270     if ( U_SUCCESS(status) ) {
    271         UDate date1 = 1299090600000.0; // 2011-Mar-02 1030 in US/Pacific, 2011-Mar-03 0330 in Asia/Tokyo
    272         UDate date2 = 1299115800000.0; // 2011-Mar-02 1730 in US/Pacific, 2011-Mar-03 1030 in Asia/Tokyo
    273 
    274         DateInterval * dtitv12 = new DateInterval(date1, date2);
    275         TimeZone * tzCalif = TimeZone::createTimeZone("US/Pacific");
    276         TimeZone * tzTokyo = TimeZone::createTimeZone("Asia/Tokyo");
    277         UnicodeString fmtCalif = UnicodeString(ctou("Mar 2, 10:30 \\u2013 Mar 2, 17:30"));
    278         UnicodeString fmtTokyo = UnicodeString(ctou("Mar 3, 03:30 \\u2013 Mar 3, 10:30"));
    279 
    280         dtitvfmt->adoptTimeZone(tzCalif);
    281         res.remove();
    282         pos = 0;
    283         status = U_ZERO_ERROR;
    284         dtitvfmt->format(dtitv12, res, pos, status);
    285         if ( U_SUCCESS(status) ) {
    286             if ( res.compare(fmtCalif) != 0 ) {
    287                 errln("ERROR: DateIntervalFormat::format for tzCalif, expect " + fmtCalif + ", get " + res);
    288             }
    289         } else {
    290             errln("ERROR: DateIntervalFormat::format for tzCalif, status %s", u_errorName(status));
    291         }
    292 
    293         dtitvfmt->setTimeZone(*tzTokyo);
    294         res.remove();
    295         pos = 0;
    296         status = U_ZERO_ERROR;
    297         dtitvfmt->format(dtitv12, res, pos, status);
    298         if ( U_SUCCESS(status) ) {
    299             if ( res.compare(fmtTokyo) != 0 ) {
    300                 errln("ERROR: DateIntervalFormat::format for fmtTokyo, expect " + fmtTokyo + ", get " + res);
    301             }
    302         } else {
    303             errln("ERROR: DateIntervalFormat::format for tzTokyo, status %s", u_errorName(status));
    304         }
    305 
    306         if ( dtitvfmt->getTimeZone() != *tzTokyo ) {
    307             errln("ERROR: DateIntervalFormat::getTimeZone returns mismatch.");
    308         }
    309 
    310         delete tzTokyo; // tzCalif was owned by dtitvfmt which should have deleted it
    311         delete dtitv12;
    312         delete dtitvfmt;
    313     } else {
    314         errln("ERROR: DateIntervalFormat::createInstance(\"MdHH\", Locale::getEnglish(), ...), status %s", u_errorName(status));
    315     }
    316     //====== test format  in testFormat()
    317 
    318     //====== test DateInterval class (better coverage)
    319     DateInterval dtitv1(3600*24*365, 3600*24*366);
    320     DateInterval dtitv2(dtitv1);
    321 
    322     if (!(dtitv1 == dtitv2)) {
    323         errln("ERROR: Copy constructor failed for DateInterval.");
    324     }
    325 
    326     DateInterval dtitv3(3600*365, 3600*366);
    327     dtitv3 = dtitv1;
    328     if (!(dtitv3 == dtitv1)) {
    329         errln("ERROR: Equal operator failed for DateInterval.");
    330     }
    331 
    332     DateInterval *dtitv4 = dtitv1.clone();
    333     if (*dtitv4 != dtitv1) {
    334         errln("ERROR: Equal operator failed for DateInterval.");
    335     }
    336     delete dtitv4;
    337 }
    338 
    339 
    340 /**
    341  * Test format
    342  */
    343 void DateIntervalFormatTest::testFormat() {
    344     // first item is date pattern
    345     // followed by a group of locale/from_data/to_data/skeleton/interval_data
    346     const char* DATA[] = {
    347         "yyyy MM dd HH:mm:ss",
    348         // test root
    349         "root", "2007 11 10 10:10:10", "2007 12 10 10:10:10", "yM", "2007-11 \\u2013 12",
    350 
    351         // test 'H' and 'h', using availableFormat in fallback
    352         "en", "2007 11 10 10:10:10", "2007 11 10 15:10:10", "Hms", "10:10:10 \\u2013 15:10:10",
    353         "en", "2007 11 10 10:10:10", "2007 11 10 15:10:10", "hms", "10:10:10 AM \\u2013 3:10:10 PM",
    354 
    355         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "MMMM", "October 2007 \\u2013 October 2008",
    356         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "MMM", "Oct 2007 \\u2013 Oct 2008",
    357         // test skeleton with both date and time
    358         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMyhm", "Nov 10, 2007, 10:10 AM \\u2013 Nov 20, 2007, 10:10 AM",
    359 
    360         "en", "2007 11 10 10:10:10", "2007 11 10 11:10:10", "dMMMyhm", "Nov 10, 2007, 10:10\\u201311:10 AM",
    361 
    362         "en", "2007 11 10 10:10:10", "2007 11 10 11:10:10", "hms", "10:10:10 AM \\u2013 11:10:10 AM",
    363         "en", "2007 11 10 10:10:10", "2007 11 10 11:10:10", "Hms", "10:10:10 \\u2013 11:10:10",
    364         "en", "2007 11 10 20:10:10", "2007 11 10 21:10:10", "Hms", "20:10:10 \\u2013 21:10:10",
    365 
    366         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EEEEdMMMMy", "Wednesday, October 10, 2007 \\u2013 Friday, October 10, 2008",
    367 
    368         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMMMMy", "October 10, 2007 \\u2013 October 10, 2008",
    369 
    370         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMMMM", "October 10, 2007 \\u2013 October 10, 2008",
    371 
    372         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "MMMMy", "October 2007 \\u2013 October 2008",
    373 
    374         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EEEEdMMMM", "Wednesday, October 10, 2007 \\u2013 Friday, October 10, 2008",
    375 
    376         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EdMMMy", "Wed, Oct 10, 2007 \\u2013 Fri, Oct 10, 2008",
    377 
    378         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMMMy", "Oct 10, 2007 \\u2013 Oct 10, 2008",
    379 
    380         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMMM", "Oct 10, 2007 \\u2013 Oct 10, 2008",
    381 
    382         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "MMMy", "Oct 2007 \\u2013 Oct 2008",
    383 
    384         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EdMMM", "Wed, Oct 10, 2007 \\u2013 Fri, Oct 10, 2008",
    385 
    386         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EdMy", "Wed, 10/10/07 \\u2013 Fri, 10/10/08",
    387 
    388         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMy", "10/10/07 \\u2013 10/10/08",
    389 
    390         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dM", "10/10/07 \\u2013 10/10/08",
    391 
    392         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "My", "10/07 \\u2013 10/08",
    393 
    394         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EdM", "Wed, 10/10/07 \\u2013 Fri, 10/10/08",
    395 
    396         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "d", "10/10/07 \\u2013 10/10/08",
    397 
    398         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "Ed", "10 Wed \\u2013 10 Fri",
    399 
    400         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "y", "2007\\u20132008",
    401 
    402         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "M", "10/07 \\u2013 10/08",
    403 
    404 
    405 
    406         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hm", "10/10/2007, 10:10 AM \\u2013 10/10/2008, 10:10 AM",
    407         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "Hm", "10/10/2007, 10:10 \\u2013 10/10/2008, 10:10",
    408         "en", "2007 10 10 20:10:10", "2008 10 10 20:10:10", "Hm", "10/10/2007, 20:10 \\u2013 10/10/2008, 20:10",
    409 
    410         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hmv", "10/10/2007, 10:10 AM PT \\u2013 10/10/2008, 10:10 AM PT",
    411 
    412         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hmz", "10/10/2007, 10:10 AM PDT \\u2013 10/10/2008, 10:10 AM PDT",
    413 
    414         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "h", "10/10/2007, 10 AM \\u2013 10/10/2008, 10 AM",
    415 
    416         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hv", "10/10/2007, 10 AM PT \\u2013 10/10/2008, 10 AM PT",
    417 
    418         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hz", "10/10/2007, 10 AM PDT \\u2013 10/10/2008, 10 AM PDT",
    419 
    420         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EEddMMyyyy", "Wed, 10/10/07 \\u2013 Fri, 10/10/08",
    421 
    422         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EddMMy", "Wed, 10/10/07 \\u2013 Fri, 10/10/08",
    423 
    424         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hhmm", "10/10/2007, 10:10 AM \\u2013 10/10/2008, 10:10 AM",
    425 
    426         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hhmmzz", "10/10/2007, 10:10 AM PDT \\u2013 10/10/2008, 10:10 AM PDT",
    427 
    428         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hms", "10/10/2007, 10:10:10 AM \\u2013 10/10/2008, 10:10:10 AM",
    429 
    430         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMMMMMy", "O 10, 2007 \\u2013 O 10, 2008",
    431 
    432         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EEEEEdM", "W, 10/10/07 \\u2013 F, 10/10/08",
    433 
    434         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEEEdMMMMy", "Wednesday, October 10 \\u2013 Saturday, November 10, 2007",
    435 
    436         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMMMy", "October 10 \\u2013 November 10, 2007",
    437 
    438         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMMM", "October 10 \\u2013 November 10",
    439 
    440         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMMMy", "October\\u2013November 2007",
    441 
    442         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEEEdMMMM", "Wednesday, October 10 \\u2013 Saturday, November 10",
    443 
    444         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EdMMMy", "Wed, Oct 10 \\u2013 Sat, Nov 10, 2007",
    445 
    446         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMMy", "Oct 10 \\u2013 Nov 10, 2007",
    447 
    448         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMM", "Oct 10 \\u2013 Nov 10",
    449 
    450         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMMy", "Oct\\u2013Nov 2007",
    451 
    452         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EdMMM", "Wed, Oct 10 \\u2013 Sat, Nov 10",
    453 
    454         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EdMy", "Wed, 10/10/07 \\u2013 Sat, 11/10/07",
    455 
    456         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMy", "10/10/07 \\u2013 11/10/07",
    457 
    458 
    459         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "My", "10/07 \\u2013 11/07",
    460 
    461         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EdM", "Wed, 10/10 \\u2013 Sat, 11/10",
    462 
    463         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "d", "10/10 \\u2013 11/10",
    464 
    465         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "Ed", "10 Wed \\u2013 10 Sat",
    466 
    467         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "y", "2007",
    468 
    469         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "M", "10\\u201311",
    470 
    471         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMM", "Oct\\u2013Nov",
    472 
    473         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMMM", "October\\u2013November",
    474 
    475         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hm", "10/10/2007, 10:10 AM \\u2013 11/10/2007, 10:10 AM",
    476         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "Hm", "10/10/2007, 10:10 \\u2013 11/10/2007, 10:10",
    477         "en", "2007 10 10 20:10:10", "2007 11 10 20:10:10", "Hm", "10/10/2007, 20:10 \\u2013 11/10/2007, 20:10",
    478 
    479         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hmv", "10/10/2007, 10:10 AM PT \\u2013 11/10/2007, 10:10 AM PT",
    480 
    481         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hmz", "10/10/2007, 10:10 AM PDT \\u2013 11/10/2007, 10:10 AM PST",
    482 
    483         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "h", "10/10/2007, 10 AM \\u2013 11/10/2007, 10 AM",
    484 
    485         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hv", "10/10/2007, 10 AM PT \\u2013 11/10/2007, 10 AM PT",
    486 
    487         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hz", "10/10/2007, 10 AM PDT \\u2013 11/10/2007, 10 AM PST",
    488 
    489         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEddMMyyyy", "Wed, 10/10/07 \\u2013 Sat, 11/10/07",
    490 
    491         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EddMMy", "Wed, 10/10/07 \\u2013 Sat, 11/10/07",
    492 
    493 
    494         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hhmmzz", "10/10/2007, 10:10 AM PDT \\u2013 11/10/2007, 10:10 AM PST",
    495 
    496         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hms", "10/10/2007, 10:10:10 AM \\u2013 11/10/2007, 10:10:10 AM",
    497 
    498         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMMMMy", "O 10 \\u2013 N 10, 2007",
    499 
    500         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEEEEdM", "W, 10/10 \\u2013 S, 11/10",
    501 
    502         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMMMy", "Saturday, November 10 \\u2013 Tuesday, November 20, 2007",
    503 
    504         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMMy", "November 10\\u201320, 2007",
    505 
    506         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMM", "November 10\\u201320",
    507 
    508 
    509         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMMM", "Saturday, November 10 \\u2013 Tuesday, November 20",
    510 
    511         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdMMMy", "Sat, Nov 10 \\u2013 Tue, Nov 20, 2007",
    512 
    513         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMy", "Nov 10\\u201320, 2007",
    514 
    515         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMM", "Nov 10\\u201320",
    516 
    517         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMMy", "Nov 2007",
    518 
    519         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdMMM", "Sat, Nov 10 \\u2013 Tue, Nov 20",
    520 
    521         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdMy", "Sat, 11/10/07 \\u2013 Tue, 11/20/07",
    522 
    523         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMy", "11/10/07 \\u2013 11/20/07",
    524 
    525         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dM", "11/10 \\u2013 11/20",
    526 
    527         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "My", "11/2007",
    528 
    529         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdM", "Sat, 11/10 \\u2013 Tue, 11/20",
    530 
    531         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "d", "10\\u201320",
    532 
    533         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "Ed", "10 Sat \\u2013 20 Tue",
    534 
    535         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "y", "2007",
    536 
    537         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "M", "11",
    538 
    539         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMM", "Nov",
    540 
    541         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMMM", "November",
    542 
    543         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hm", "11/10/2007, 10:10 AM \\u2013 11/20/2007, 10:10 AM",
    544         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "Hm", "11/10/2007, 10:10 \\u2013 11/20/2007, 10:10",
    545         "en", "2007 11 10 20:10:10", "2007 11 20 20:10:10", "Hm", "11/10/2007, 20:10 \\u2013 11/20/2007, 20:10",
    546 
    547         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hmv", "11/10/2007, 10:10 AM PT \\u2013 11/20/2007, 10:10 AM PT",
    548 
    549         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hmz", "11/10/2007, 10:10 AM PST \\u2013 11/20/2007, 10:10 AM PST",
    550 
    551         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "h", "11/10/2007, 10 AM \\u2013 11/20/2007, 10 AM",
    552 
    553         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hv", "11/10/2007, 10 AM PT \\u2013 11/20/2007, 10 AM PT",
    554 
    555         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hz", "11/10/2007, 10 AM PST \\u2013 11/20/2007, 10 AM PST",
    556 
    557         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEddMMyyyy", "Sat, 11/10/07 \\u2013 Tue, 11/20/07",
    558 
    559         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EddMMy", "Sat, 11/10/07 \\u2013 Tue, 11/20/07",
    560 
    561         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hhmm", "11/10/2007, 10:10 AM \\u2013 11/20/2007, 10:10 AM",
    562 
    563         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hhmmzz", "11/10/2007, 10:10 AM PST \\u2013 11/20/2007, 10:10 AM PST",
    564 
    565         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hms", "11/10/2007, 10:10:10 AM \\u2013 11/20/2007, 10:10:10 AM",
    566         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "Hms", "11/10/2007, 10:10:10 \\u2013 11/20/2007, 10:10:10",
    567         "en", "2007 11 10 20:10:10", "2007 11 20 20:10:10", "Hms", "11/10/2007, 20:10:10 \\u2013 11/20/2007, 20:10:10",
    568 
    569         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMMMy", "N 10\\u201320, 2007",
    570 
    571         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEEdM", "S, 11/10 \\u2013 T, 11/20",
    572 
    573         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEdMMMMy", "Wednesday, January 10, 2007",
    574 
    575         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMMMMy", "January 10, 2007",
    576 
    577         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMMMM", "January 10",
    578 
    579         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "MMMMy", "January 2007",
    580 
    581         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEdMMMM", "Wednesday, January 10",
    582 
    583         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EdMMMy", "Wed, Jan 10, 2007",
    584 
    585         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMMMy", "Jan 10, 2007",
    586 
    587         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMMM", "Jan 10",
    588 
    589         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "MMMy", "Jan 2007",
    590 
    591         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EdMMM", "Wed, Jan 10",
    592 
    593 
    594         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMy", "1/10/2007",
    595 
    596         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dM", "1/10",
    597 
    598         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "My", "1/2007",
    599 
    600         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EdM", "Wed, 1/10",
    601 
    602         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "d", "10",
    603 
    604         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "Ed", "10 Wed",
    605 
    606         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "y", "2007",
    607 
    608         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "M", "1",
    609 
    610         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "MMM", "Jan",
    611 
    612         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "MMMM", "January",
    613 
    614         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hm", "10:00 AM \\u2013 2:10 PM",
    615         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "Hm", "10:00 \\u2013 14:10",
    616 
    617         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hmv", "10:00 AM \\u2013 2:10 PM PT",
    618 
    619         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hmz", "10:00 AM \\u2013 2:10 PM PST",
    620 
    621         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "h", "10 AM \\u2013 2 PM",
    622         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "H", "10 \\u2013 14",
    623 
    624 
    625         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hz", "10 AM \\u2013 2 PM PST",
    626 
    627         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEddMMyyyy", "Wed, 01/10/2007",
    628 
    629         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EddMMy", "Wed, 01/10/2007",
    630 
    631         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hhmm", "10:00 AM \\u2013 2:10 PM",
    632         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "HHmm", "10:00 \\u2013 14:10",
    633 
    634         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hhmmzz", "10:00 AM \\u2013 2:10 PM PST",
    635 
    636         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hms", "10:00:10 AM \\u2013 2:10:10 PM",
    637         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "Hms", "10:00:10 \\u2013 14:10:10",
    638 
    639         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMMMMMy", "J 10, 2007",
    640 
    641         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEEdM", "W, 1/10",
    642         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMMMMy", "January 10, 2007",
    643 
    644         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMMMM", "January 10",
    645 
    646         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "MMMMy", "January 2007",
    647 
    648         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EEEEdMMMM", "Wednesday, January 10",
    649 
    650         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EdMMMy", "Wed, Jan 10, 2007",
    651 
    652         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMMMy", "Jan 10, 2007",
    653 
    654         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMMM", "Jan 10",
    655 
    656 
    657         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EdMMM", "Wed, Jan 10",
    658 
    659         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EdMy", "Wed, 1/10/2007",
    660 
    661         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMy", "1/10/2007",
    662 
    663 
    664         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "My", "1/2007",
    665 
    666         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EdM", "Wed, 1/10",
    667 
    668         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "d", "10",
    669 
    670 
    671         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "y", "2007",
    672 
    673         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "M", "1",
    674 
    675 
    676 
    677         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hm", "10:00\\u201310:20 AM",
    678         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "Hm", "10:00 \\u2013 10:20",
    679 
    680 
    681         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hmz", "10:00\\u201310:20 AM PST",
    682 
    683 
    684         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hv", "10 AM PT",
    685 
    686 
    687 
    688         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EddMMy", "Wed, 01/10/2007",
    689 
    690         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hhmm", "10:00\\u201310:20 AM",
    691         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "HHmm", "10:00 \\u2013 10:20",
    692 
    693         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hhmmzz", "10:00\\u201310:20 AM PST",
    694 
    695 
    696         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "dMMMMMy", "J 10, 2007",
    697 
    698 
    699         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EEEEdMMMMy", "Wednesday, January 10, 2007",
    700 
    701         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "dMMMMy", "January 10, 2007",
    702 
    703 
    704         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "MMMMy", "January 2007",
    705 
    706         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EEEEdMMMM", "Wednesday, January 10",
    707 
    708 
    709         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "dMMMy", "Jan 10, 2007",
    710 
    711         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "dMMM", "Jan 10",
    712 
    713 
    714         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EdMMM", "Wed, Jan 10",
    715 
    716         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EdMy", "Wed, 1/10/2007",
    717 
    718         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "dMy", "1/10/2007",
    719 
    720 
    721         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "My", "1/2007",
    722 
    723         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EdM", "Wed, 1/10",
    724 
    725         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "d", "10",
    726 
    727 
    728         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "y", "2007",
    729 
    730         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "M", "1",
    731 
    732 
    733         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "MMMM", "January",
    734 
    735         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hm", "10:10 AM",
    736         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "Hm", "10:10",
    737 
    738 
    739         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hmz", "10:10 AM PST",
    740 
    741         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "h", "10 AM",
    742 
    743         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hv", "10 AM PT",
    744 
    745 
    746         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EEddMMyyyy", "Wed, 01/10/2007",
    747 
    748 
    749         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hhmm", "10:10 AM",
    750         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "HHmm", "10:10",
    751 
    752         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hhmmzz", "10:10 AM PST",
    753 
    754 
    755         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "dMMMMMy", "J 10, 2007",
    756 
    757         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EEEEEdM", "W, 1/10",
    758 
    759         "zh", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EEEEdMMMMy", "2007\\u5e7410\\u670810\\u65e5\\u661f\\u671f\\u4e09\\u81f32008\\u5e7410\\u670810\\u65e5\\u661f\\u671f\\u4e94",
    760 
    761 
    762         "zh", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMMMy", "2007\\u5e7410\\u670810\\u65e5\\u81f311\\u670810\\u65e5",
    763 
    764 
    765         "zh", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMMMy", "2007\\u5e7410\\u6708\\u81f311\\u6708",
    766 
    767 
    768         // BEGIN android-change
    769         "zh", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hmv", "2007/10/10 \\u4E0A\\u534810:10 PT \\u2013 2007/11/10 \\u4E0A\\u534810:10 PT",
    770         // END android-change
    771 
    772         "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMMMy", "2007\\u5e7411\\u670810\\u65e5\\u661f\\u671f\\u516d\\u81f320\\u65e5\\u661f\\u671f\\u4e8c",
    773 
    774 
    775         "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMM", "11\\u670810\\u65e5\\u81f320\\u65e5",
    776 
    777         "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMMMy", "2007\\u5E7411\\u6708", // (fixed expected result per ticket:6626:)
    778 
    779         "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMMM", "11\\u670810\\u65e5\\u661f\\u671f\\u516d\\u81f320\\u65e5\\u661f\\u671f\\u4e8c",
    780 
    781 
    782         "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdMy", "07/11/10\\u5468\\u516d\\u81f307/11/20\\u5468\\u4e8c",
    783 
    784 
    785         "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dM", "11/10 \\u2013 11/20",
    786 
    787         "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "My", "2007/11",
    788 
    789         "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdM", "11/10\\u5468\\u516d\\u81f311/20\\u5468\\u4e8c",
    790 
    791 
    792         "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "y", "2007\\u5E74", // (fixed expected result per ticket:6626:)
    793 
    794         "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "M", "11\\u6708",
    795 
    796         "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMM", "11\\u6708", // (fixed expected result per ticket:6626: and others)
    797 
    798         // BEGIN android-change
    799         "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hmz", "2007/11/10 \\u4e0a\\u534810:10 PST \\u2013 2007/11/20 \\u4e0a\\u534810:10 PST",
    800         // END android-change
    801 
    802         "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "h", "2007/11/10 \\u4e0a\\u534810\\u65f6 \\u2013 2007/11/20 \\u4e0a\\u534810\\u65f6",
    803 
    804         "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEdMMMMy", "2007\\u5e741\\u670810\\u65e5\\u661f\\u671f\\u4e09", // (fixed expected result per ticket:6626:)
    805 
    806         "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hm", "\\u4e0a\\u534810:00\\u81f3\\u4e0b\\u53482:10",
    807 
    808 
    809         // BEGIN android-change
    810         "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hmz", "PST\\u4e0a\\u534810:00\\u81f3\\u4e0b\\u53482:10",
    811         // END android-change
    812 
    813         "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "h", "\\u4e0a\\u534810\\u65F6\\u81f3\\u4e0b\\u53482\\u65f6",
    814 
    815         // BEGIN android-change
    816         "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "hv", "PT\\u4E0A\\u534810\\u65F6\\u81F3\\u4E0B\\u53482\\u65F6",
    817         // END android-change
    818 
    819         "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hm", "\\u4e0a\\u534810:00\\u81f310:20",
    820 
    821         // BEGIN android-change
    822         "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hmv", "PT\\u4E0A\\u534810:00\\u81F310:20",
    823         // END android-change
    824 
    825         "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hz", "\\u4e0a\\u534810\\u65f6 PST",
    826 
    827         "zh", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hm", "\\u4e0a\\u534810:10",
    828 
    829         "zh", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "h", "\\u4e0a\\u534810\\u65f6",
    830 
    831         "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EEEEdMMMy", "Mittwoch, 10. Okt. 2007 - Freitag, 10. Okt. 2008",
    832 
    833 
    834         "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMMM", "10. Okt. 2007 - 10. Okt. 2008",
    835 
    836         "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "MMMy", "Okt. 2007 - Okt. 2008",
    837 
    838 
    839         "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EdMy", "Mi., 10.10.07 - Fr., 10.10.08",
    840 
    841         "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "dMy", "10.10.07 - 10.10.08",
    842 
    843 
    844         "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "My", "10.07 - 10.08",
    845 
    846         "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "EdM", "Mi., 10.10.07 - Fr., 10.10.08",
    847 
    848 
    849         "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "y", "2007-2008",
    850 
    851         "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "M", "10.07 - 10.08",
    852 
    853 
    854         "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "hm", "10.10.2007 10:10 vorm. - 10.10.2008 10:10 vorm.",
    855         "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "Hm", "10.10.2007 10:10 - 10.10.2008 10:10",
    856 
    857         "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEEEdMMMy", "Mittwoch, 10. Okt. - Samstag, 10. Nov. 2007",
    858 
    859 
    860         "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dMMM", "10. Okt. - 10. Nov.",
    861 
    862         "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMMy", "Okt.-Nov. 2007",
    863 
    864         "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "EEEEdMMM", "Mittwoch, 10. Okt. - Samstag, 10. Nov.",
    865 
    866 
    867         "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "dM", "10.10. - 10.11.",
    868 
    869         "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "My", "10.07 - 11.07",
    870 
    871 
    872         "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "d", "10.10. - 10.11.",
    873 
    874         "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "y", "2007",
    875 
    876 
    877         "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "MMM", "Okt.-Nov.",
    878 
    879 
    880         "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "hms", "10.10.2007 10:10:10 vorm. - 10.11.2007 10:10:10 vorm.",
    881         "de", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "Hms", "10.10.2007 10:10:10 - 10.11.2007 10:10:10",
    882 
    883         "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMMy", "Samstag, 10. - Dienstag, 20. Nov. 2007",
    884 
    885         "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dMMMy", "10.-20. Nov. 2007",
    886 
    887 
    888         "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "MMMy", "Nov. 2007",
    889 
    890         "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EEEEdMMM", "Samstag, 10. - Dienstag, 20. Nov.",
    891 
    892         "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "EdMy", "Sa., 10.11.07 - Di., 20.11.07",
    893 
    894 
    895         "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "dM", "10.11. - 20.11.",
    896 
    897         "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "My", "11.2007",
    898 
    899 
    900         "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "d", "10.-20.",
    901 
    902         "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "y", "2007",
    903 
    904 
    905         // BEGIN android-change
    906         "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "hmv", "10.11.2007 10:10 vorm. PT - 20.11.2007 10:10 vorm. PT",
    907         // END android-change
    908 
    909         "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEdMMMy", "Mittwoch, 10. Jan. 2007",
    910 
    911 
    912         "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "dMMM", "10. Jan.",
    913 
    914         "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "MMMy", "Jan. 2007",
    915 
    916         "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "EEEEdMMM", "Mittwoch, 10. Jan.",
    917 
    918 
    919         "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "h", "10 vorm. - 2 nachm.",
    920         "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "H", "10-14 Uhr",
    921 
    922         "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "EEEEdMMM", "Mittwoch, 10. Jan.",
    923 
    924 
    925         // BEGIN android-change
    926         "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hmv", "10:00-10:20 vorm. PT",
    927 
    928         "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hmz", "10:00-10:20 vorm. PST",
    929         // END android-change
    930 
    931         "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "h", "10 vorm.",
    932         "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "H", "10 Uhr",
    933 
    934 
    935         // BEGIN android-change
    936         "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "hz", "10 vorm. PST",
    937         // END android-change
    938 
    939         "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "EEEEdMMMy", "Mittwoch, 10. Jan. 2007",
    940 
    941 
    942         // BEGIN android-change
    943         "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hmv", "10:10 vorm. PT",
    944 
    945         "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hmz", "10:10 vorm. PST",
    946 
    947         "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hv", "10 vorm. PT",
    948 
    949         "de", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "hz", "10 vorm. PST",
    950         // END android-change
    951 
    952         // Thai (default calendar buddhist)
    953 
    954         "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "EEEEdMMMy", "\\u0E27\\u0E31\\u0E19\\u0E1E\\u0E38\\u0E18 10 \\u0E15.\\u0E04. 2550 \\u2013 \\u0E27\\u0E31\\u0E19\\u0E28\\u0E38\\u0E01\\u0E23\\u0E4C 10 \\u0E15.\\u0E04. 2551",
    955 
    956 
    957         "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "dMMM", "10 \\u0E15.\\u0E04. 2550 \\u2013 10 \\u0E15.\\u0E04. 2551",
    958 
    959         "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "MMMy", "\\u0E15.\\u0E04. 2550 - \\u0E15.\\u0E04. 2551",
    960 
    961 
    962         "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "EdMy", "\\u0E1E. 10/10/50 \\u2013 \\u0E28. 10/10/51",
    963 
    964         "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "dMy", "10/10/50 \\u2013 10/10/51",
    965 
    966 
    967         "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "My", "10/50 \\u2013 10/51",
    968 
    969         "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "EdM", "\\u0E1E. 10/10/50 \\u2013 \\u0E28. 10/10/51",
    970 
    971 
    972         "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "y", "2550-2551",
    973 
    974         "th", "2550 10 10 10:10:10", "2551 10 10 10:10:10", "M", "10/50 \\u2013 10/51",
    975 
    976 
    977         "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "EEEEdMMMy", "\\u0E27\\u0E31\\u0E19\\u0E1E\\u0E38\\u0E18 10 \\u0E15.\\u0E04. \\u2013 \\u0E27\\u0E31\\u0E19\\u0E40\\u0E2A\\u0E32\\u0E23\\u0E4C 10 \\u0E1E.\\u0E22. 2550",
    978 
    979 
    980         "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "dMMM", "10 \\u0E15.\\u0E04. \\u2013 10 \\u0E1E.\\u0E22.",
    981 
    982         "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "MMMy", "\\u0E15.\\u0E04.-\\u0E1E.\\u0E22. 2550",
    983 
    984        "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "dM", "10/10 - 10/11",
    985 
    986         "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "My", "10/50 \\u2013 11/50",
    987 
    988 
    989         "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "d", "10/10 - 10/11",
    990 
    991         "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "y", "\\u0E1E.\\u0E28. 2550",
    992 
    993 
    994         "th", "2550 10 10 10:10:10", "2550 11 10 10:10:10", "MMM", "\\u0E15.\\u0E04.-\\u0E1E.\\u0E22.",
    995 
    996     };
    997     expect(DATA, ARRAY_SIZE(DATA));
    998 }
    999 
   1000 
   1001 void DateIntervalFormatTest::expect(const char** data, int32_t data_length) {
   1002     int32_t i = 0;
   1003     UErrorCode ec = U_ZERO_ERROR;
   1004     UnicodeString str, str2;
   1005     const char* pattern = data[0];
   1006     i++;
   1007 
   1008 #ifdef DTIFMTTS_DEBUG
   1009     char result[1000];
   1010     char mesg[1000];
   1011     sprintf(mesg, "locale: %s\n", locName);
   1012     PRINTMESG(mesg);
   1013 #endif
   1014 
   1015     while (i<data_length) {
   1016         const char* locName = data[i++];
   1017         Locale loc(locName);
   1018         SimpleDateFormat ref(pattern, loc, ec);
   1019         if (U_FAILURE(ec)) {
   1020             dataerrln("contruct SimpleDateFormat in expect failed: %s", u_errorName(ec));
   1021             return;
   1022         }
   1023         // 'f'
   1024         const char* datestr = data[i++];
   1025         const char* datestr_2 = data[i++];
   1026 #ifdef DTIFMTTS_DEBUG
   1027         sprintf(mesg, "original date: %s - %s\n", datestr, datestr_2);
   1028         PRINTMESG(mesg)
   1029 #endif
   1030         UDate date = ref.parse(ctou(datestr), ec);
   1031         if (!assertSuccess("parse 1st data in expect", ec)) return;
   1032         UDate date_2 = ref.parse(ctou(datestr_2), ec);
   1033         if (!assertSuccess("parse 2nd data in expect", ec)) return;
   1034         DateInterval dtitv(date, date_2);
   1035 
   1036         const UnicodeString& oneSkeleton = data[i++];
   1037 
   1038         DateIntervalFormat* dtitvfmt = DateIntervalFormat::createInstance(oneSkeleton, loc, ec);
   1039         if (!assertSuccess("createInstance(skeleton) in expect", ec)) return;
   1040         FieldPosition pos=0;
   1041         dtitvfmt->format(&dtitv, str.remove(), pos, ec);
   1042         if (!assertSuccess("format in expect", ec)) return;
   1043         assertEquals((UnicodeString)"\"" + locName + "\\" + oneSkeleton + "\\" + datestr + "\\" + datestr_2 + "\"", ctou(data[i++]), str);
   1044 
   1045 
   1046 
   1047 #ifdef DTIFMTTS_DEBUG
   1048         str.extract(0,  str.length(), result, "UTF-8");
   1049         sprintf(mesg, "interval date: %s\n", result);
   1050         std::cout << "//";
   1051         PRINTMESG(mesg)
   1052         std::cout << "\"" << locName << "\", "
   1053                  << "\"" << datestr << "\", "
   1054                  << "\"" << datestr_2 << "\", ";
   1055         printUnicodeString(oneSkeleton);
   1056         printUnicodeString(str);
   1057         std::cout << "\n\n";
   1058 #endif
   1059         delete dtitvfmt;
   1060     }
   1061 }
   1062 
   1063 
   1064 /*
   1065  * Test format using user defined DateIntervalInfo
   1066  */
   1067 void DateIntervalFormatTest::testFormatUserDII() {
   1068     // first item is date pattern
   1069     const char* DATA[] = {
   1070         "yyyy MM dd HH:mm:ss",
   1071         "en", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "Oct 10, 2007 --- Oct 10, 2008",
   1072 
   1073         "en", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "2007 Oct 10 - Nov 2007",
   1074 
   1075         "en", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "Nov 10, 2007 --- Nov 20, 2007",
   1076 
   1077         "en", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "Jan 10, 2007",
   1078 
   1079         "en", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "Jan 10, 2007",
   1080 
   1081         "en", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "Jan 10, 2007",
   1082 
   1083         "zh", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "2007\\u5e7410\\u670810\\u65e5 --- 2008\\u5e7410\\u670810\\u65e5",
   1084 
   1085         "zh", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "2007 10\\u6708 10 - 11\\u6708 2007",
   1086 
   1087         "zh", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "2007\\u5e7411\\u670810\\u65e5 --- 2007\\u5e7411\\u670820\\u65e5",
   1088 
   1089         "zh", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "2007\\u5e741\\u670810\\u65e5", // (fixed expected result per ticket:6626:)
   1090 
   1091         "zh", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "2007\\u5e741\\u670810\\u65e5", // (fixed expected result per ticket:6626:)
   1092 
   1093         "zh", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "2007\\u5e741\\u670810\\u65e5", // (fixed expected result per ticket:6626:)
   1094 
   1095         "de", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "10. Okt. 2007 --- 10. Okt. 2008",
   1096 
   1097 
   1098         "de", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "10. Nov. 2007 --- 20. Nov. 2007",
   1099 
   1100         "de", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "10. Jan. 2007",
   1101 
   1102         "de", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "10. Jan. 2007",
   1103 
   1104 
   1105         "es", "2007 10 10 10:10:10", "2008 10 10 10:10:10", "10 oct 2007 --- 10 oct 2008",
   1106 
   1107         "es", "2007 10 10 10:10:10", "2007 11 10 10:10:10", "2007 oct 10 - nov 2007",
   1108 
   1109         "es", "2007 11 10 10:10:10", "2007 11 20 10:10:10", "10 nov 2007 --- 20 nov 2007",
   1110 
   1111         "es", "2007 01 10 10:00:10", "2007 01 10 14:10:10", "10 ene 2007",
   1112 
   1113         "es", "2007 01 10 10:00:10", "2007 01 10 10:20:10", "10 ene 2007",
   1114 
   1115         "es", "2007 01 10 10:10:10", "2007 01 10 10:10:20", "10 ene 2007",
   1116     };
   1117     expectUserDII(DATA, ARRAY_SIZE(DATA));
   1118 }
   1119 
   1120 
   1121 void DateIntervalFormatTest::expectUserDII(const char** data,
   1122                                            int32_t data_length) {
   1123     int32_t i = 0;
   1124     UnicodeString str;
   1125     UErrorCode ec = U_ZERO_ERROR;
   1126     const char* pattern = data[0];
   1127     i++;
   1128 
   1129     while ( i < data_length ) {
   1130         const char* locName = data[i++];
   1131         Locale loc(locName);
   1132         SimpleDateFormat ref(pattern, loc, ec);
   1133         if (U_FAILURE(ec)) {
   1134             dataerrln("contruct SimpleDateFormat in expectUserDII failed: %s", u_errorName(ec));
   1135             return;
   1136         }
   1137         const char* datestr = data[i++];
   1138         const char* datestr_2 = data[i++];
   1139         UDate date = ref.parse(ctou(datestr), ec);
   1140         if (!assertSuccess("parse in expectUserDII", ec)) return;
   1141         UDate date_2 = ref.parse(ctou(datestr_2), ec);
   1142         if (!assertSuccess("parse in expectUserDII", ec)) return;
   1143         DateInterval dtitv(date, date_2);
   1144 
   1145         ec = U_ZERO_ERROR;
   1146         // test user created DateIntervalInfo
   1147         DateIntervalInfo* dtitvinf = new DateIntervalInfo(ec);
   1148         dtitvinf->setFallbackIntervalPattern("{0} --- {1}", ec);
   1149         dtitvinf->setIntervalPattern(UDAT_YEAR_ABBR_MONTH_DAY, UCAL_MONTH, "yyyy MMM d - MMM y",ec);
   1150         if (!assertSuccess("DateIntervalInfo::setIntervalPattern", ec)) return;
   1151         dtitvinf->setIntervalPattern(UDAT_YEAR_ABBR_MONTH_DAY, UCAL_HOUR_OF_DAY, "yyyy MMM d HH:mm - HH:mm", ec);
   1152         if (!assertSuccess("DateIntervalInfo::setIntervalPattern", ec)) return;
   1153         DateIntervalFormat* dtitvfmt = DateIntervalFormat::createInstance(UDAT_YEAR_ABBR_MONTH_DAY, loc, *dtitvinf, ec);
   1154         delete dtitvinf;
   1155         if (!assertSuccess("createInstance(skeleton,dtitvinf) in expectUserDII", ec)) return;
   1156         FieldPosition pos=0;
   1157         dtitvfmt->format(&dtitv, str.remove(), pos, ec);
   1158         if (!assertSuccess("format in expectUserDII", ec)) return;
   1159         assertEquals((UnicodeString)"\"" + locName + "\\" + datestr + "\\" + datestr_2 + "\"", ctou(data[i++]), str);
   1160 #ifdef DTIFMTTS_DEBUG
   1161         char result[1000];
   1162         char mesg[1000];
   1163         PRINTMESG("interval format using user defined DateIntervalInfo\n");
   1164         str.extract(0,  str.length(), result, "UTF-8");
   1165         sprintf(mesg, "interval date: %s\n", result);
   1166         PRINTMESG(mesg);
   1167 #endif
   1168         delete dtitvfmt;
   1169     }
   1170 }
   1171 
   1172 
   1173 void DateIntervalFormatTest::testStress() {
   1174     if(quick){
   1175     	logln("Quick mode: Skipping test");
   1176     	return;
   1177     }
   1178 	const char* DATA[] = {
   1179         "yyyy MM dd HH:mm:ss",
   1180         "2007 10 10 10:10:10", "2008 10 10 10:10:10",
   1181         "2007 10 10 10:10:10", "2007 11 10 10:10:10",
   1182         "2007 11 10 10:10:10", "2007 11 20 10:10:10",
   1183         "2007 01 10 10:00:10", "2007 01 10 14:10:10",
   1184         "2007 01 10 10:00:10", "2007 01 10 10:20:10",
   1185         "2007 01 10 10:10:10", "2007 01 10 10:10:20",
   1186     };
   1187 
   1188     const char* testLocale[][3] = {
   1189         //{"th", "", ""},
   1190         {"en", "", ""},
   1191         {"zh", "", ""},
   1192         {"de", "", ""},
   1193         {"ar", "", ""},
   1194         {"en", "GB",  ""},
   1195         {"fr", "", ""},
   1196         {"it", "", ""},
   1197         {"nl", "", ""},
   1198         {"zh", "TW",  ""},
   1199         {"ja", "", ""},
   1200         {"pt", "BR", ""},
   1201         {"ru", "", ""},
   1202         {"pl", "", ""},
   1203         {"tr", "", ""},
   1204         {"es", "", ""},
   1205         {"ko", "", ""},
   1206         {"sv", "", ""},
   1207         {"fi", "", ""},
   1208         {"da", "", ""},
   1209         {"pt", "PT", ""},
   1210         {"ro", "", ""},
   1211         {"hu", "", ""},
   1212         {"he", "", ""},
   1213         {"in", "", ""},
   1214         {"cs", "", ""},
   1215         {"el", "", ""},
   1216         {"no", "", ""},
   1217         {"vi", "", ""},
   1218         {"bg", "", ""},
   1219         {"hr", "", ""},
   1220         {"lt", "", ""},
   1221         {"sk", "", ""},
   1222         {"sl", "", ""},
   1223         {"sr", "", ""},
   1224         {"ca", "", ""},
   1225         {"lv", "", ""},
   1226         {"uk", "", ""},
   1227         {"hi", "", ""},
   1228     };
   1229 
   1230     uint32_t localeIndex;
   1231     for ( localeIndex = 0; localeIndex < ARRAY_SIZE(testLocale); ++localeIndex ) {
   1232         char locName[32];
   1233         uprv_strcpy(locName, testLocale[localeIndex][0]);
   1234         uprv_strcat(locName, testLocale[localeIndex][1]);
   1235         stress(DATA, ARRAY_SIZE(DATA), Locale(testLocale[localeIndex][0], testLocale[localeIndex][1], testLocale[localeIndex][2]), locName);
   1236     }
   1237 }
   1238 
   1239 
   1240 void DateIntervalFormatTest::stress(const char** data, int32_t data_length,
   1241                                     const Locale& loc, const char* locName) {
   1242     UnicodeString skeleton[] = {
   1243         "EEEEdMMMMy",
   1244         "dMMMMy",
   1245         "dMMMM",
   1246         "MMMMy",
   1247         "EEEEdMMMM",
   1248         "EdMMMy",
   1249         "dMMMy",
   1250         "dMMM",
   1251         "MMMy",
   1252         "EdMMM",
   1253         "EdMy",
   1254         "dMy",
   1255         "dM",
   1256         "My",
   1257         "EdM",
   1258         "d",
   1259         "Ed",
   1260         "y",
   1261         "M",
   1262         "MMM",
   1263         "MMMM",
   1264         "hm",
   1265         "hmv",
   1266         "hmz",
   1267         "h",
   1268         "hv",
   1269         "hz",
   1270         "EEddMMyyyy", // following could be normalized
   1271         "EddMMy",
   1272         "hhmm",
   1273         "hhmmzz",
   1274         "hms",  // following could not be normalized
   1275         "dMMMMMy",
   1276         "EEEEEdM",
   1277     };
   1278 
   1279     int32_t i = 0;
   1280     UErrorCode ec = U_ZERO_ERROR;
   1281     UnicodeString str, str2;
   1282     SimpleDateFormat ref(data[i++], loc, ec);
   1283     if (!assertSuccess("construct SimpleDateFormat", ec)) return;
   1284 
   1285 #ifdef DTIFMTTS_DEBUG
   1286     char result[1000];
   1287     char mesg[1000];
   1288     sprintf(mesg, "locale: %s\n", locName);
   1289     PRINTMESG(mesg);
   1290 #endif
   1291 
   1292     while (i<data_length) {
   1293 
   1294         // 'f'
   1295         const char* datestr = data[i++];
   1296         const char* datestr_2 = data[i++];
   1297 #ifdef DTIFMTTS_DEBUG
   1298         sprintf(mesg, "original date: %s - %s\n", datestr, datestr_2);
   1299         PRINTMESG(mesg)
   1300 #endif
   1301         UDate date = ref.parse(ctou(datestr), ec);
   1302         if (!assertSuccess("parse", ec)) return;
   1303         UDate date_2 = ref.parse(ctou(datestr_2), ec);
   1304         if (!assertSuccess("parse", ec)) return;
   1305         DateInterval dtitv(date, date_2);
   1306 
   1307         for ( uint32_t skeletonIndex = 0;
   1308               skeletonIndex < ARRAY_SIZE(skeleton);
   1309               ++skeletonIndex ) {
   1310             const UnicodeString& oneSkeleton = skeleton[skeletonIndex];
   1311             DateIntervalFormat* dtitvfmt = DateIntervalFormat::createInstance(oneSkeleton, loc, ec);
   1312             if (!assertSuccess("createInstance(skeleton)", ec)) return;
   1313             /*
   1314             // reset the calendar to be Gregorian calendar for "th"
   1315             if ( uprv_strcmp(locName, "th") == 0 ) {
   1316                 GregorianCalendar* gregCal = new GregorianCalendar(loc, ec);
   1317                 if (!assertSuccess("GregorianCalendar()", ec)) return;
   1318                 const DateFormat* dformat = dtitvfmt->getDateFormat();
   1319                 DateFormat* newOne = (DateFormat*)dformat->clone();
   1320                 newOne->adoptCalendar(gregCal);
   1321                 //dtitvfmt->adoptDateFormat(newOne, ec);
   1322                 dtitvfmt->setDateFormat(*newOne, ec);
   1323                 delete newOne;
   1324                 if (!assertSuccess("adoptDateFormat()", ec)) return;
   1325             }
   1326             */
   1327             FieldPosition pos=0;
   1328             dtitvfmt->format(&dtitv, str.remove(), pos, ec);
   1329             if (!assertSuccess("format", ec)) return;
   1330 #ifdef DTIFMTTS_DEBUG
   1331             oneSkeleton.extract(0,  oneSkeleton.length(), result, "UTF-8");
   1332             sprintf(mesg, "interval by skeleton: %s\n", result);
   1333             PRINTMESG(mesg)
   1334             str.extract(0,  str.length(), result, "UTF-8");
   1335             sprintf(mesg, "interval date: %s\n", result);
   1336             PRINTMESG(mesg)
   1337 #endif
   1338             delete dtitvfmt;
   1339         }
   1340 
   1341         // test user created DateIntervalInfo
   1342         ec = U_ZERO_ERROR;
   1343         DateIntervalInfo* dtitvinf = new DateIntervalInfo(ec);
   1344         dtitvinf->setFallbackIntervalPattern("{0} --- {1}", ec);
   1345         dtitvinf->setIntervalPattern(UDAT_YEAR_ABBR_MONTH_DAY, UCAL_MONTH, "yyyy MMM d - MMM y",ec);
   1346         if (!assertSuccess("DateIntervalInfo::setIntervalPattern", ec)) return;
   1347         dtitvinf->setIntervalPattern(UDAT_YEAR_ABBR_MONTH_DAY, UCAL_HOUR_OF_DAY, "yyyy MMM d HH:mm - HH:mm", ec);
   1348         if (!assertSuccess("DateIntervalInfo::setIntervalPattern", ec)) return;
   1349         DateIntervalFormat* dtitvfmt = DateIntervalFormat::createInstance(UDAT_YEAR_ABBR_MONTH_DAY, loc, *dtitvinf, ec);
   1350         delete dtitvinf;
   1351         if (!assertSuccess("createInstance(skeleton,dtitvinf)", ec)) return;
   1352         FieldPosition pos=0;
   1353         dtitvfmt->format(&dtitv, str.remove(), pos, ec);
   1354         if ( uprv_strcmp(locName, "th") ) {
   1355             if (!assertSuccess("format", ec)) return;
   1356 #ifdef DTIFMTTS_DEBUG
   1357             PRINTMESG("interval format using user defined DateIntervalInfo\n");
   1358             str.extract(0,  str.length(), result, "UTF-8");
   1359             sprintf(mesg, "interval date: %s\n", result);
   1360             PRINTMESG(mesg)
   1361 #endif
   1362         } else {
   1363             // for "th", the default calendar is Budhist,
   1364             // not Gregorian.
   1365             assertTrue("Default calendar for \"th\" is Budhist", ec == U_ILLEGAL_ARGUMENT_ERROR);
   1366             ec = U_ZERO_ERROR;
   1367         }
   1368         delete dtitvfmt;
   1369     }
   1370 }
   1371 
   1372 #endif /* #if !UCONFIG_NO_FORMATTING */
   1373