]> git.saurik.com Git - apple/icu.git/blame - icuSources/test/testdata/format.txt
ICU-64260.0.1.tar.gz
[apple/icu.git] / icuSources / test / testdata / format.txt
CommitLineData
f3c0d7a5
A
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
46f4442e
A
4// Corporation and others. All Rights Reserved.
5format: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 }
51004dcb 24 Headers { "locale", "zone", "spec", "date", "str"}
46f4442e 25 // locale: locale including calendar type
51004dcb 26 // zone: time zone name, or "" to not explicitly set zone
46f4442e
A
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
51004dcb
A
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.
46f4442e
A
33 // str: the expected unicode string
34 Cases {
35 {
51004dcb
A
36 "en_US@calendar=gregorian",
37 "",
46f4442e
A
38 "DATE=SHORT,TIME=SHORT",
39 "ERA=1,YEAR=2007,MONTH=AUGUST,DATE=8,HOUR_OF_DAY=18,MINUTE=54,SECOND=0",
51004dcb 40 "8/8/07, 6:54 PM"
46f4442e
A
41 },
42 {
43 "zh_TW@calendar=roc",
51004dcb 44 "",
46f4442e
A
45 "DATE=LONG",
46 "ERA=1,YEAR=98,MONTH=0,DATE=24",
3d1f044b 47 "民國 98年1月24日",
46f4442e
A
48 },
49 {
50 //民國前2年1月24日 -> 1910-1-24
51 "zh_TW@calendar=roc",
51004dcb 52 "",
46f4442e
A
53 "DATE=LONG",
54 "ERA=0,YEAR=2,MONTH=0,DATE=24",
3d1f044b 55 "民國前 2年1月24日",
46f4442e
A
56 },
57 }
58 }
59 TestFormatRelative {
60 Info {
61 Description { "relative format :" }
62 }
63 Settings {
64 {
65 Type { "date_format" }
66 },
67 }
51004dcb 68 Headers { "locale", "zone", "spec", "date", "str"}
46f4442e
A
69 Cases {
70 {
71 "en_US@calendar=gregorian",
51004dcb 72 "",
46f4442e
A
73 "DATE=RELATIVE_SHORT",
74 "RELATIVE_ADD:DATE=1", // one day from now
57a6839d 75 "tomorrow"
46f4442e
A
76 },
77 {
78 "en_US@calendar=gregorian",
51004dcb 79 "",
46f4442e
A
80 "DATE=RELATIVE_SHORT",
81 "RELATIVE_MILLIS=0", // today
57a6839d 82 "today"
46f4442e
A
83 },
84 {
85 "en_US@calendar=gregorian",
51004dcb 86 "",
46f4442e
A
87 "DATE=RELATIVE_SHORT",
88 "RELATIVE_ADD:DATE=-1", // one day before now
57a6839d 89 "yesterday"
46f4442e 90 },
51004dcb
A
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 },
f3c0d7a5 122 // normal formats, combined using 'at'
51004dcb
A
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",
f3c0d7a5 128 "Oct 8, 2012 at 11:59 PM"
51004dcb
A
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
57a6839d 136 "yesterday at 5:00:00 PM GMT"
51004dcb 137 },
f3c0d7a5 138 // formats with relative day, combined using 'at'
51004dcb
A
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
f3c0d7a5 144 "yesterday at 5:00 PM"
51004dcb
A
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",
57a6839d 152 "segunda-feira, 8 de outubro de 2012 23:59:00 GMT"
51004dcb
A
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",
f3c0d7a5 160 "23:59:00 ngày 8 tháng 10, 2012"
51004dcb
A
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
2ca993e8 167 "17:00:00 Hôm qua"
51004dcb
A
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",
d25163bf 175 "8 Οκτωβρίου 2012 - 11:59:00 μμ"
51004dcb
A
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
d25163bf 182 "χθες - 5:00:00 μμ"
51004dcb
A
183 },
184 // other tests
46f4442e
A
185 {
186 "mt_MT@calendar=gregorian",
51004dcb 187 "",
46f4442e
A
188 "DATE=RELATIVE_SHORT",
189 "RELATIVE_ADD:DATE=1", // one day from now
3d1f044b 190 "għada"
46f4442e
A
191 },
192 {
193 "mt_MT@calendar=gregorian",
51004dcb 194 "",
46f4442e
A
195 "DATE=RELATIVE_SHORT",
196 "RELATIVE_MILLIS=0", // today
3d1f044b 197 "illum"
46f4442e
A
198 },
199 {
200 "mt_MT@calendar=gregorian",
51004dcb 201 "",
46f4442e
A
202 "DATE=RELATIVE_SHORT",
203 "RELATIVE_ADD:DATE=-1", // one day before now
3d1f044b 204 "lbieraħ"
46f4442e
A
205 },
206 {
207 "ru",
51004dcb 208 "",
46f4442e
A
209 "DATE=RELATIVE_SHORT",
210 "RELATIVE_ADD:DATE=-2", // 2 days ago
57a6839d 211 "позавчера"
46f4442e
A
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 }
51004dcb 229 Headers { "locale", "zone", "spec", "date", "str"}
46f4442e 230 // locale: locale including calendar type
51004dcb 231 // zone: time zone name, or "" to not explicitly set zone
46f4442e
A
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
51004dcb
A
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.
46f4442e
A
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",
51004dcb 247 "",
46f4442e
A
248 "PATTERN=G y",
249 "YEAR=1",
250 "AD 1"
251 },
252 {
253 "en_US@calendar=gregorian",
51004dcb 254 "",
46f4442e
A
255 "PATTERN=G yy",
256 "YEAR=1",
257 "AD 01"
258 },
259 {
260 "en_US@calendar=gregorian",
51004dcb 261 "",
46f4442e
A
262 "PATTERN=G yyy",
263 "YEAR=1",
264 "AD 001"
265 },
266 {
267 "en_US@calendar=gregorian",
51004dcb 268 "",
46f4442e
A
269 "PATTERN=G yyyy",
270 "YEAR=1",
271 "AD 0001"
272 },
273 {
274 "en_US@calendar=gregorian",
51004dcb 275 "",
46f4442e
A
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",
51004dcb 283 "",
46f4442e
A
284 "PATTERN=G y",
285 "YEAR=12",
286 "AD 12"
287 },
288 {
289 "en_US@calendar=gregorian",
51004dcb 290 "",
46f4442e
A
291 "PATTERN=G yy",
292 "YEAR=12",
293 "AD 12"
294 },
295 {
296 "en_US@calendar=gregorian",
51004dcb 297 "",
46f4442e
A
298 "PATTERN=G yyy",
299 "YEAR=12",
300 "AD 012"
301 },
302 {
303 "en_US@calendar=gregorian",
51004dcb 304 "",
46f4442e
A
305 "PATTERN=G yyyy",
306 "YEAR=12",
307 "AD 0012"
308 },
309 {
310 "en_US@calendar=gregorian",
51004dcb 311 "",
46f4442e
A
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",
51004dcb 319 "",
46f4442e
A
320 "PATTERN=G y",
321 "YEAR=123",
322 "AD 123"
323 },
324 {
325 "en_US@calendar=gregorian",
51004dcb 326 "",
46f4442e
A
327 "PATTERN=G yy",
328 "YEAR=123",
329 "AD 23"
330 },
331 {
332 "en_US@calendar=gregorian",
51004dcb 333 "",
46f4442e
A
334 "PATTERN=G yyy",
335 "YEAR=123",
336 "AD 123"
337 },
338 {
339 "en_US@calendar=gregorian",
51004dcb 340 "",
46f4442e
A
341 "PATTERN=G yyyy",
342 "YEAR=123",
343 "AD 0123"
344 },
345 {
346 "en_US@calendar=gregorian",
51004dcb 347 "",
46f4442e
A
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",
51004dcb 355 "",
46f4442e
A
356 "PATTERN=G y",
357 "YEAR=1234",
358 "AD 1234"
359 },
360 {
361 "en_US@calendar=gregorian",
51004dcb 362 "",
46f4442e
A
363 "PATTERN=G yy",
364 "YEAR=1234",
365 "AD 34"
366 },
367 {
368 "en_US@calendar=gregorian",
51004dcb 369 "",
46f4442e
A
370 "PATTERN=G yyy",
371 "YEAR=1234",
372 "AD 1234"
373 },
374 {
375 "en_US@calendar=gregorian",
51004dcb 376 "",
46f4442e
A
377 "PATTERN=G yyyy",
378 "YEAR=1234",
379 "AD 1234"
380 },
381 {
382 "en_US@calendar=gregorian",
51004dcb 383 "",
46f4442e
A
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",
51004dcb 391 "",
46f4442e
A
392 "PATTERN=G y",
393 "YEAR=12345",
394 "AD 12345"
395 },
396 {
397 "en_US@calendar=gregorian",
51004dcb 398 "",
46f4442e
A
399 "PATTERN=G yy",
400 "YEAR=12345",
401 "AD 45"
402 },
403 {
404 "en_US@calendar=gregorian",
51004dcb 405 "",
46f4442e
A
406 "PATTERN=G yyy",
407 "YEAR=12345",
408 "AD 12345"
409 },
410 {
411 "en_US@calendar=gregorian",
51004dcb 412 "",
46f4442e
A
413 "PATTERN=G yyyy",
414 "YEAR=12345",
415 "AD 12345"
416 },
417 {
418 "en_US@calendar=gregorian",
51004dcb 419 "",
46f4442e
A
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 }
51004dcb 439 Headers { "locale", "zone", "spec", "date", "str"}
46f4442e 440 // locale: locale including calendar type
51004dcb 441 // zone: time zone name, or "" to not explicitly set zone
46f4442e
A
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
51004dcb
A
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.
46f4442e
A
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",
51004dcb 457 "",
46f4442e
A
458 "PATTERN=G y",
459 "YEAR=2008",
460 "AD 2008"
461 },
462 {
463 "en_US@calendar=gregorian",
51004dcb 464 "",
46f4442e
A
465 "PATTERN=G yy",
466 "YEAR=2008",
467 "AD 08"
468 },
469 {
470 "en_US@calendar=gregorian",
51004dcb 471 "",
46f4442e
A
472 "PATTERN=G yyy",
473 "YEAR=2008",
474 "AD 2008"
475 },
476 {
477 "en_US@calendar=gregorian",
51004dcb 478 "",
46f4442e
A
479 "PATTERN=G yyyy",
480 "YEAR=2008",
481 "AD 2008"
482 },
483 {
484 "en_US@calendar=gregorian",
51004dcb 485 "",
46f4442e
A
486 "PATTERN=G yyyyy",
487 "YEAR=2008",
488 "AD 02008"
489 },
490
491 // Japanese
3d1f044b
A
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// },
46f4442e
A
527
528 }
529 }
729e4ab9
A
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 }
51004dcb 540 Headers { "locale", "zone", "spec", "date", "str"}
729e4ab9 541 // locale: locale including calendar type
51004dcb 542 // zone: time zone name, or "" to not explicitly set zone
729e4ab9
A
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
51004dcb
A
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.
729e4ab9
A
549 // str: the expected unicode string
550
551 Cases {
552 {
553 "en_US@calendar=hebrew",
51004dcb 554 "",
729e4ab9
A
555 "DATE=FULL,TIME=FULL",
556 "MILLIS=3076424179200000",
57a6839d 557 "Friday, 3 Heshvan 103217 at 12:00:00 AM GMT-08:00"
729e4ab9
A
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 }
51004dcb 572 Headers { "locale", "zone", "spec", "date", "str"}
729e4ab9 573 // locale: locale including calendar type
51004dcb 574 // zone: time zone name, or "" to not explicitly set zone
729e4ab9
A
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
51004dcb
A
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.
729e4ab9
A
581 // str: the expected unicode string
582
583 Cases {
584 {
585 "en_US@calendar=gregorian",
51004dcb 586 "",
729e4ab9
A
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 }
46f4442e 595}