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