Skip to content

Commit 918803a

Browse files
committed
Squashed 'json/' changes from 21555a85..96742ba3
96742ba3 Merge pull request #438 from Zac-HD/overflow-with-multipleOf c5ba4ba3 Check for multipleOf overflow c12b0db8 Merge pull request #437 from gregsdennis/if-then-else-sequencing bd148eb7 copy/paste error 3ca7c419 Added if/then/else sequencing tests; resolves #436 fa73bc8d Merge pull request #435 from jviotti/unevaluated-items-typo 2d6de7cb Fix "unevaluted" typos in "unevaluatedItems" suite 2a9be81d Merge pull request #1 from json-schema-org/master git-subtree-dir: json git-subtree-split: 96742ba3c4a1eff6de45f0c50a66a975796b7c37
1 parent 1a4ea00 commit 918803a

11 files changed

+171
-15
lines changed

tests/draft2019-09/if-then-else.json

+30
Original file line numberDiff line numberDiff line change
@@ -224,5 +224,35 @@
224224
"valid": true
225225
}
226226
]
227+
},
228+
{
229+
"description": "if appears at the end when serialized (keyword processing sequence)",
230+
"schema": {
231+
"then": { "const": "yes" },
232+
"else": { "const": "other" },
233+
"if": { "maxLength": 4 }
234+
},
235+
"tests": [
236+
{
237+
"description": "yes redirects to then and passes",
238+
"data": "yes",
239+
"valid": true
240+
},
241+
{
242+
"description": "other redirects to else and passes",
243+
"data": "other",
244+
"valid": true
245+
},
246+
{
247+
"description": "no redirects to then and fails",
248+
"data": "no",
249+
"valid": false
250+
},
251+
{
252+
"description": "invalid redirects to else and fails",
253+
"data": "invalid",
254+
"valid": false
255+
}
256+
]
227257
}
228258
]

tests/draft2019-09/multipleOf.json

+11
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,16 @@
5656
"valid": false
5757
}
5858
]
59+
},
60+
{
61+
"description": "invalid instance should not raise error when float division = inf",
62+
"schema": {"type": "integer", "multipleOf": 0.123456789},
63+
"tests": [
64+
{
65+
"description": "always invalid, but naive implementations may raise an overflow error",
66+
"data": 1e308,
67+
"valid": false
68+
}
69+
]
5970
}
6071
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[
2+
{
3+
"description": "all integers are multiples of 0.5, if overflow is handled",
4+
"schema": {"type": "integer", "multipleOf": 0.5},
5+
"tests": [
6+
{
7+
"description": "valid if optional overflow handling is implemented",
8+
"data": 1e308,
9+
"valid": true
10+
}
11+
]
12+
}
13+
]

tests/draft2019-09/unevaluatedItems.json

