1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
// Copyright (c) 2007 International Business Machines
// Corporation and others. All Rights Reserved.
format:table(nofallback) {
Info {
Description { "These are the data driven format tests" }
LongDescription { "Data for data driven format tests." }
}
TestData {
TestDateFormatBasic {
Info {
Description { "Test data for format and parse :" }
}
Settings {
// options: 'format', or 'parse'. One can be omitted if this is a 1 way test.
{
Type { "date_format" }
},
{
Type { "date_parse" }
},
}
Headers { "locale","spec", "date", "str"}
// locale: locale including calendar type
// spec: either 'PATTERN=y mm h' etc, or 'DATE=SHORT,TIME=LONG'
// date: either 'MILLIS=####' where #### is an unsigned long (millis), or a calendar spec ERA=0,YEAR=1, etc.. applied to the calendar type specified by the locale
// str: the expected unicode string
Cases {
{
"en_US@calendar=gregorian",
"DATE=SHORT,TIME=SHORT",
"ERA=1,YEAR=2007,MONTH=AUGUST,DATE=8,HOUR_OF_DAY=18,MINUTE=54,SECOND=0",
"8/8/07 6:54 PM"
},
{
"zh_TW@calendar=taiwan",
"DATE=LONG",
"ERA=1,YEAR=98,MONTH=0,DATE=24",
"民國98年1月24日",
},
{
//民國前2年1月24日 -> 1910-1-24
"zh_TW@calendar=taiwan",
"DATE=LONG",
"ERA=0,YEAR=2,MONTH=0,DATE=24",
"民國前2年1月24日",
},
}
}
TestFormatRelative {
Info {
Description { "relative format :" }
}
Settings {
{
Type { "date_format" }
},
}
Headers { "locale","spec", "date", "str"}
Cases {
{
"en_US@calendar=gregorian",
"DATE=RELATIVE_SHORT",
"RELATIVE_MILLIS=86410000", // one day from now
"Tomorrow"
},
{
"en_US@calendar=gregorian",
"DATE=RELATIVE_SHORT",
"RELATIVE_MILLIS=0", // one day before now
"Today"
},
{
"en_US@calendar=gregorian",
"DATE=RELATIVE_SHORT",
"RELATIVE_MILLIS=-86410000", // one day before now
"Yesterday"
},
{
"mt_MT@calendar=gregorian",
"DATE=RELATIVE_SHORT",
"RELATIVE_MILLIS=86410000", // one day from now
"Għada"
},
{
"mt_MT@calendar=gregorian",
"DATE=RELATIVE_SHORT",
"RELATIVE_MILLIS=0", // one day before now
"Illum"
},
{
"mt_MT@calendar=gregorian",
"DATE=RELATIVE_SHORT",
"RELATIVE_MILLIS=-86410000", // one day before now
"Lbieraħ"
},
{
"ru",
"DATE=RELATIVE_SHORT",
"RELATIVE_MILLIS=-172810000", // 2 days ago
"Позавчера"
},
}
}
}
}
|