1// Copyright (c) 2007-2010 International Business Machines 2// Corporation and others. All Rights Reserved. 3format:table(nofallback) { 4 Info { 5 Description { "These are the data driven format tests" } 6 LongDescription { "Data for data driven format tests." } 7 } 8 TestData { 9 TestDateFormatBasic { 10 Info { 11 Description { "Test data for format and parse :" } 12 } 13 Settings { 14 // options: 'format', or 'parse'. One can be omitted if this is a 1 way test. 15 { 16 Type { "date_format" } 17 }, 18 { 19 Type { "date_parse" } 20 }, 21 } 22 Headers { "locale","spec", "date", "str"} 23 // locale: locale including calendar type 24 // spec: either 'PATTERN=y mm h' etc, or 'DATE=SHORT,TIME=LONG' 25 // date: either 'MILLIS=####' where #### is millis, 26 // or a calendar spec ERA=0,YEAR=1, etc.. applied to the calendar type specified by the locale 27 // or RELATIVE_MILLIS=### where ### is a signed value which is added to the current millis 28 // or RELATIVE_ADD:DATE=1 which means that the field "DATE" will be added by +1 relative to current time 29 // str: the expected unicode string 30 Cases { 31 { 32 "en_US@calendar=gregorian", 33 "DATE=SHORT,TIME=SHORT", 34 "ERA=1,YEAR=2007,MONTH=AUGUST,DATE=8,HOUR_OF_DAY=18,MINUTE=54,SECOND=0", 35 "8/8/07 6:54 PM" 36 }, 37 { 38 "zh_TW@calendar=roc", 39 "DATE=LONG", 40 "ERA=1,YEAR=98,MONTH=0,DATE=24", 41 "民國98年1月24日", 42 }, 43 { 44 //民國前2年1月24日 -> 1910-1-24 45 "zh_TW@calendar=roc", 46 "DATE=LONG", 47 "ERA=0,YEAR=2,MONTH=0,DATE=24", 48 "民國前2年1月24日", 49 }, 50 } 51 } 52 TestFormatRelative { 53 Info { 54 Description { "relative format :" } 55 } 56 Settings { 57 { 58 Type { "date_format" } 59 }, 60 } 61 Headers { "locale","spec", "date", "str"} 62 Cases { 63 { 64 "en_US@calendar=gregorian", 65 "DATE=RELATIVE_SHORT", 66 "RELATIVE_ADD:DATE=1", // one day from now 67 "Tomorrow" 68 }, 69 { 70 "en_US@calendar=gregorian", 71 "DATE=RELATIVE_SHORT", 72 "RELATIVE_MILLIS=0", // today 73 "Today" 74 }, 75 { 76 "en_US@calendar=gregorian", 77 "DATE=RELATIVE_SHORT", 78 "RELATIVE_ADD:DATE=-1", // one day before now 79 "Yesterday" 80 }, 81 { 82 "mt_MT@calendar=gregorian", 83 "DATE=RELATIVE_SHORT", 84 "RELATIVE_ADD:DATE=1", // one day from now 85 "Għada" 86 }, 87 { 88 "mt_MT@calendar=gregorian", 89 "DATE=RELATIVE_SHORT", 90 "RELATIVE_MILLIS=0", // today 91 "Illum" 92 }, 93 { 94 "mt_MT@calendar=gregorian", 95 "DATE=RELATIVE_SHORT", 96 "RELATIVE_ADD:DATE=-1", // one day before now 97 "Lbieraħ" 98 }, 99 { 100 "ru", 101 "DATE=RELATIVE_SHORT", 102 "RELATIVE_ADD:DATE=-2", // 2 days ago 103 "Позавчера" 104 }, 105 } 106 } 107 TestYearLengths { 108 Info { 109 Description { "Test data for multiple year lengths, y yy yyy yyyy yyyyy:" } 110 } 111 Settings { 112 // options: 'format', or 'parse'. One can be omitted if this is a 1 way test. 113 { 114 Type { "date_format" } 115 }, 116// These are not round trippable, so do not parse. 117// { 118// Type { "date_parse" } 119// }, 120 } 121 Headers { "locale","spec", "date", "str"} 122 // locale: locale including calendar type 123 // spec: either 'PATTERN=y mm h' etc, or 'DATE=SHORT,TIME=LONG' 124 // date: either 'MILLIS=####' where #### is millis, 125 // or a calendar spec ERA=0,YEAR=1, etc.. applied to the calendar type specified by the locale 126 // or RELATIVE_MILLIS=### where ### is a signed value which is added to the current millis 127 // or RELATIVE_ADD:DATE=1 which means that the field "DATE" will be added by +1 relative to current time 128 // str: the expected unicode string 129 130// from CLDR UTS 35: 131//Year y yy yyy yyyy yyyyy 132 133 Cases { 134//AD 1 1 01 001 0001 00001 135 { 136 "en_US@calendar=gregorian", 137 "PATTERN=G y", 138 "YEAR=1", 139 "AD 1" 140 }, 141 { 142 "en_US@calendar=gregorian", 143 "PATTERN=G yy", 144 "YEAR=1", 145 "AD 01" 146 }, 147 { 148 "en_US@calendar=gregorian", 149 "PATTERN=G yyy", 150 "YEAR=1", 151 "AD 001" 152 }, 153 { 154 "en_US@calendar=gregorian", 155 "PATTERN=G yyyy", 156 "YEAR=1", 157 "AD 0001" 158 }, 159 { 160 "en_US@calendar=gregorian", 161 "PATTERN=G yyyyy", 162 "YEAR=1", 163 "AD 00001" 164 }, 165//AD 12 12 12 012 0012 00012 166 { 167 "en_US@calendar=gregorian", 168 "PATTERN=G y", 169 "YEAR=12", 170 "AD 12" 171 }, 172 { 173 "en_US@calendar=gregorian", 174 "PATTERN=G yy", 175 "YEAR=12", 176 "AD 12" 177 }, 178 { 179 "en_US@calendar=gregorian", 180 "PATTERN=G yyy", 181 "YEAR=12", 182 "AD 012" 183 }, 184 { 185 "en_US@calendar=gregorian", 186 "PATTERN=G yyyy", 187 "YEAR=12", 188 "AD 0012" 189 }, 190 { 191 "en_US@calendar=gregorian", 192 "PATTERN=G yyyyy", 193 "YEAR=12", 194 "AD 00012" 195 }, 196//AD 123 123 23 123 0123 00123 197 { 198 "en_US@calendar=gregorian", 199 "PATTERN=G y", 200 "YEAR=123", 201 "AD 123" 202 }, 203 { 204 "en_US@calendar=gregorian", 205 "PATTERN=G yy", 206 "YEAR=123", 207 "AD 23" 208 }, 209 { 210 "en_US@calendar=gregorian", 211 "PATTERN=G yyy", 212 "YEAR=123", 213 "AD 123" 214 }, 215 { 216 "en_US@calendar=gregorian", 217 "PATTERN=G yyyy", 218 "YEAR=123", 219 "AD 0123" 220 }, 221 { 222 "en_US@calendar=gregorian", 223 "PATTERN=G yyyyy", 224 "YEAR=123", 225 "AD 00123" 226 }, 227//AD 1234 1234 34 1234 1234 01234 228 { 229 "en_US@calendar=gregorian", 230 "PATTERN=G y", 231 "YEAR=1234", 232 "AD 1234" 233 }, 234 { 235 "en_US@calendar=gregorian", 236 "PATTERN=G yy", 237 "YEAR=1234", 238 "AD 34" 239 }, 240 { 241 "en_US@calendar=gregorian", 242 "PATTERN=G yyy", 243 "YEAR=1234", 244 "AD 1234" 245 }, 246 { 247 "en_US@calendar=gregorian", 248 "PATTERN=G yyyy", 249 "YEAR=1234", 250 "AD 1234" 251 }, 252 { 253 "en_US@calendar=gregorian", 254 "PATTERN=G yyyyy", 255 "YEAR=1234", 256 "AD 01234" 257 }, 258//AD 12345 12345 45 12345 12345 12345 259 { 260 "en_US@calendar=gregorian", 261 "PATTERN=G y", 262 "YEAR=12345", 263 "AD 12345" 264 }, 265 { 266 "en_US@calendar=gregorian", 267 "PATTERN=G yy", 268 "YEAR=12345", 269 "AD 45" 270 }, 271 { 272 "en_US@calendar=gregorian", 273 "PATTERN=G yyy", 274 "YEAR=12345", 275 "AD 12345" 276 }, 277 { 278 "en_US@calendar=gregorian", 279 "PATTERN=G yyyy", 280 "YEAR=12345", 281 "AD 12345" 282 }, 283 { 284 "en_US@calendar=gregorian", 285 "PATTERN=G yyyyy", 286 "YEAR=12345", 287 "AD 12345" 288 }, 289 } 290 } 291 TestConsistentPivot { 292 Info { 293 Description { "Test consistent pivot (parse/format) for multiple year lengths, y yy yyy yyyy yyyyy:" } 294 } 295 Settings { 296 // options: 'format', or 'parse'. One can be omitted if this is a 1 way test. 297 { 298 Type { "date_format" } 299 }, 300 { 301 Type { "date_parse" } 302 }, 303 } 304 Headers { "locale","spec", "date", "str"} 305 // locale: locale including calendar type 306 // spec: either 'PATTERN=y mm h' etc, or 'DATE=SHORT,TIME=LONG' 307 // date: either 'MILLIS=####' where #### is millis, 308 // or a calendar spec ERA=0,YEAR=1, etc.. applied to the calendar type specified by the locale 309 // or RELATIVE_MILLIS=### where ### is a signed value which is added to the current millis 310 // or RELATIVE_ADD:DATE=1 which means that the field "DATE" will be added by +1 relative to current time 311 // str: the expected unicode string 312 313// from CLDR UTS 35: 314//Year y yy yyy yyyy yyyyy 315 316 Cases { 317//AD 1 1 01 001 0001 00001 318 { 319 "en_US@calendar=gregorian", 320 "PATTERN=G y", 321 "YEAR=2008", 322 "AD 2008" 323 }, 324 { 325 "en_US@calendar=gregorian", 326 "PATTERN=G yy", 327 "YEAR=2008", 328 "AD 08" 329 }, 330 { 331 "en_US@calendar=gregorian", 332 "PATTERN=G yyy", 333 "YEAR=2008", 334 "AD 2008" 335 }, 336 { 337 "en_US@calendar=gregorian", 338 "PATTERN=G yyyy", 339 "YEAR=2008", 340 "AD 2008" 341 }, 342 { 343 "en_US@calendar=gregorian", 344 "PATTERN=G yyyyy", 345 "YEAR=2008", 346 "AD 02008" 347 }, 348 349 // Japanese 350 { 351 "en_US@calendar=japanese", 352 "PATTERN=G y", 353 "YEAR=8", 354 "Heisei 8" 355 }, 356 { 357 "en_US@calendar=japanese", 358 "PATTERN=G yy", 359 "YEAR=8", 360 "Heisei 08" 361 }, 362 { 363 "en_US@calendar=japanese", 364 "PATTERN=G yyy", 365 "YEAR=8", 366 "Heisei 008" 367 }, 368 { 369 "en_US@calendar=japanese", 370 "PATTERN=G yyyy", 371 "YEAR=8", 372 "Heisei 0008" 373 }, 374 { 375 "en_US@calendar=japanese", 376 "PATTERN=G yyyyy", 377 "YEAR=8", 378 "Heisei 00008" 379 }, 380 381 } 382 } 383 TestHebrew{ 384 Info { 385 Description { "Test Hebrew calendar:" } 386 } 387 Settings { 388 // options: 'format', or 'parse'. One can be omitted if this is a 1 way test. 389 { 390 Type { "date_format" } 391 }, 392 } 393 Headers { "locale","spec", "date", "str"} 394 // locale: locale including calendar type 395 // spec: either 'PATTERN=y mm h' etc, or 'DATE=SHORT,TIME=LONG' 396 // date: either 'MILLIS=####' where #### is millis, 397 // or a calendar spec ERA=0,YEAR=1, etc.. applied to the calendar type specified by the locale 398 // or RELATIVE_MILLIS=### where ### is a signed value which is added to the current millis 399 // or RELATIVE_ADD:DATE=1 which means that the field "DATE" will be added by +1 relative to current time 400 // str: the expected unicode string 401 402 Cases { 403 { 404 "en_US@calendar=hebrew", 405 "DATE=FULL,TIME=FULL", 406 "MILLIS=3076424179200000", 407 "Friday, Heshvan 3, 103217 12:00:00 AM GMT-08:00" 408 }, 409 } 410 } 411 TestMoreDateParse { 412 Info { 413 Description { "Additional date parse tests (may not 414 round/trip to format.)" } 415 } 416 Settings { 417 // options: 'format', or 'parse'. One can be omitted if this is a 1 way test. 418 { 419 Type { "date_parse" } 420 }, 421 } 422 Headers { "locale","spec", "date", "str"} 423 // locale: locale including calendar type 424 // spec: either 'PATTERN=y mm h' etc, or 'DATE=SHORT,TIME=LONG' 425 // date: either 'MILLIS=####' where #### is millis, 426 // or a calendar spec ERA=0,YEAR=1, etc.. applied to the calendar type specified by the locale 427 // or RELATIVE_MILLIS=### where ### is a signed value which is added to the current millis 428 // or RELATIVE_ADD:DATE=1 which means that the field "DATE" will be added by +1 relative to current time 429 // str: the expected unicode string 430 431 Cases { 432 { 433 "en_US@calendar=gregorian", 434 "PATTERN=YYYYHHmmssEEEww", 435 "YEAR=1999,HOUR_OF_DAY=4,MINUTE=5,SECOND=6,DAY_OF_WEEK=2,WEEK_OF_YEAR=4", 436 // won't roundtrip. 437 "1998040506MON56" 438 } 439 } 440 } 441 } 442} 443