+15-15
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@
8787
},
8888
"tests": [
8989
{
90-
"description": "with no unevaluted items",
90+
"description": "with no unevaluated items",
9191
"data": ["foo"],
9292
"valid": true
9393
},
9494
{
95-
"description": "with unevaluted items",
95+
"description": "with unevaluated items",
9696
"data": ["foo", "bar"],
9797
"valid": false
9898
}
@@ -135,12 +135,12 @@
135135
},
136136
"tests": [
137137
{
138-
"description": "with no unevaluted items",
138+
"description": "with no unevaluated items",
139139
"data": ["foo", 42],
140140
"valid": true
141141
},
142142
{
143-
"description": "with unevaluted items",
143+
"description": "with unevaluated items",
144144
"data": ["foo", 42, true],
145145
"valid": false
146146
}
@@ -228,22 +228,22 @@
228228
},
229229
"tests": [
230230
{
231-
"description": "when one schema matches and has no unevaluted items",
231+
"description": "when one schema matches and has no unevaluated items",
232232
"data": ["foo", "bar"],
233233
"valid": true
234234
},
235235
{
236-
"description": "when one schema matches and has unevaluted items",
236+
"description": "when one schema matches and has unevaluated items",
237237
"data": ["foo", "bar", 42],
238238
"valid": false
239239
},
240240
{
241-
"description": "when two schemas match and has no unevaluted items",
241+
"description": "when two schemas match and has no unevaluated items",
242242
"data": ["foo", "bar", "baz"],
243243
"valid": true
244244
},
245245
{
246-
"description": "when two schemas match and has unevaluted items",
246+
"description": "when two schemas match and has unevaluated items",
247247
"data": ["foo", "bar", "baz", 42],
248248
"valid": false
249249
}
@@ -274,12 +274,12 @@
274274
},
275275
"tests": [
276276
{
277-
"description": "with no unevaluted items",
277+
"description": "with no unevaluated items",
278278
"data": ["foo", "bar"],
279279
"valid": true
280280
},
281281
{
282-
"description": "with unevaluted items",
282+
"description": "with unevaluated items",
283283
"data": ["foo", "bar", 42],
284284
"valid": false
285285
}
@@ -304,7 +304,7 @@
304304
},
305305
"tests": [
306306
{
307-
"description": "with unevaluted items",
307+
"description": "with unevaluated items",
308308
"data": ["foo", "bar"],
309309
"valid": false
310310
}
@@ -342,22 +342,22 @@
342342
},
343343
"tests": [
344344
{
345-
"description": "when if matches and it has no unevaluted items",
345+
"description": "when if matches and it has no unevaluated items",
346346
"data": ["foo", "bar", "then"],
347347
"valid": true
348348
},
349349
{
350-
"description": "when if matches and it has unevaluted items",
350+
"description": "when if matches and it has unevaluated items",
351351
"data": ["foo", "bar", "then", "else"],
352352
"valid": false
353353
},
354354
{
355-
"description": "when if doesn't match and it has no unevaluted items",
355+
"description": "when if doesn't match and it has no unevaluated items",
356356
"data": ["foo", 42, 42, "else"],
357357
"valid": true
358358
},
359359
{
360-
"description": "when if doesn't match and it has unevaluted items",
360+
"description": "when if doesn't match and it has unevaluated items",
361361
"data": ["foo", 42, 42, "else", 42],
362362
"valid": false
363363
}

tests/draft4/multipleOf.json

+11
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,16 @@
5656
"valid": false
5757
}
5858
]
59+
},
60+
{
61+
"description": "invalid instance should not raise error when float division = inf",
62+
"schema": {"type": "integer", "multipleOf": 0.123456789},
63+
"tests": [
64+
{
65+
"description": "always invalid, but naive implementations may raise an overflow error",
66+
"data": 1e308,
67+
"valid": false
68+
}
69+
]
5970
}
6071
]
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[
2+
{
3+
"description": "all integers are multiples of 0.5, if overflow is handled",
4+
"schema": {"type": "integer", "multipleOf": 0.5},
5+
"tests": [
6+
{
7+
"description": "valid if optional overflow handling is implemented",
8+
"data": 1e308,
9+
"valid": true
10+
}
11+
]
12+
}
13+
]

tests/draft6/multipleOf.json

+11
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,16 @@
5656
"valid": false
5757
}
5858
]
59+
},
60+
{
61+
"description": "invalid instance should not raise error when float division = inf",
62+
"schema": {"type": "integer", "multipleOf": 0.123456789},
63+
"tests": [
64+
{
65+
"description": "always invalid, but naive implementations may raise an overflow error",
66+
"data": 1e308,
67+
"valid": false
68+
}
69+
]
5970
}
6071
]
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[
2+
{
3+
"description": "all integers are multiples of 0.5, if overflow is handled",
4+
"schema": {"type": "integer", "multipleOf": 0.5},
5+
"tests": [
6+
{
7+
"description": "valid if optional overflow handling is implemented",
8+
"data": 1e308,
9+
"valid": true
10+
}
11+
]
12+
}
13+
]

tests/draft7/if-then-else.json

+30
Original file line numberDiff line numberDiff line change
@@ -224,5 +224,35 @@
224224
"valid": true
225225
}
226226
]
227+
},
228+
{
229+
"description": "if appears at the end when serialized (keyword processing sequence)",
230+
"schema": {
231+
"then": { "const": "yes" },
232+
"else": { "const": "other" },
233+
"if": { "maxLength": 4 }
234+
},
235+
"tests": [
236+
{
237+
"description": "yes redirects to then and passes",
238+
"data": "yes",
239+
"valid": true
240+
},
241+
{
242+
"description": "other redirects to else and passes",
243+
"data": "other",
244+
"valid": true
245+
},
246+
{
247+
"description": "no redirects to then and fails",
248+
"data": "no",
249+
"valid": false
250+
},
251+
{
252+
"description": "invalid redirects to else and fails",
253+
"data": "invalid",
254+
"valid": false
255+
}
256+
]
227257
}
228258
]

tests/draft7/multipleOf.json

+11
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,16 @@
5656
"valid": false
5757
}
5858
]
59+
},
60+
{
61+
"description": "invalid instance should not raise error when float division = inf",
62+
"schema": {"type": "integer", "multipleOf": 0.123456789},
63+
"tests": [
64+
{
65+
"description": "always invalid, but naive implementations may raise an overflow error",
66+
"data": 1e308,
67+
"valid": false
68+
}
69+
]
5970
}
6071
]
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[
2+
{
3+
"description": "all integers are multiples of 0.5, if overflow is handled",
4+
"schema": {"type": "integer", "multipleOf": 0.5},
5+
"tests": [
6+
{
7+
"description": "valid if optional overflow handling is implemented",
8+
"data": 1e308,
9+
"valid": true
10+
}
11+
]
12+
}
13+
]

0 commit comments

Comments
 (0)