Imported Upstream version 58.1
[platform/upstream/icu.git] / source / test / testdata / format.txt
1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 // Copyright (c) 2007-2015 International Business Machines
4 // Corporation and others. All Rights Reserved.
5 format:table(nofallback) {
6     Info {
7         Description { "These are the data driven format tests" }
8         LongDescription {   "Data for data driven format tests." }
9     }
10     TestData {
11         TestDateFormatBasic {
12             Info {
13                 Description { "Test data for format and parse :" }
14             }
15             Settings {
16                 // options: 'format', or 'parse'.  One can be omitted if this is a 1 way test.
17                 {
18                     Type { "date_format" }
19                 },
20                 {
21                     Type { "date_parse" }
22                 },
23             }
24             Headers { "locale", "zone", "spec", "date", "str"}
25             // locale: locale including calendar type
26             // zone:   time zone name, or "" to not explicitly set zone
27             // spec:   either 'PATTERN=y mm h' etc, or 'DATE=SHORT,TIME=LONG'
28             // date:   either 'MILLIS=####' where #### is millis,
29             //        or a calendar spec ERA=0,YEAR=1, etc.. applied to the calendar type specified by the locale
30             //        or RELATIVE_MILLIS=### where ### is a signed value which is added to the current millis
31             //        or RELATIVE_ADD:DATE=1  which means that the field "DATE" will be added by +1 relative to current time,
32             //           and any other fields present will be set explicitly.
33             // str:   the expected unicode string
34             Cases { 
35                {
36                     "en_US@calendar=gregorian",
37                     "",
38                     "DATE=SHORT,TIME=SHORT",
39                     "ERA=1,YEAR=2007,MONTH=AUGUST,DATE=8,HOUR_OF_DAY=18,MINUTE=54,SECOND=0",
40                     "8/8/07, 6:54 PM"
41                },
42                {
43                     "zh_TW@calendar=roc",
44                     "",
45                     "DATE=LONG",
46                     "ERA=1,YEAR=98,MONTH=0,DATE=24",
47                     "民國98年1月24日",
48                },
49                {
50                     //民國前2年1月24日 -> 1910-1-24 
51                     "zh_TW@calendar=roc",
52                     "",
53                     "DATE=LONG",
54                     "ERA=0,YEAR=2,MONTH=0,DATE=24",
55                     "民國前2年1月24日",
56                },
57             }
58         }
59         TestFormatRelative {
60             Info {
61                 Description { "relative format :" }
62             }
63             Settings {
64                 {
65                     Type { "date_format" }
66                 },
67             }
68             Headers { "locale", "zone", "spec", "date", "str"}
69             Cases { 
70                {
71                     "en_US@calendar=gregorian",         
72                     "",
73                     "DATE=RELATIVE_SHORT",
74                     "RELATIVE_ADD:DATE=1", // one day from now
75                     "tomorrow"
76                },
77                {
78                     "en_US@calendar=gregorian",         
79                     "",
80                     "DATE=RELATIVE_SHORT",
81                     "RELATIVE_MILLIS=0", // today
82                     "today"
83                },
84                {
85                     "en_US@calendar=gregorian",         
86                     "",
87                     "DATE=RELATIVE_SHORT",
88                     "RELATIVE_ADD:DATE=-1", // one day before now
89                     "yesterday"
90                },
91                // date only, out of relative range
92                {
93                     "en_US@calendar=gregorian",         
94                     "GMT",
95                     "DATE=RELATIVE_FULL",
96                     "ERA=1,YEAR=2012,MONTH=OCTOBER,DATE=8,HOUR_OF_DAY=23,MINUTE=59,SECOND=0",
97                     "Monday, October 8, 2012"
98                },
99                // time only
100                {
101                     "en_US@calendar=gregorian",         
102                     "GMT",
103                     "TIME=LONG",
104                     "ERA=1,YEAR=2012,MONTH=OCTOBER,DATE=8,HOUR_OF_DAY=23,MINUTE=59,SECOND=0",
105                     "11:59:00 PM GMT"
106                },
107                {
108                     "en_US@calendar=gregorian",         
109                     "GMT",
110                     "TIME=LONG",
111                     "RELATIVE_ADD:DATE=-1,HOUR_OF_DAY=17,MINUTE=0,SECOND=0", // one day before now at specified time
112                     "5:00:00 PM GMT"
113                },
114                // normal formats, combined using 'at'
115                {
116                     "en_US@calendar=gregorian",         
117                     "GMT",
118                     "DATE=RELATIVE_FULL,TIME=LONG",
119                     "ERA=1,YEAR=2012,MONTH=OCTOBER,DATE=8,HOUR_OF_DAY=23,MINUTE=59,SECOND=0",
120                     "Monday, October 8, 2012 at 11:59:00 PM GMT"
121                },
122                // normal formats, combined using ", "
123                {
124                     "en_US@calendar=gregorian",         
125                     "GMT",
126                     "DATE=RELATIVE_MEDIUM,TIME=SHORT",
127                     "ERA=1,YEAR=2012,MONTH=OCTOBER,DATE=8,HOUR_OF_DAY=23,MINUTE=59,SECOND=0",
128                     "Oct 8, 2012, 11:59 PM"
129                },
130                // formats with relative day, combined using 'at'
131                {
132                     "en_US@calendar=gregorian",         
133                     "GMT",
134                     "DATE=RELATIVE_FULL,TIME=LONG",
135                     "RELATIVE_ADD:DATE=-1,HOUR_OF_DAY=17,MINUTE=0,SECOND=0", // one day before now at specified time
136                     "yesterday at 5:00:00 PM GMT"
137                },
138                // formats with relative day, combined using ", "
139                {
140                     "en_US@calendar=gregorian",         
141                     "GMT",
142                     "DATE=RELATIVE_MEDIUM,TIME=SHORT",
143                     "RELATIVE_ADD:DATE=-1,HOUR_OF_DAY=17,MINUTE=0,SECOND=0", // one day before now at specified time
144                     "yesterday, 5:00 PM"
145                },
146                // normal formats that have quoted literals, combined
147                {
148                     "pt@calendar=gregorian",         
149                     "GMT",
150                     "DATE=RELATIVE_FULL,TIME=LONG",
151                     "ERA=1,YEAR=2012,MONTH=OCTOBER,DATE=8,HOUR_OF_DAY=23,MINUTE=59,SECOND=0",
152                     "segunda-feira, 8 de outubro de 2012 23:59:00 GMT"
153                },
154                // vi combined formats have time first
155                {
156                     "vi@calendar=gregorian",         
157                     "GMT",
158                     "DATE=RELATIVE_LONG,TIME=MEDIUM",
159                     "ERA=1,YEAR=2012,MONTH=OCTOBER,DATE=8,HOUR_OF_DAY=23,MINUTE=59,SECOND=0",
160                     "23:59:00 8 tháng 10, 2012"
161                },
162                {
163                     "vi@calendar=gregorian",         
164                     "GMT",
165                     "DATE=RELATIVE_LONG,TIME=MEDIUM",
166                     "RELATIVE_ADD:DATE=-1,HOUR_OF_DAY=17,MINUTE=0,SECOND=0", // one day before now at specified time
167                     "17:00:00 Hôm qua"
168                },
169                // el combines formats using hyphen
170                {
171                     "el@calendar=gregorian",         
172                     "GMT",
173                     "DATE=RELATIVE_LONG,TIME=MEDIUM",
174                     "ERA=1,YEAR=2012,MONTH=OCTOBER,DATE=8,HOUR_OF_DAY=23,MINUTE=59,SECOND=0",
175                     "8 Οκτωβρίου 2012 - 11:59:00 μ.μ."
176                },
177                {
178                     "el@calendar=gregorian",         
179                     "GMT",
180                     "DATE=RELATIVE_LONG,TIME=MEDIUM",
181                     "RELATIVE_ADD:DATE=-1,HOUR_OF_DAY=17,MINUTE=0,SECOND=0", // one day before now at specified time
182                     "χθες - 5:00:00 μ.μ."
183                },
184               // other tests
185                {
186                     "mt_MT@calendar=gregorian",         
187                     "",
188                     "DATE=RELATIVE_SHORT",
189                     "RELATIVE_ADD:DATE=1", // one day from now
190                     "Għada"
191                },
192                {
193                     "mt_MT@calendar=gregorian",         
194                     "",
195                     "DATE=RELATIVE_SHORT",
196                     "RELATIVE_MILLIS=0", // today
197                     "Illum"
198                },
199                {
200                     "mt_MT@calendar=gregorian",         
201                     "",
202                     "DATE=RELATIVE_SHORT",
203                     "RELATIVE_ADD:DATE=-1", // one day before now
204                     "Ilbieraħ"
205                },
206                {
207                     "ru",
208                     "",
209                     "DATE=RELATIVE_SHORT",
210                     "RELATIVE_ADD:DATE=-2", // 2 days ago
211                     "позавчера"
212                },
213             }
214         }
215         TestYearLengths {
216             Info {
217                 Description { "Test data for multiple year lengths, y yy yyy yyyy yyyyy:" }
218             }
219             Settings {
220                 // options: 'format', or 'parse'.  One can be omitted if this is a 1 way test.
221                 {
222                     Type { "date_format" }
223                 },
224 // These are not round trippable, so do not parse.
225 //                {
226 //                    Type { "date_parse" }
227 //                },
228             }
229             Headers { "locale", "zone", "spec", "date", "str"}
230             // locale: locale including calendar type
231             // zone:   time zone name, or "" to not explicitly set zone
232             // spec:   either 'PATTERN=y mm h' etc, or 'DATE=SHORT,TIME=LONG'
233             // date:   either 'MILLIS=####' where #### is millis,
234             //        or a calendar spec ERA=0,YEAR=1, etc.. applied to the calendar type specified by the locale
235             //        or RELATIVE_MILLIS=### where ### is a signed value which is added to the current millis
236             //        or RELATIVE_ADD:DATE=1  which means that the field "DATE" will be added by +1 relative to current time,
237             //           and any other fields present will be set explicitly.
238             // str:   the expected unicode string
239            
240 // from CLDR UTS 35: 
241 //Year          y       yy      yyy     yyyy    yyyyy
242             
243             Cases { 
244 //AD 1      1   01      001     0001    00001
245                {
246                     "en_US@calendar=gregorian",         
247                     "",
248                     "PATTERN=G y",
249                     "YEAR=1",
250                     "AD 1"
251                },
252                {
253                     "en_US@calendar=gregorian",         
254                     "",
255                     "PATTERN=G yy",
256                     "YEAR=1",
257                     "AD 01"
258                },
259                {
260                     "en_US@calendar=gregorian",         
261                     "",
262                     "PATTERN=G yyy",
263                     "YEAR=1",
264                     "AD 001"
265                },
266                {
267                     "en_US@calendar=gregorian",         
268                     "",
269                     "PATTERN=G yyyy",
270                     "YEAR=1",
271                     "AD 0001"
272                },
273                {
274                     "en_US@calendar=gregorian",         
275                     "",
276                     "PATTERN=G yyyyy",
277                     "YEAR=1",
278                     "AD 00001"
279                },
280 //AD 12         12      12      012     0012    00012
281                {
282                     "en_US@calendar=gregorian",         
283                     "",
284                     "PATTERN=G y",
285                     "YEAR=12",
286                     "AD 12"
287                },
288                {
289                     "en_US@calendar=gregorian",         
290                     "",
291                     "PATTERN=G yy",
292                     "YEAR=12",
293                     "AD 12"
294                },
295                {
296                     "en_US@calendar=gregorian",         
297                     "",
298                     "PATTERN=G yyy",
299                     "YEAR=12",
300                     "AD 012"
301                },
302                {
303                     "en_US@calendar=gregorian",         
304                     "",
305                     "PATTERN=G yyyy",
306                     "YEAR=12",
307                     "AD 0012"
308                },
309                {
310                     "en_US@calendar=gregorian",         
311                     "",
312                     "PATTERN=G yyyyy",
313                     "YEAR=12",
314                     "AD 00012"
315                },
316 //AD 123        123     23      123     0123    00123
317                {
318                     "en_US@calendar=gregorian",         
319                     "",
320                     "PATTERN=G y",
321                     "YEAR=123",
322                     "AD 123"
323                },
324                {
325                     "en_US@calendar=gregorian",         
326                     "",
327                     "PATTERN=G yy",
328                     "YEAR=123",
329                     "AD 23"
330                },
331                {
332                     "en_US@calendar=gregorian",         
333                     "",
334                     "PATTERN=G yyy",
335                     "YEAR=123",
336                     "AD 123"
337                },
338                {
339                     "en_US@calendar=gregorian",         
340                     "",
341                     "PATTERN=G yyyy",
342                     "YEAR=123",
343                     "AD 0123"
344                },
345                {
346                     "en_US@calendar=gregorian",         
347                     "",
348                     "PATTERN=G yyyyy",
349                     "YEAR=123",
350                     "AD 00123"
351                },
352 //AD 1234       1234    34      1234    1234    01234
353                {
354                     "en_US@calendar=gregorian",         
355                     "",
356                     "PATTERN=G y",
357                     "YEAR=1234",
358                     "AD 1234"
359                },
360                {
361                     "en_US@calendar=gregorian",         
362                     "",
363                     "PATTERN=G yy",
364                     "YEAR=1234",
365                     "AD 34"
366                },
367                {
368                     "en_US@calendar=gregorian",         
369                     "",
370                     "PATTERN=G yyy",
371                     "YEAR=1234",
372                     "AD 1234"
373                },
374                {
375                     "en_US@calendar=gregorian",         
376                     "",
377                     "PATTERN=G yyyy",
378                     "YEAR=1234",
379                     "AD 1234"
380                },
381                {
382                     "en_US@calendar=gregorian",         
383                     "",
384                     "PATTERN=G yyyyy",
385                     "YEAR=1234",
386                     "AD 01234"
387                },
388 //AD 12345      12345   45      12345   12345   12345
389                {
390                     "en_US@calendar=gregorian",         
391                     "",
392                     "PATTERN=G y",
393                     "YEAR=12345",
394                     "AD 12345"
395                },
396                {
397                     "en_US@calendar=gregorian",         
398                     "",
399                     "PATTERN=G yy",
400                     "YEAR=12345",
401                     "AD 45"
402                },
403                {
404                     "en_US@calendar=gregorian",         
405                     "",
406                     "PATTERN=G yyy",
407                     "YEAR=12345",
408                     "AD 12345"
409                },
410                {
411                     "en_US@calendar=gregorian",         
412                     "",
413                     "PATTERN=G yyyy",
414                     "YEAR=12345",
415                     "AD 12345"
416                },
417                {
418                     "en_US@calendar=gregorian",         
419                     "",
420                     "PATTERN=G yyyyy",
421                     "YEAR=12345",
422                     "AD 12345"
423                },
424             }
425         }
426         TestConsistentPivot {
427             Info {
428                 Description { "Test consistent pivot (parse/format) for multiple year lengths, y yy yyy yyyy yyyyy:" }
429             }
430             Settings {
431                 // options: 'format', or 'parse'.  One can be omitted if this is a 1 way test.
432                 {
433                     Type { "date_format" }
434                 },
435                 {
436                     Type { "date_parse" }
437                 },
438             }
439             Headers { "locale", "zone", "spec", "date", "str"}
440             // locale: locale including calendar type
441             // zone:   time zone name, or "" to not explicitly set zone
442             // spec:   either 'PATTERN=y mm h' etc, or 'DATE=SHORT,TIME=LONG'
443             // date:   either 'MILLIS=####' where #### is millis,
444             //        or a calendar spec ERA=0,YEAR=1, etc.. applied to the calendar type specified by the locale
445             //        or RELATIVE_MILLIS=### where ### is a signed value which is added to the current millis
446             //        or RELATIVE_ADD:DATE=1  which means that the field "DATE" will be added by +1 relative to current time,
447             //           and any other fields present will be set explicitly.
448             // str:   the expected unicode string
449            
450 // from CLDR UTS 35: 
451 //Year          y       yy      yyy     yyyy    yyyyy
452             
453             Cases { 
454 //AD 1      1   01      001     0001    00001
455                {
456                     "en_US@calendar=gregorian",         
457                     "",
458                     "PATTERN=G y",
459                     "YEAR=2008",
460                     "AD 2008"
461                },
462                {
463                     "en_US@calendar=gregorian",         
464                     "",
465                     "PATTERN=G yy",
466                     "YEAR=2008",
467                     "AD 08"
468                },
469                {
470                     "en_US@calendar=gregorian",         
471                     "",
472                     "PATTERN=G yyy",
473                     "YEAR=2008",
474                     "AD 2008"
475                },
476                {
477                     "en_US@calendar=gregorian",         
478                     "",
479                     "PATTERN=G yyyy",
480                     "YEAR=2008",
481                     "AD 2008"
482                },
483                {
484                     "en_US@calendar=gregorian",         
485                     "",
486                     "PATTERN=G yyyyy",
487                     "YEAR=2008",
488                     "AD 02008"
489                },
490
491                                 // Japanese
492                {
493                     "en_US@calendar=japanese",         
494                     "",
495                     "PATTERN=G y",
496                     "YEAR=8",
497                     "Heisei 8"
498                },
499                {
500                     "en_US@calendar=japanese",         
501                     "",
502                     "PATTERN=G yy",
503                     "YEAR=8",
504                     "Heisei 08"
505                },
506                {
507                     "en_US@calendar=japanese",         
508                     "",
509                     "PATTERN=G yyy",
510                     "YEAR=8",
511                     "Heisei 008"
512                },
513                {
514                     "en_US@calendar=japanese",         
515                     "",
516                     "PATTERN=G yyyy",
517                     "YEAR=8",
518                     "Heisei 0008"
519                },
520                {
521                     "en_US@calendar=japanese",         
522                     "",
523                     "PATTERN=G yyyyy",
524                     "YEAR=8",
525                     "Heisei 00008"
526                },
527
528             }
529         }
530         TestHebrew{
531             Info {
532                 Description { "Test Hebrew calendar:" }
533             }
534             Settings {
535                 // options: 'format', or 'parse'.  One can be omitted if this is a 1 way test.
536                 {
537                     Type { "date_format" }
538                 },
539             }
540             Headers { "locale", "zone", "spec", "date", "str"}
541             // locale: locale including calendar type
542             // zone:   time zone name, or "" to not explicitly set zone
543             // spec:   either 'PATTERN=y mm h' etc, or 'DATE=SHORT,TIME=LONG'
544             // date:   either 'MILLIS=####' where #### is millis,
545             //        or a calendar spec ERA=0,YEAR=1, etc.. applied to the calendar type specified by the locale
546             //        or RELATIVE_MILLIS=### where ### is a signed value which is added to the current millis
547             //        or RELATIVE_ADD:DATE=1  which means that the field "DATE" will be added by +1 relative to current time,
548             //           and any other fields present will be set explicitly.
549             // str:   the expected unicode string
550             
551             Cases { 
552                {
553                     "en_US@calendar=hebrew",         
554                     "",
555                     "DATE=FULL,TIME=FULL",
556                     "MILLIS=3076424179200000",
557                     "Friday, 3 Heshvan 103217 at 12:00:00 AM GMT-08:00"
558                },
559             }    
560         }
561         TestMoreDateParse {
562             Info {
563                 Description { "Additional date parse tests (may not
564                round/trip to format.)" }
565             }
566             Settings {
567                 // options: 'format', or 'parse'.  One can be omitted if this is a 1 way test.
568                 {
569                     Type { "date_parse" }
570                 },
571             }
572             Headers { "locale", "zone", "spec", "date", "str"}
573             // locale: locale including calendar type
574             // zone:   time zone name, or "" to not explicitly set zone
575             // spec:   either 'PATTERN=y mm h' etc, or 'DATE=SHORT,TIME=LONG'
576             // date:   either 'MILLIS=####' where #### is millis,
577             //        or a calendar spec ERA=0,YEAR=1, etc.. applied to the calendar type specified by the locale
578             //        or RELATIVE_MILLIS=### where ### is a signed value which is added to the current millis
579             //        or RELATIVE_ADD:DATE=1  which means that the field "DATE" will be added by +1 relative to current time,
580             //           and any other fields present will be set explicitly.
581             // str:   the expected unicode string
582             
583             Cases { 
584                {
585                     "en_US@calendar=gregorian",         
586                     "",
587                     "PATTERN=YYYYHHmmssEEEww",
588                     "YEAR=1999,HOUR_OF_DAY=4,MINUTE=5,SECOND=6,DAY_OF_WEEK=2,WEEK_OF_YEAR=4",
589                // won't roundtrip.
590                     "1998040506MON56"
591                }
592             }    
593         }
594     }        
595 }