diff options
author | Julian Berman <Julian@GrayVines.com> | 2020-10-04 11:58:30 -0400 |
---|---|---|
committer | Julian Berman <Julian@GrayVines.com> | 2020-10-04 11:58:30 -0400 |
commit | 918803aa556f4f87d6b952af316d47ecaf089164 (patch) | |
tree | 66db3186e821014696d7ca651109ce98b2142847 | |
parent | 1a4ea00149e70383506f24648bfb52a2278fe3f7 (diff) | |
download | jsonschema-918803aa556f4f87d6b952af316d47ecaf089164.tar.gz |
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
-rw-r--r-- | tests/draft2019-09/if-then-else.json | 30 | ||||
-rw-r--r-- | tests/draft2019-09/multipleOf.json | 11 | ||||
-rw-r--r-- | tests/draft2019-09/optional/float-overflow.json | 13 | ||||
-rw-r--r-- | tests/draft2019-09/unevaluatedItems.json | 30 | ||||
-rw-r--r-- | tests/draft4/multipleOf.json | 11 | ||||
-rw-r--r-- | tests/draft4/optional/float-overflow.json | 13 | ||||
-rw-r--r-- | tests/draft6/multipleOf.json | 11 | ||||
-rw-r--r-- | tests/draft6/optional/float-overflow.json | 13 | ||||
-rw-r--r-- | tests/draft7/if-then-else.json | 30 | ||||
-rw-r--r-- | tests/draft7/multipleOf.json | 11 | ||||
-rw-r--r-- | tests/draft7/optional/float-overflow.json | 13 |
11 files changed, 171 insertions, 15 deletions
diff --git a/tests/draft2019-09/if-then-else.json b/tests/draft2019-09/if-then-else.json index e0b873e..284e919 100644 --- a/tests/draft2019-09/if-then-else.json +++ b/tests/draft2019-09/if-then-else.json @@ -224,5 +224,35 @@ "valid": true } ] + }, + { + "description": "if appears at the end when serialized (keyword processing sequence)", + "schema": { + "then": { "const": "yes" }, + "else": { "const": "other" }, + "if": { "maxLength": 4 } + }, + "tests": [ + { + "description": "yes redirects to then and passes", + "data": "yes", + "valid": true + }, + { + "description": "other redirects to else and passes", + "data": "other", + "valid": true + }, + { + "description": "no redirects to then and fails", + "data": "no", + "valid": false + }, + { + "description": "invalid redirects to else and fails", + "data": "invalid", + "valid": false + } + ] } ] diff --git a/tests/draft2019-09/multipleOf.json b/tests/draft2019-09/multipleOf.json index ca3b761..faa87cf 100644 --- a/tests/draft2019-09/multipleOf.json +++ b/tests/draft2019-09/multipleOf.json @@ -56,5 +56,16 @@ "valid": false } ] + }, + { + "description": "invalid instance should not raise error when float division = inf", + "schema": {"type": "integer", "multipleOf": 0.123456789}, + "tests": [ + { + "description": "always invalid, but naive implementations may raise an overflow error", + "data": 1e308, + "valid": false + } + ] } ] diff --git a/tests/draft2019-09/optional/float-overflow.json b/tests/draft2019-09/optional/float-overflow.json new file mode 100644 index 0000000..52ff982 --- /dev/null +++ b/tests/draft2019-09/optional/float-overflow.json @@ -0,0 +1,13 @@ +[ + { + "description": "all integers are multiples of 0.5, if overflow is handled", + "schema": {"type": "integer", "multipleOf": 0.5}, + "tests": [ + { + "description": "valid if optional overflow handling is implemented", + "data": 1e308, + "valid": true + } + ] + } +] diff --git a/tests/draft2019-09/unevaluatedItems.json b/tests/draft2019-09/unevaluatedItems.json index 01c07be..32f13f8 100644 --- a/tests/draft2019-09/unevaluatedItems.json +++ b/tests/draft2019-09/unevaluatedItems.json @@ -87,12 +87,12 @@ }, "tests": [ { - "description": "with no unevaluted items", + "description": "with no unevaluated items", "data": ["foo"], "valid": true }, { - "description": "with unevaluted items", + "description": "with unevaluated items", "data": ["foo", "bar"], "valid": false } @@ -135,12 +135,12 @@ }, "tests": [ { - "description": "with no unevaluted items", + "description": "with no unevaluated items", "data": ["foo", 42], "valid": true }, { - "description": "with unevaluted items", + "description": "with unevaluated items", "data": ["foo", 42, true], "valid": false } @@ -228,22 +228,22 @@ }, "tests": [ { - "description": "when one schema matches and has no unevaluted items", + "description": "when one schema matches and has no unevaluated items", "data": ["foo", "bar"], "valid": true }, { - "description": "when one schema matches and has unevaluted items", + "description": "when one schema matches and has unevaluated items", "data": ["foo", "bar", 42], "valid": false }, { - "description": "when two schemas match and has no unevaluted items", + "description": "when two schemas match and has no unevaluated items", "data": ["foo", "bar", "baz"], "valid": true }, { - "description": "when two schemas match and has unevaluted items", + "description": "when two schemas match and has unevaluated items", "data": ["foo", "bar", "baz", 42], "valid": false } @@ -274,12 +274,12 @@ }, "tests": [ { - "description": "with no unevaluted items", + "description": "with no unevaluated items", "data": ["foo", "bar"], "valid": true }, { - "description": "with unevaluted items", + "description": "with unevaluated items", "data": ["foo", "bar", 42], "valid": false } @@ -304,7 +304,7 @@ }, "tests": [ { - "description": "with unevaluted items", + "description": "with unevaluated items", "data": ["foo", "bar"], "valid": false } @@ -342,22 +342,22 @@ }, "tests": [ { - "description": "when if matches and it has no unevaluted items", + "description": "when if matches and it has no unevaluated items", "data": ["foo", "bar", "then"], "valid": true }, { - "description": "when if matches and it has unevaluted items", + "description": "when if matches and it has unevaluated items", "data": ["foo", "bar", "then", "else"], "valid": false }, { - "description": "when if doesn't match and it has no unevaluted items", + "description": "when if doesn't match and it has no unevaluated items", "data": ["foo", 42, 42, "else"], "valid": true }, { - "description": "when if doesn't match and it has unevaluted items", + "description": "when if doesn't match and it has unevaluated items", "data": ["foo", 42, 42, "else", 42], "valid": false } diff --git a/tests/draft4/multipleOf.json b/tests/draft4/multipleOf.json index ca3b761..faa87cf 100644 --- a/tests/draft4/multipleOf.json +++ b/tests/draft4/multipleOf.json @@ -56,5 +56,16 @@ "valid": false } ] + }, + { + "description": "invalid instance should not raise error when float division = inf", + "schema": {"type": "integer", "multipleOf": 0.123456789}, + "tests": [ + { + "description": "always invalid, but naive implementations may raise an overflow error", + "data": 1e308, + "valid": false + } + ] } ] diff --git a/tests/draft4/optional/float-overflow.json b/tests/draft4/optional/float-overflow.json new file mode 100644 index 0000000..52ff982 --- /dev/null +++ b/tests/draft4/optional/float-overflow.json @@ -0,0 +1,13 @@ +[ + { + "description": "all integers are multiples of 0.5, if overflow is handled", + "schema": {"type": "integer", "multipleOf": 0.5}, + "tests": [ + { + "description": "valid if optional overflow handling is implemented", + "data": 1e308, + "valid": true + } + ] + } +] diff --git a/tests/draft6/multipleOf.json b/tests/draft6/multipleOf.json index ca3b761..faa87cf 100644 --- a/tests/draft6/multipleOf.json +++ b/tests/draft6/multipleOf.json @@ -56,5 +56,16 @@ "valid": false } ] + }, + { + "description": "invalid instance should not raise error when float division = inf", + "schema": {"type": "integer", "multipleOf": 0.123456789}, + "tests": [ + { + "description": "always invalid, but naive implementations may raise an overflow error", + "data": 1e308, + "valid": false + } + ] } ] diff --git a/tests/draft6/optional/float-overflow.json b/tests/draft6/optional/float-overflow.json new file mode 100644 index 0000000..52ff982 --- /dev/null +++ b/tests/draft6/optional/float-overflow.json @@ -0,0 +1,13 @@ +[ + { + "description": "all integers are multiples of 0.5, if overflow is handled", + "schema": {"type": "integer", "multipleOf": 0.5}, + "tests": [ + { + "description": "valid if optional overflow handling is implemented", + "data": 1e308, + "valid": true + } + ] + } +] diff --git a/tests/draft7/if-then-else.json b/tests/draft7/if-then-else.json index e0b873e..284e919 100644 --- a/tests/draft7/if-then-else.json +++ b/tests/draft7/if-then-else.json @@ -224,5 +224,35 @@ "valid": true } ] + }, + { + "description": "if appears at the end when serialized (keyword processing sequence)", + "schema": { + "then": { "const": "yes" }, + "else": { "const": "other" }, + "if": { "maxLength": 4 } + }, + "tests": [ + { + "description": "yes redirects to then and passes", + "data": "yes", + "valid": true + }, + { + "description": "other redirects to else and passes", + "data": "other", + "valid": true + }, + { + "description": "no redirects to then and fails", + "data": "no", + "valid": false + }, + { + "description": "invalid redirects to else and fails", + "data": "invalid", + "valid": false + } + ] } ] diff --git a/tests/draft7/multipleOf.json b/tests/draft7/multipleOf.json index ca3b761..faa87cf 100644 --- a/tests/draft7/multipleOf.json +++ b/tests/draft7/multipleOf.json @@ -56,5 +56,16 @@ "valid": false } ] + }, + { + "description": "invalid instance should not raise error when float division = inf", + "schema": {"type": "integer", "multipleOf": 0.123456789}, + "tests": [ + { + "description": "always invalid, but naive implementations may raise an overflow error", + "data": 1e308, + "valid": false + } + ] } ] diff --git a/tests/draft7/optional/float-overflow.json b/tests/draft7/optional/float-overflow.json new file mode 100644 index 0000000..52ff982 --- /dev/null +++ b/tests/draft7/optional/float-overflow.json @@ -0,0 +1,13 @@ +[ + { + "description": "all integers are multiples of 0.5, if overflow is handled", + "schema": {"type": "integer", "multipleOf": 0.5}, + "tests": [ + { + "description": "valid if optional overflow handling is implemented", + "data": 1e308, + "valid": true + } + ] + } +] |