Debian Codegraph @

share/tests/v1/format/time.json

raw
1 [
2 {
3 "description": "validation of time strings",
4 "schema": {
5 "$schema": "https://json-schema.org/v1",
6 "format": "time"
7 },
8 "tests": [
9 {
10 "description": "all string formats ignore integers",
11 "data": 12,
12 "valid": true
13 },
14 {
15 "description": "all string formats ignore floats",
16 "data": 13.7,
17 "valid": true
18 },
19 {
20 "description": "all string formats ignore objects",
21 "data": {},
22 "valid": true
23 },
24 {
25 "description": "all string formats ignore arrays",
26 "data": [],
27 "valid": true
28 },
29 {
30 "description": "all string formats ignore booleans",
31 "data": false,
32 "valid": true
33 },
34 {
35 "description": "all string formats ignore nulls",
36 "data": null,
37 "valid": true
38 },
39 {
40 "description": "a valid time string",
41 "data": "08:30:06Z",
42 "valid": true
43 },
44 {
45 "description": "invalid time string with extra leading zeros",
46 "data": "008:030:006Z",
47 "valid": false
48 },
49 {
50 "description": "invalid time string with no leading zero for single digit",
51 "data": "8:3:6Z",
52 "valid": false
53 },
54 {
55 "description": "hour, minute, second must be two digits",
56 "data": "8:0030:6Z",
57 "valid": false
58 },
59 {
60 "description": "a leap second is not a valid time",
61 "data": "23:59:60Z",
62 "valid": false
63 },
64 {
65 "description": "invalid leap second, Zulu (wrong hour)",
66 "data": "22:59:60Z",
67 "valid": false
68 },
69 {
70 "description": "invalid leap second, Zulu (wrong minute)",
71 "data": "23:58:60Z",
72 "valid": false
73 },
74 {
75 "description": "a leap second with a zero time-offset is not a valid time",
76 "data": "23:59:60+00:00",
77 "valid": false
78 },
79 {
80 "description": "invalid leap second, zero time-offset (wrong hour)",
81 "data": "22:59:60+00:00",
82 "valid": false
83 },
84 {
85 "description": "invalid leap second, zero time-offset (wrong minute)",
86 "data": "23:58:60+00:00",
87 "valid": false
88 },
89 {
90 "description": "a leap second with a positive time-offset is not a valid time",
91 "data": "01:29:60+01:30",
92 "valid": false
93 },
94 {
95 "description": "a leap second with a large positive time-offset is not a valid time",
96 "data": "23:29:60+23:30",
97 "valid": false
98 },
99 {
100 "description": "invalid leap second, positive time-offset (wrong hour)",
101 "data": "23:59:60+01:00",
102 "valid": false
103 },
104 {
105 "description": "invalid leap second, positive time-offset (wrong minute)",
106 "data": "23:59:60+00:30",
107 "valid": false
108 },
109 {
110 "description": "a leap second with a negative time-offset is not a valid time",
111 "data": "15:59:60-08:00",
112 "valid": false
113 },
114 {
115 "description": "a leap second with a large negative time-offset is not a valid time",
116 "data": "00:29:60-23:30",
117 "valid": false
118 },
119 {
120 "description": "invalid leap second, negative time-offset (wrong hour)",
121 "data": "23:59:60-01:00",
122 "valid": false
123 },
124 {
125 "description": "invalid leap second, negative time-offset (wrong minute)",
126 "data": "23:59:60-00:30",
127 "valid": false
128 },
129 {
130 "description": "a valid time string with second fraction",
131 "data": "23:20:50.52Z",
132 "valid": true
133 },
134 {
135 "description": "a valid time string with precise second fraction",
136 "data": "08:30:06.283185Z",
137 "valid": true
138 },
139 {
140 "description": "a valid time string with plus offset",
141 "data": "08:30:06+00:20",
142 "valid": true
143 },
144 {
145 "description": "a valid time string with minus offset",
146 "data": "08:30:06-08:00",
147 "valid": true
148 },
149 {
150 "description": "time with unknown local offset is valid",
151 "comment": "RFC 3339 section 4.3 (unknown local offset)",
152 "data": "12:34:56-00:00",
153 "valid": true
154 },
155 {
156 "description": "hour, minute in time-offset must be two digits",
157 "data": "08:30:06-8:000",
158 "valid": false
159 },
160 {
161 "description": "a valid time string with case-insensitive Z",
162 "data": "08:30:06z",
163 "valid": true
164 },
165 {
166 "description": "an invalid time string with invalid hour",
167 "data": "24:00:00Z",
168 "valid": false
169 },
170 {
171 "description": "an invalid time string with invalid minute",
172 "data": "00:60:00Z",
173 "valid": false
174 },
175 {
176 "description": "an invalid time string with invalid second",
177 "data": "00:00:61Z",
178 "valid": false
179 },
180 {
181 "description": "an invalid time string with invalid time numoffset hour",
182 "data": "01:02:03+24:00",
183 "valid": false
184 },
185 {
186 "description": "an invalid time string with invalid time numoffset minute",
187 "data": "01:02:03+00:60",
188 "valid": false
189 },
190 {
191 "description": "an invalid time string with invalid time with both Z and numoffset",
192 "data": "01:02:03Z+00:30",
193 "valid": false
194 },
195 {
196 "description": "an invalid offset indicator",
197 "data": "08:30:06 PST",
198 "valid": false
199 },
200 {
201 "description": "only RFC3339 not all of ISO 8601 are valid",
202 "data": "01:01:01,1111",
203 "valid": false
204 },
205 {
206 "description": "no time offset",
207 "data": "12:00:00",
208 "valid": false
209 },
210 {
211 "description": "no time offset with second fraction",
212 "data": "12:00:00.52",
213 "valid": false
214 },
215 {
216 "description": "invalid non-ASCII '২' (a Bengali 2)",
217 "data": "1২:00:00Z",
218 "valid": false
219 },
220 {
221 "description": "offset not starting with plus or minus",
222 "data": "08:30:06#00:20",
223 "valid": false
224 },
225 {
226 "description": "contains letters",
227 "data": "ab:cd:ef",
228 "valid": false
229 },
230 {
231 "description": "an invalid time string in date-time format",
232 "data": "2020-11-28T23:55:45Z",
233 "valid": false
234 },
235 {
236 "description": "a numeric time-offset requires the colon separator",
237 "comment": "RFC 3339 section 5.6: time-numoffset = (\"+\" / \"-\") time-hour \":\" time-minute",
238 "data": "08:30:06+0130",
239 "valid": false
240 },
241 {
242 "description": "a numeric time-offset requires the minutes component",
243 "comment": "RFC 3339 section 5.6: time-numoffset = (\"+\" / \"-\") time-hour \":\" time-minute",
244 "data": "08:30:06+01",
245 "valid": false
246 },
247 {
248 "description": "a trailing newline after a valid time",
249 "comment": "RFC 3339 section 5.6: no production of full-time emits a line feed",
250 "data": "08:30:06Z\n",
251 "valid": false
252 },
253 {
254 "description": "hour 24 is invalid with a numeric time-offset",
255 "comment": "RFC 3339 section 5.6: time-hour = 2DIGIT ; 00-23, and section 5.7 only allows 00 to 23",
256 "data": "24:59:00+01:00",
257 "valid": false
258 },
259 {
260 "description": "minute 60 is invalid with a numeric time-offset",
261 "comment": "RFC 3339 section 5.6: time-minute = 2DIGIT ; 00-59",
262 "data": "23:60:00+00:01",
263 "valid": false
264 },
265 {
266 "description": "a valid time string with a 15 digit second fraction",
267 "comment": "RFC 3339 section 5.6: time-secfrac = \".\" 1*DIGIT, with no upper bound on the number of digits",
268 "data": "00:59:59.999999999999999Z",
269 "valid": true
270 },
271 {
272 "description": "a second fraction with no digits",
273 "comment": "RFC 3339 section 5.6: time-secfrac = \".\" 1*DIGIT requires at least one digit",
274 "data": "08:30:06.Z",
275 "valid": false
276 },
277 {
278 "description": "partial-time requires the seconds component",
279 "comment": "RFC 3339 section 5.6: partial-time = time-hour \":\" time-minute \":\" time-second [time-secfrac]",
280 "data": "12:00Z",
281 "valid": false
282 },
283 {
284 "description": "a comma decimal separator with a time-offset",
285 "comment": "RFC 3339 section 5.6: the decimal separator in time-secfrac is \".\" - the ISO 8601 comma is not part of this profile",
286 "data": "08:30:06,5Z",
287 "valid": false
288 },
289 {
290 "description": "leading whitespace before a valid time",
291 "comment": "RFC 3339 section 5.6: no production of full-time emits whitespace",
292 "data": " 08:30:06Z",
293 "valid": false
294 }
295 ]
296 }
297 ]