From 62b1b06d6f84da832d308d75c2af50f088fa98b7 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Wed, 29 Dec 2021 10:40:26 -0800 Subject: [PATCH 1/4] use unique test descriptions --- tests/draft-next/optional/bignum.json | 6 +++--- tests/draft2019-09/optional/bignum.json | 6 +++--- tests/draft2020-12/optional/bignum.json | 6 +++--- tests/draft4/optional/bignum.json | 6 +++--- tests/draft6/optional/bignum.json | 6 +++--- tests/draft7/optional/bignum.json | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/draft-next/optional/bignum.json b/tests/draft-next/optional/bignum.json index 3f49226a..d136e147 100644 --- a/tests/draft-next/optional/bignum.json +++ b/tests/draft-next/optional/bignum.json @@ -43,7 +43,7 @@ ] }, { - "description": "integer comparison", + "description": "integer comparison, very large number", "schema": { "maximum": 18446744073709551615 }, "tests": [ { @@ -54,7 +54,7 @@ ] }, { - "description": "float comparison with high precision", + "description": "float comparison with high precision on positive numbers", "schema": { "exclusiveMaximum": 972783798187987123879878123.18878137 }, @@ -67,7 +67,7 @@ ] }, { - "description": "integer comparison", + "description": "integer comparison, very low number", "schema": { "minimum": -18446744073709551615 }, "tests": [ { diff --git a/tests/draft2019-09/optional/bignum.json b/tests/draft2019-09/optional/bignum.json index 3f49226a..d136e147 100644 --- a/tests/draft2019-09/optional/bignum.json +++ b/tests/draft2019-09/optional/bignum.json @@ -43,7 +43,7 @@ ] }, { - "description": "integer comparison", + "description": "integer comparison, very large number", "schema": { "maximum": 18446744073709551615 }, "tests": [ { @@ -54,7 +54,7 @@ ] }, { - "description": "float comparison with high precision", + "description": "float comparison with high precision on positive numbers", "schema": { "exclusiveMaximum": 972783798187987123879878123.18878137 }, @@ -67,7 +67,7 @@ ] }, { - "description": "integer comparison", + "description": "integer comparison, very low number", "schema": { "minimum": -18446744073709551615 }, "tests": [ { diff --git a/tests/draft2020-12/optional/bignum.json b/tests/draft2020-12/optional/bignum.json index 3f49226a..d136e147 100644 --- a/tests/draft2020-12/optional/bignum.json +++ b/tests/draft2020-12/optional/bignum.json @@ -43,7 +43,7 @@ ] }, { - "description": "integer comparison", + "description": "integer comparison, very large number", "schema": { "maximum": 18446744073709551615 }, "tests": [ { @@ -54,7 +54,7 @@ ] }, { - "description": "float comparison with high precision", + "description": "float comparison with high precision on positive numbers", "schema": { "exclusiveMaximum": 972783798187987123879878123.18878137 }, @@ -67,7 +67,7 @@ ] }, { - "description": "integer comparison", + "description": "integer comparison, very low number", "schema": { "minimum": -18446744073709551615 }, "tests": [ { diff --git a/tests/draft4/optional/bignum.json b/tests/draft4/optional/bignum.json index 7a622de8..76cce205 100644 --- a/tests/draft4/optional/bignum.json +++ b/tests/draft4/optional/bignum.json @@ -43,7 +43,7 @@ ] }, { - "description": "integer comparison", + "description": "integer comparison, very large number", "schema": { "maximum": 18446744073709551615 }, "tests": [ { @@ -54,7 +54,7 @@ ] }, { - "description": "float comparison with high precision", + "description": "float comparison with high precision on positive numbers", "schema": { "maximum": 972783798187987123879878123.18878137, "exclusiveMaximum": true @@ -68,7 +68,7 @@ ] }, { - "description": "integer comparison", + "description": "integer comparison, very low number", "schema": { "minimum": -18446744073709551615 }, "tests": [ { diff --git a/tests/draft6/optional/bignum.json b/tests/draft6/optional/bignum.json index 3f49226a..d136e147 100644 --- a/tests/draft6/optional/bignum.json +++ b/tests/draft6/optional/bignum.json @@ -43,7 +43,7 @@ ] }, { - "description": "integer comparison", + "description": "integer comparison, very large number", "schema": { "maximum": 18446744073709551615 }, "tests": [ { @@ -54,7 +54,7 @@ ] }, { - "description": "float comparison with high precision", + "description": "float comparison with high precision on positive numbers", "schema": { "exclusiveMaximum": 972783798187987123879878123.18878137 }, @@ -67,7 +67,7 @@ ] }, { - "description": "integer comparison", + "description": "integer comparison, very low number", "schema": { "minimum": -18446744073709551615 }, "tests": [ { diff --git a/tests/draft7/optional/bignum.json b/tests/draft7/optional/bignum.json index 3f49226a..d136e147 100644 --- a/tests/draft7/optional/bignum.json +++ b/tests/draft7/optional/bignum.json @@ -43,7 +43,7 @@ ] }, { - "description": "integer comparison", + "description": "integer comparison, very large number", "schema": { "maximum": 18446744073709551615 }, "tests": [ { @@ -54,7 +54,7 @@ ] }, { - "description": "float comparison with high precision", + "description": "float comparison with high precision on positive numbers", "schema": { "exclusiveMaximum": 972783798187987123879878123.18878137 }, @@ -67,7 +67,7 @@ ] }, { - "description": "integer comparison", + "description": "integer comparison, very low number", "schema": { "minimum": -18446744073709551615 }, "tests": [ { From 753061d16f088c49e720a190453b3e2f9f4e2bf9 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Thu, 30 Dec 2021 10:21:09 -0800 Subject: [PATCH 2/4] add more multipleOf variations an implementation might use a different internal representation for 1.0 vs 1, therefore we test both --- tests/draft-next/multipleOf.json | 84 ++++++++++++++++++++++++++---- tests/draft2019-09/multipleOf.json | 84 ++++++++++++++++++++++++++---- tests/draft2020-12/multipleOf.json | 84 ++++++++++++++++++++++++++---- tests/draft4/multipleOf.json | 84 ++++++++++++++++++++++++++---- tests/draft6/multipleOf.json | 84 ++++++++++++++++++++++++++---- tests/draft7/multipleOf.json | 84 ++++++++++++++++++++++++++---- 6 files changed, 450 insertions(+), 54 deletions(-) diff --git a/tests/draft-next/multipleOf.json b/tests/draft-next/multipleOf.json index faa87cff..6e10ac80 100644 --- a/tests/draft-next/multipleOf.json +++ b/tests/draft-next/multipleOf.json @@ -1,18 +1,64 @@ [ { - "description": "by int", - "schema": {"multipleOf": 2}, + "description": "by integer", + "schema": { "multipleOf": 2 }, "tests": [ { - "description": "int by int", + "description": "integer by integer", "data": 10, "valid": true }, { - "description": "int by int fail", + "description": "integer by integer fail", "data": 7, "valid": false }, + { + "description": "integer by integer float", + "data": 4.0, + "valid": true + }, + { + "description": "integer by number fail", + "data": 7.5, + "valid": false + }, + { + "description": "integer by integer float fail", + "data": 7.0, + "valid": false + }, + { + "description": "ignores non-numbers", + "data": "foo", + "valid": true + } + ] + }, + { + "description": "by integer float", + "schema": { "multipleOf": 2.0 }, + "tests": [ + { + "description": "integer by integer", + "data": 10, + "valid": true + }, + { + "description": "integer by integer fail", + "data": 7, + "valid": false + }, + { + "description": "integer by integer float", + "data": 4.0, + "valid": true + }, + { + "description": "integer by number fail", + "data": 7.5, + "valid": false + }, { "description": "ignores non-numbers", "data": "foo", @@ -21,8 +67,8 @@ ] }, { - "description": "by number", - "schema": {"multipleOf": 1.5}, + "description": "by non-integer number", + "schema": { "multipleOf": 1.5 }, "tests": [ { "description": "zero is multiple of anything", @@ -30,14 +76,34 @@ "valid": true }, { - "description": "4.5 is multiple of 1.5", - "data": 4.5, + "description": "float by integer", + "data": 6, "valid": true }, { - "description": "35 is not multiple of 1.5", + "description": "float by integer fail", "data": 35, "valid": false + }, + { + "description": "float by float", + "data": 4.5, + "valid": true + }, + { + "description": "float by float fail", + "data": 7.2, + "valid": false + }, + { + "description": "float by integer float", + "data": 6.0, + "valid": true + }, + { + "description": "float by integer float fail", + "data": 35.0, + "valid": false } ] }, diff --git a/tests/draft2019-09/multipleOf.json b/tests/draft2019-09/multipleOf.json index faa87cff..6e10ac80 100644 --- a/tests/draft2019-09/multipleOf.json +++ b/tests/draft2019-09/multipleOf.json @@ -1,18 +1,64 @@ [ { - "description": "by int", - "schema": {"multipleOf": 2}, + "description": "by integer", + "schema": { "multipleOf": 2 }, "tests": [ { - "description": "int by int", + "description": "integer by integer", "data": 10, "valid": true }, { - "description": "int by int fail", + "description": "integer by integer fail", "data": 7, "valid": false }, + { + "description": "integer by integer float", + "data": 4.0, + "valid": true + }, + { + "description": "integer by number fail", + "data": 7.5, + "valid": false + }, + { + "description": "integer by integer float fail", + "data": 7.0, + "valid": false + }, + { + "description": "ignores non-numbers", + "data": "foo", + "valid": true + } + ] + }, + { + "description": "by integer float", + "schema": { "multipleOf": 2.0 }, + "tests": [ + { + "description": "integer by integer", + "data": 10, + "valid": true + }, + { + "description": "integer by integer fail", + "data": 7, + "valid": false + }, + { + "description": "integer by integer float", + "data": 4.0, + "valid": true + }, + { + "description": "integer by number fail", + "data": 7.5, + "valid": false + }, { "description": "ignores non-numbers", "data": "foo", @@ -21,8 +67,8 @@ ] }, { - "description": "by number", - "schema": {"multipleOf": 1.5}, + "description": "by non-integer number", + "schema": { "multipleOf": 1.5 }, "tests": [ { "description": "zero is multiple of anything", @@ -30,14 +76,34 @@ "valid": true }, { - "description": "4.5 is multiple of 1.5", - "data": 4.5, + "description": "float by integer", + "data": 6, "valid": true }, { - "description": "35 is not multiple of 1.5", + "description": "float by integer fail", "data": 35, "valid": false + }, + { + "description": "float by float", + "data": 4.5, + "valid": true + }, + { + "description": "float by float fail", + "data": 7.2, + "valid": false + }, + { + "description": "float by integer float", + "data": 6.0, + "valid": true + }, + { + "description": "float by integer float fail", + "data": 35.0, + "valid": false } ] }, diff --git a/tests/draft2020-12/multipleOf.json b/tests/draft2020-12/multipleOf.json index faa87cff..6e10ac80 100644 --- a/tests/draft2020-12/multipleOf.json +++ b/tests/draft2020-12/multipleOf.json @@ -1,18 +1,64 @@ [ { - "description": "by int", - "schema": {"multipleOf": 2}, + "description": "by integer", + "schema": { "multipleOf": 2 }, "tests": [ { - "description": "int by int", + "description": "integer by integer", "data": 10, "valid": true }, { - "description": "int by int fail", + "description": "integer by integer fail", "data": 7, "valid": false }, + { + "description": "integer by integer float", + "data": 4.0, + "valid": true + }, + { + "description": "integer by number fail", + "data": 7.5, + "valid": false + }, + { + "description": "integer by integer float fail", + "data": 7.0, + "valid": false + }, + { + "description": "ignores non-numbers", + "data": "foo", + "valid": true + } + ] + }, + { + "description": "by integer float", + "schema": { "multipleOf": 2.0 }, + "tests": [ + { + "description": "integer by integer", + "data": 10, + "valid": true + }, + { + "description": "integer by integer fail", + "data": 7, + "valid": false + }, + { + "description": "integer by integer float", + "data": 4.0, + "valid": true + }, + { + "description": "integer by number fail", + "data": 7.5, + "valid": false + }, { "description": "ignores non-numbers", "data": "foo", @@ -21,8 +67,8 @@ ] }, { - "description": "by number", - "schema": {"multipleOf": 1.5}, + "description": "by non-integer number", + "schema": { "multipleOf": 1.5 }, "tests": [ { "description": "zero is multiple of anything", @@ -30,14 +76,34 @@ "valid": true }, { - "description": "4.5 is multiple of 1.5", - "data": 4.5, + "description": "float by integer", + "data": 6, "valid": true }, { - "description": "35 is not multiple of 1.5", + "description": "float by integer fail", "data": 35, "valid": false + }, + { + "description": "float by float", + "data": 4.5, + "valid": true + }, + { + "description": "float by float fail", + "data": 7.2, + "valid": false + }, + { + "description": "float by integer float", + "data": 6.0, + "valid": true + }, + { + "description": "float by integer float fail", + "data": 35.0, + "valid": false } ] }, diff --git a/tests/draft4/multipleOf.json b/tests/draft4/multipleOf.json index faa87cff..6e10ac80 100644 --- a/tests/draft4/multipleOf.json +++ b/tests/draft4/multipleOf.json @@ -1,18 +1,64 @@ [ { - "description": "by int", - "schema": {"multipleOf": 2}, + "description": "by integer", + "schema": { "multipleOf": 2 }, "tests": [ { - "description": "int by int", + "description": "integer by integer", "data": 10, "valid": true }, { - "description": "int by int fail", + "description": "integer by integer fail", "data": 7, "valid": false }, + { + "description": "integer by integer float", + "data": 4.0, + "valid": true + }, + { + "description": "integer by number fail", + "data": 7.5, + "valid": false + }, + { + "description": "integer by integer float fail", + "data": 7.0, + "valid": false + }, + { + "description": "ignores non-numbers", + "data": "foo", + "valid": true + } + ] + }, + { + "description": "by integer float", + "schema": { "multipleOf": 2.0 }, + "tests": [ + { + "description": "integer by integer", + "data": 10, + "valid": true + }, + { + "description": "integer by integer fail", + "data": 7, + "valid": false + }, + { + "description": "integer by integer float", + "data": 4.0, + "valid": true + }, + { + "description": "integer by number fail", + "data": 7.5, + "valid": false + }, { "description": "ignores non-numbers", "data": "foo", @@ -21,8 +67,8 @@ ] }, { - "description": "by number", - "schema": {"multipleOf": 1.5}, + "description": "by non-integer number", + "schema": { "multipleOf": 1.5 }, "tests": [ { "description": "zero is multiple of anything", @@ -30,14 +76,34 @@ "valid": true }, { - "description": "4.5 is multiple of 1.5", - "data": 4.5, + "description": "float by integer", + "data": 6, "valid": true }, { - "description": "35 is not multiple of 1.5", + "description": "float by integer fail", "data": 35, "valid": false + }, + { + "description": "float by float", + "data": 4.5, + "valid": true + }, + { + "description": "float by float fail", + "data": 7.2, + "valid": false + }, + { + "description": "float by integer float", + "data": 6.0, + "valid": true + }, + { + "description": "float by integer float fail", + "data": 35.0, + "valid": false } ] }, diff --git a/tests/draft6/multipleOf.json b/tests/draft6/multipleOf.json index faa87cff..6e10ac80 100644 --- a/tests/draft6/multipleOf.json +++ b/tests/draft6/multipleOf.json @@ -1,18 +1,64 @@ [ { - "description": "by int", - "schema": {"multipleOf": 2}, + "description": "by integer", + "schema": { "multipleOf": 2 }, "tests": [ { - "description": "int by int", + "description": "integer by integer", "data": 10, "valid": true }, { - "description": "int by int fail", + "description": "integer by integer fail", "data": 7, "valid": false }, + { + "description": "integer by integer float", + "data": 4.0, + "valid": true + }, + { + "description": "integer by number fail", + "data": 7.5, + "valid": false + }, + { + "description": "integer by integer float fail", + "data": 7.0, + "valid": false + }, + { + "description": "ignores non-numbers", + "data": "foo", + "valid": true + } + ] + }, + { + "description": "by integer float", + "schema": { "multipleOf": 2.0 }, + "tests": [ + { + "description": "integer by integer", + "data": 10, + "valid": true + }, + { + "description": "integer by integer fail", + "data": 7, + "valid": false + }, + { + "description": "integer by integer float", + "data": 4.0, + "valid": true + }, + { + "description": "integer by number fail", + "data": 7.5, + "valid": false + }, { "description": "ignores non-numbers", "data": "foo", @@ -21,8 +67,8 @@ ] }, { - "description": "by number", - "schema": {"multipleOf": 1.5}, + "description": "by non-integer number", + "schema": { "multipleOf": 1.5 }, "tests": [ { "description": "zero is multiple of anything", @@ -30,14 +76,34 @@ "valid": true }, { - "description": "4.5 is multiple of 1.5", - "data": 4.5, + "description": "float by integer", + "data": 6, "valid": true }, { - "description": "35 is not multiple of 1.5", + "description": "float by integer fail", "data": 35, "valid": false + }, + { + "description": "float by float", + "data": 4.5, + "valid": true + }, + { + "description": "float by float fail", + "data": 7.2, + "valid": false + }, + { + "description": "float by integer float", + "data": 6.0, + "valid": true + }, + { + "description": "float by integer float fail", + "data": 35.0, + "valid": false } ] }, diff --git a/tests/draft7/multipleOf.json b/tests/draft7/multipleOf.json index faa87cff..6e10ac80 100644 --- a/tests/draft7/multipleOf.json +++ b/tests/draft7/multipleOf.json @@ -1,18 +1,64 @@ [ { - "description": "by int", - "schema": {"multipleOf": 2}, + "description": "by integer", + "schema": { "multipleOf": 2 }, "tests": [ { - "description": "int by int", + "description": "integer by integer", "data": 10, "valid": true }, { - "description": "int by int fail", + "description": "integer by integer fail", "data": 7, "valid": false }, + { + "description": "integer by integer float", + "data": 4.0, + "valid": true + }, + { + "description": "integer by number fail", + "data": 7.5, + "valid": false + }, + { + "description": "integer by integer float fail", + "data": 7.0, + "valid": false + }, + { + "description": "ignores non-numbers", + "data": "foo", + "valid": true + } + ] + }, + { + "description": "by integer float", + "schema": { "multipleOf": 2.0 }, + "tests": [ + { + "description": "integer by integer", + "data": 10, + "valid": true + }, + { + "description": "integer by integer fail", + "data": 7, + "valid": false + }, + { + "description": "integer by integer float", + "data": 4.0, + "valid": true + }, + { + "description": "integer by number fail", + "data": 7.5, + "valid": false + }, { "description": "ignores non-numbers", "data": "foo", @@ -21,8 +67,8 @@ ] }, { - "description": "by number", - "schema": {"multipleOf": 1.5}, + "description": "by non-integer number", + "schema": { "multipleOf": 1.5 }, "tests": [ { "description": "zero is multiple of anything", @@ -30,14 +76,34 @@ "valid": true }, { - "description": "4.5 is multiple of 1.5", - "data": 4.5, + "description": "float by integer", + "data": 6, "valid": true }, { - "description": "35 is not multiple of 1.5", + "description": "float by integer fail", "data": 35, "valid": false + }, + { + "description": "float by float", + "data": 4.5, + "valid": true + }, + { + "description": "float by float fail", + "data": 7.2, + "valid": false + }, + { + "description": "float by integer float", + "data": 6.0, + "valid": true + }, + { + "description": "float by integer float fail", + "data": 35.0, + "valid": false } ] }, From 14c810253e2620e84c55e91fcba5c1f9766b89dd Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Thu, 30 Dec 2021 10:47:30 -0800 Subject: [PATCH 3/4] add more bignum variations an implementation might use a different internal representation for 1.0 vs 1, therefore we test both --- tests/draft-next/optional/bignum.json | 80 +++++++++++++++++++++++-- tests/draft2019-09/optional/bignum.json | 80 +++++++++++++++++++++++-- tests/draft2020-12/optional/bignum.json | 80 +++++++++++++++++++++++-- tests/draft4/optional/bignum.json | 80 +++++++++++++++++++++++-- tests/draft6/optional/bignum.json | 80 +++++++++++++++++++++++-- tests/draft7/optional/bignum.json | 80 +++++++++++++++++++++++-- 6 files changed, 450 insertions(+), 30 deletions(-) diff --git a/tests/draft-next/optional/bignum.json b/tests/draft-next/optional/bignum.json index d136e147..0a04a4d6 100644 --- a/tests/draft-next/optional/bignum.json +++ b/tests/draft-next/optional/bignum.json @@ -12,6 +12,16 @@ "description": "a negative bignum is an integer", "data": -12345678910111213141516171819202122232425262728293031, "valid": true + }, + { + "description": "a bignum is an integer if it has a zero fractional component", + "data": 12345678910111213141516171819202122232425262728293031.0, + "valid": true + }, + { + "description": "a negative bignum is an integer if it has a zero fractional component", + "data": -12345678910111213141516171819202122232425262728293031.0, + "valid": true } ] }, @@ -28,6 +38,16 @@ "description": "a negative bignum is a number", "data": -98249283749234923498293171823948729348710298301928331, "valid": true + }, + { + "description": "a bignum with a zero fractional component is a number", + "data": 98249283749234923498293171823948729348710298301928331.0, + "valid": true + }, + { + "description": "a negative bignum with a zero fractional component is a number", + "data": -98249283749234923498293171823948729348710298301928331.0, + "valid": true } ] }, @@ -39,6 +59,16 @@ "description": "a bignum is not a string", "data": 98249283749234923498293171823948729348710298301928331, "valid": false + }, + { + "description": "a bignum with zero fractional component is not a string", + "data": 98249283749234923498293171823948729348710298301928331.0, + "valid": false + }, + { + "description": "a float bignum is not a string", + "data": 98249283749234923498293171823948729348710298301928331.1, + "valid": false } ] }, @@ -47,9 +77,19 @@ "schema": { "maximum": 18446744073709551615 }, "tests": [ { - "description": "comparison works for high numbers", + "description": "comparison works for high integer numbers", "data": 18446744073709551600, "valid": true + }, + { + "description": "comparison works for high integer floats", + "data": 18446744073709551600.0, + "valid": true + }, + { + "description": "comparison works for high non-integer floats", + "data": 18446744073709551600.1, + "valid": true } ] }, @@ -60,7 +100,17 @@ }, "tests": [ { - "description": "comparison works for high numbers", + "description": "comparison works for high integers", + "data": 972783798187987123879878123, + "valid": false + }, + { + "description": "comparison works for high float integers", + "data": 972783798187987123879878124.0, + "valid": false + }, + { + "description": "comparison works for high non-integer numbers", "data": 972783798187987123879878123.188781371, "valid": false } @@ -71,9 +121,19 @@ "schema": { "minimum": -18446744073709551615 }, "tests": [ { - "description": "comparison works for very negative numbers", + "description": "comparison works for very negative integers", "data": -18446744073709551600, "valid": true + }, + { + "description": "comparison works for very negative float integers", + "data": -18446744073709551600.0, + "valid": true + }, + { + "description": "comparison works for very negative non-integer numbers", + "data": -18446744073709551600.1, + "valid": true } ] }, @@ -84,8 +144,18 @@ }, "tests": [ { - "description": "comparison works for very negative numbers", - "data": -972783798187987123879878123.188781371, + "description": "comparison works for very negative integers", + "data": -972783798187987123879878124, + "valid": false + }, + { + "description": "comparison works for very negative float integers", + "data": -972783798187987123879878124.0, + "valid": false + }, + { + "description": "comparison works for very negative float non-integers", + "data": -972783798187987123879878123.18878137, "valid": false } ] diff --git a/tests/draft2019-09/optional/bignum.json b/tests/draft2019-09/optional/bignum.json index d136e147..0a04a4d6 100644 --- a/tests/draft2019-09/optional/bignum.json +++ b/tests/draft2019-09/optional/bignum.json @@ -12,6 +12,16 @@ "description": "a negative bignum is an integer", "data": -12345678910111213141516171819202122232425262728293031, "valid": true + }, + { + "description": "a bignum is an integer if it has a zero fractional component", + "data": 12345678910111213141516171819202122232425262728293031.0, + "valid": true + }, + { + "description": "a negative bignum is an integer if it has a zero fractional component", + "data": -12345678910111213141516171819202122232425262728293031.0, + "valid": true } ] }, @@ -28,6 +38,16 @@ "description": "a negative bignum is a number", "data": -98249283749234923498293171823948729348710298301928331, "valid": true + }, + { + "description": "a bignum with a zero fractional component is a number", + "data": 98249283749234923498293171823948729348710298301928331.0, + "valid": true + }, + { + "description": "a negative bignum with a zero fractional component is a number", + "data": -98249283749234923498293171823948729348710298301928331.0, + "valid": true } ] }, @@ -39,6 +59,16 @@ "description": "a bignum is not a string", "data": 98249283749234923498293171823948729348710298301928331, "valid": false + }, + { + "description": "a bignum with zero fractional component is not a string", + "data": 98249283749234923498293171823948729348710298301928331.0, + "valid": false + }, + { + "description": "a float bignum is not a string", + "data": 98249283749234923498293171823948729348710298301928331.1, + "valid": false } ] }, @@ -47,9 +77,19 @@ "schema": { "maximum": 18446744073709551615 }, "tests": [ { - "description": "comparison works for high numbers", + "description": "comparison works for high integer numbers", "data": 18446744073709551600, "valid": true + }, + { + "description": "comparison works for high integer floats", + "data": 18446744073709551600.0, + "valid": true + }, + { + "description": "comparison works for high non-integer floats", + "data": 18446744073709551600.1, + "valid": true } ] }, @@ -60,7 +100,17 @@ }, "tests": [ { - "description": "comparison works for high numbers", + "description": "comparison works for high integers", + "data": 972783798187987123879878123, + "valid": false + }, + { + "description": "comparison works for high float integers", + "data": 972783798187987123879878124.0, + "valid": false + }, + { + "description": "comparison works for high non-integer numbers", "data": 972783798187987123879878123.188781371, "valid": false } @@ -71,9 +121,19 @@ "schema": { "minimum": -18446744073709551615 }, "tests": [ { - "description": "comparison works for very negative numbers", + "description": "comparison works for very negative integers", "data": -18446744073709551600, "valid": true + }, + { + "description": "comparison works for very negative float integers", + "data": -18446744073709551600.0, + "valid": true + }, + { + "description": "comparison works for very negative non-integer numbers", + "data": -18446744073709551600.1, + "valid": true } ] }, @@ -84,8 +144,18 @@ }, "tests": [ { - "description": "comparison works for very negative numbers", - "data": -972783798187987123879878123.188781371, + "description": "comparison works for very negative integers", + "data": -972783798187987123879878124, + "valid": false + }, + { + "description": "comparison works for very negative float integers", + "data": -972783798187987123879878124.0, + "valid": false + }, + { + "description": "comparison works for very negative float non-integers", + "data": -972783798187987123879878123.18878137, "valid": false } ] diff --git a/tests/draft2020-12/optional/bignum.json b/tests/draft2020-12/optional/bignum.json index d136e147..0a04a4d6 100644 --- a/tests/draft2020-12/optional/bignum.json +++ b/tests/draft2020-12/optional/bignum.json @@ -12,6 +12,16 @@ "description": "a negative bignum is an integer", "data": -12345678910111213141516171819202122232425262728293031, "valid": true + }, + { + "description": "a bignum is an integer if it has a zero fractional component", + "data": 12345678910111213141516171819202122232425262728293031.0, + "valid": true + }, + { + "description": "a negative bignum is an integer if it has a zero fractional component", + "data": -12345678910111213141516171819202122232425262728293031.0, + "valid": true } ] }, @@ -28,6 +38,16 @@ "description": "a negative bignum is a number", "data": -98249283749234923498293171823948729348710298301928331, "valid": true + }, + { + "description": "a bignum with a zero fractional component is a number", + "data": 98249283749234923498293171823948729348710298301928331.0, + "valid": true + }, + { + "description": "a negative bignum with a zero fractional component is a number", + "data": -98249283749234923498293171823948729348710298301928331.0, + "valid": true } ] }, @@ -39,6 +59,16 @@ "description": "a bignum is not a string", "data": 98249283749234923498293171823948729348710298301928331, "valid": false + }, + { + "description": "a bignum with zero fractional component is not a string", + "data": 98249283749234923498293171823948729348710298301928331.0, + "valid": false + }, + { + "description": "a float bignum is not a string", + "data": 98249283749234923498293171823948729348710298301928331.1, + "valid": false } ] }, @@ -47,9 +77,19 @@ "schema": { "maximum": 18446744073709551615 }, "tests": [ { - "description": "comparison works for high numbers", + "description": "comparison works for high integer numbers", "data": 18446744073709551600, "valid": true + }, + { + "description": "comparison works for high integer floats", + "data": 18446744073709551600.0, + "valid": true + }, + { + "description": "comparison works for high non-integer floats", + "data": 18446744073709551600.1, + "valid": true } ] }, @@ -60,7 +100,17 @@ }, "tests": [ { - "description": "comparison works for high numbers", + "description": "comparison works for high integers", + "data": 972783798187987123879878123, + "valid": false + }, + { + "description": "comparison works for high float integers", + "data": 972783798187987123879878124.0, + "valid": false + }, + { + "description": "comparison works for high non-integer numbers", "data": 972783798187987123879878123.188781371, "valid": false } @@ -71,9 +121,19 @@ "schema": { "minimum": -18446744073709551615 }, "tests": [ { - "description": "comparison works for very negative numbers", + "description": "comparison works for very negative integers", "data": -18446744073709551600, "valid": true + }, + { + "description": "comparison works for very negative float integers", + "data": -18446744073709551600.0, + "valid": true + }, + { + "description": "comparison works for very negative non-integer numbers", + "data": -18446744073709551600.1, + "valid": true } ] }, @@ -84,8 +144,18 @@ }, "tests": [ { - "description": "comparison works for very negative numbers", - "data": -972783798187987123879878123.188781371, + "description": "comparison works for very negative integers", + "data": -972783798187987123879878124, + "valid": false + }, + { + "description": "comparison works for very negative float integers", + "data": -972783798187987123879878124.0, + "valid": false + }, + { + "description": "comparison works for very negative float non-integers", + "data": -972783798187987123879878123.18878137, "valid": false } ] diff --git a/tests/draft4/optional/bignum.json b/tests/draft4/optional/bignum.json index 76cce205..530ef52e 100644 --- a/tests/draft4/optional/bignum.json +++ b/tests/draft4/optional/bignum.json @@ -12,6 +12,16 @@ "description": "a negative bignum is an integer", "data": -12345678910111213141516171819202122232425262728293031, "valid": true + }, + { + "description": "a bignum is an integer if it has a zero fractional component", + "data": 12345678910111213141516171819202122232425262728293031.0, + "valid": true + }, + { + "description": "a negative bignum is an integer if it has a zero fractional component", + "data": -12345678910111213141516171819202122232425262728293031.0, + "valid": true } ] }, @@ -28,6 +38,16 @@ "description": "a negative bignum is a number", "data": -98249283749234923498293171823948729348710298301928331, "valid": true + }, + { + "description": "a bignum with a zero fractional component is a number", + "data": 98249283749234923498293171823948729348710298301928331.0, + "valid": true + }, + { + "description": "a negative bignum with a zero fractional component is a number", + "data": -98249283749234923498293171823948729348710298301928331.0, + "valid": true } ] }, @@ -39,6 +59,16 @@ "description": "a bignum is not a string", "data": 98249283749234923498293171823948729348710298301928331, "valid": false + }, + { + "description": "a bignum with zero fractional component is not a string", + "data": 98249283749234923498293171823948729348710298301928331.0, + "valid": false + }, + { + "description": "a float bignum is not a string", + "data": 98249283749234923498293171823948729348710298301928331.1, + "valid": false } ] }, @@ -47,9 +77,19 @@ "schema": { "maximum": 18446744073709551615 }, "tests": [ { - "description": "comparison works for high numbers", + "description": "comparison works for high integer numbers", "data": 18446744073709551600, "valid": true + }, + { + "description": "comparison works for high integer floats", + "data": 18446744073709551600.0, + "valid": true + }, + { + "description": "comparison works for high non-integer floats", + "data": 18446744073709551600.1, + "valid": true } ] }, @@ -61,7 +101,17 @@ }, "tests": [ { - "description": "comparison works for high numbers", + "description": "comparison works for high integers", + "data": 972783798187987123879878123, + "valid": false + }, + { + "description": "comparison works for high float integers", + "data": 972783798187987123879878124.0, + "valid": false + }, + { + "description": "comparison works for high non-integer numbers", "data": 972783798187987123879878123.188781371, "valid": false } @@ -72,9 +122,19 @@ "schema": { "minimum": -18446744073709551615 }, "tests": [ { - "description": "comparison works for very negative numbers", + "description": "comparison works for very negative integers", "data": -18446744073709551600, "valid": true + }, + { + "description": "comparison works for very negative float integers", + "data": -18446744073709551600.0, + "valid": true + }, + { + "description": "comparison works for very negative non-integer numbers", + "data": -18446744073709551600.1, + "valid": true } ] }, @@ -86,8 +146,18 @@ }, "tests": [ { - "description": "comparison works for very negative numbers", - "data": -972783798187987123879878123.188781371, + "description": "comparison works for very negative integers", + "data": -972783798187987123879878124, + "valid": false + }, + { + "description": "comparison works for very negative float integers", + "data": -972783798187987123879878124.0, + "valid": false + }, + { + "description": "comparison works for very negative float non-integers", + "data": -972783798187987123879878123.18878137, "valid": false } ] diff --git a/tests/draft6/optional/bignum.json b/tests/draft6/optional/bignum.json index d136e147..0a04a4d6 100644 --- a/tests/draft6/optional/bignum.json +++ b/tests/draft6/optional/bignum.json @@ -12,6 +12,16 @@ "description": "a negative bignum is an integer", "data": -12345678910111213141516171819202122232425262728293031, "valid": true + }, + { + "description": "a bignum is an integer if it has a zero fractional component", + "data": 12345678910111213141516171819202122232425262728293031.0, + "valid": true + }, + { + "description": "a negative bignum is an integer if it has a zero fractional component", + "data": -12345678910111213141516171819202122232425262728293031.0, + "valid": true } ] }, @@ -28,6 +38,16 @@ "description": "a negative bignum is a number", "data": -98249283749234923498293171823948729348710298301928331, "valid": true + }, + { + "description": "a bignum with a zero fractional component is a number", + "data": 98249283749234923498293171823948729348710298301928331.0, + "valid": true + }, + { + "description": "a negative bignum with a zero fractional component is a number", + "data": -98249283749234923498293171823948729348710298301928331.0, + "valid": true } ] }, @@ -39,6 +59,16 @@ "description": "a bignum is not a string", "data": 98249283749234923498293171823948729348710298301928331, "valid": false + }, + { + "description": "a bignum with zero fractional component is not a string", + "data": 98249283749234923498293171823948729348710298301928331.0, + "valid": false + }, + { + "description": "a float bignum is not a string", + "data": 98249283749234923498293171823948729348710298301928331.1, + "valid": false } ] }, @@ -47,9 +77,19 @@ "schema": { "maximum": 18446744073709551615 }, "tests": [ { - "description": "comparison works for high numbers", + "description": "comparison works for high integer numbers", "data": 18446744073709551600, "valid": true + }, + { + "description": "comparison works for high integer floats", + "data": 18446744073709551600.0, + "valid": true + }, + { + "description": "comparison works for high non-integer floats", + "data": 18446744073709551600.1, + "valid": true } ] }, @@ -60,7 +100,17 @@ }, "tests": [ { - "description": "comparison works for high numbers", + "description": "comparison works for high integers", + "data": 972783798187987123879878123, + "valid": false + }, + { + "description": "comparison works for high float integers", + "data": 972783798187987123879878124.0, + "valid": false + }, + { + "description": "comparison works for high non-integer numbers", "data": 972783798187987123879878123.188781371, "valid": false } @@ -71,9 +121,19 @@ "schema": { "minimum": -18446744073709551615 }, "tests": [ { - "description": "comparison works for very negative numbers", + "description": "comparison works for very negative integers", "data": -18446744073709551600, "valid": true + }, + { + "description": "comparison works for very negative float integers", + "data": -18446744073709551600.0, + "valid": true + }, + { + "description": "comparison works for very negative non-integer numbers", + "data": -18446744073709551600.1, + "valid": true } ] }, @@ -84,8 +144,18 @@ }, "tests": [ { - "description": "comparison works for very negative numbers", - "data": -972783798187987123879878123.188781371, + "description": "comparison works for very negative integers", + "data": -972783798187987123879878124, + "valid": false + }, + { + "description": "comparison works for very negative float integers", + "data": -972783798187987123879878124.0, + "valid": false + }, + { + "description": "comparison works for very negative float non-integers", + "data": -972783798187987123879878123.18878137, "valid": false } ] diff --git a/tests/draft7/optional/bignum.json b/tests/draft7/optional/bignum.json index d136e147..0a04a4d6 100644 --- a/tests/draft7/optional/bignum.json +++ b/tests/draft7/optional/bignum.json @@ -12,6 +12,16 @@ "description": "a negative bignum is an integer", "data": -12345678910111213141516171819202122232425262728293031, "valid": true + }, + { + "description": "a bignum is an integer if it has a zero fractional component", + "data": 12345678910111213141516171819202122232425262728293031.0, + "valid": true + }, + { + "description": "a negative bignum is an integer if it has a zero fractional component", + "data": -12345678910111213141516171819202122232425262728293031.0, + "valid": true } ] }, @@ -28,6 +38,16 @@ "description": "a negative bignum is a number", "data": -98249283749234923498293171823948729348710298301928331, "valid": true + }, + { + "description": "a bignum with a zero fractional component is a number", + "data": 98249283749234923498293171823948729348710298301928331.0, + "valid": true + }, + { + "description": "a negative bignum with a zero fractional component is a number", + "data": -98249283749234923498293171823948729348710298301928331.0, + "valid": true } ] }, @@ -39,6 +59,16 @@ "description": "a bignum is not a string", "data": 98249283749234923498293171823948729348710298301928331, "valid": false + }, + { + "description": "a bignum with zero fractional component is not a string", + "data": 98249283749234923498293171823948729348710298301928331.0, + "valid": false + }, + { + "description": "a float bignum is not a string", + "data": 98249283749234923498293171823948729348710298301928331.1, + "valid": false } ] }, @@ -47,9 +77,19 @@ "schema": { "maximum": 18446744073709551615 }, "tests": [ { - "description": "comparison works for high numbers", + "description": "comparison works for high integer numbers", "data": 18446744073709551600, "valid": true + }, + { + "description": "comparison works for high integer floats", + "data": 18446744073709551600.0, + "valid": true + }, + { + "description": "comparison works for high non-integer floats", + "data": 18446744073709551600.1, + "valid": true } ] }, @@ -60,7 +100,17 @@ }, "tests": [ { - "description": "comparison works for high numbers", + "description": "comparison works for high integers", + "data": 972783798187987123879878123, + "valid": false + }, + { + "description": "comparison works for high float integers", + "data": 972783798187987123879878124.0, + "valid": false + }, + { + "description": "comparison works for high non-integer numbers", "data": 972783798187987123879878123.188781371, "valid": false } @@ -71,9 +121,19 @@ "schema": { "minimum": -18446744073709551615 }, "tests": [ { - "description": "comparison works for very negative numbers", + "description": "comparison works for very negative integers", "data": -18446744073709551600, "valid": true + }, + { + "description": "comparison works for very negative float integers", + "data": -18446744073709551600.0, + "valid": true + }, + { + "description": "comparison works for very negative non-integer numbers", + "data": -18446744073709551600.1, + "valid": true } ] }, @@ -84,8 +144,18 @@ }, "tests": [ { - "description": "comparison works for very negative numbers", - "data": -972783798187987123879878123.188781371, + "description": "comparison works for very negative integers", + "data": -972783798187987123879878124, + "valid": false + }, + { + "description": "comparison works for very negative float integers", + "data": -972783798187987123879878124.0, + "valid": false + }, + { + "description": "comparison works for very negative float non-integers", + "data": -972783798187987123879878123.18878137, "valid": false } ] From 42b8de39e8ca21e9ab8c7fbb8bc87a7aadec0907 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Thu, 30 Dec 2021 11:10:26 -0800 Subject: [PATCH 4/4] consolidate bignum and overflow tests in one file under optional/ an overflow result is an error, which may not be treated as valid: false by an implementation --- tests/draft-next/multipleOf.json | 11 ------- tests/draft-next/optional/bignum.json | 29 +++++++++++++++++++ tests/draft-next/optional/float-overflow.json | 13 --------- tests/draft2019-09/multipleOf.json | 11 ------- tests/draft2019-09/optional/bignum.json | 29 +++++++++++++++++++ .../draft2019-09/optional/float-overflow.json | 13 --------- tests/draft2020-12/multipleOf.json | 11 ------- tests/draft2020-12/optional/bignum.json | 29 +++++++++++++++++++ .../draft2020-12/optional/float-overflow.json | 13 --------- tests/draft4/multipleOf.json | 11 ------- tests/draft4/optional/bignum.json | 29 +++++++++++++++++++ tests/draft4/optional/float-overflow.json | 13 --------- tests/draft6/multipleOf.json | 11 ------- tests/draft6/optional/bignum.json | 29 +++++++++++++++++++ tests/draft6/optional/float-overflow.json | 13 --------- tests/draft7/multipleOf.json | 11 ------- tests/draft7/optional/bignum.json | 29 +++++++++++++++++++ tests/draft7/optional/float-overflow.json | 13 --------- 18 files changed, 174 insertions(+), 144 deletions(-) delete mode 100644 tests/draft-next/optional/float-overflow.json delete mode 100644 tests/draft2019-09/optional/float-overflow.json delete mode 100644 tests/draft2020-12/optional/float-overflow.json delete mode 100644 tests/draft4/optional/float-overflow.json delete mode 100644 tests/draft6/optional/float-overflow.json delete mode 100644 tests/draft7/optional/float-overflow.json diff --git a/tests/draft-next/multipleOf.json b/tests/draft-next/multipleOf.json index 6e10ac80..4a3410ef 100644 --- a/tests/draft-next/multipleOf.json +++ b/tests/draft-next/multipleOf.json @@ -122,16 +122,5 @@ "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/draft-next/optional/bignum.json b/tests/draft-next/optional/bignum.json index 0a04a4d6..a0210747 100644 --- a/tests/draft-next/optional/bignum.json +++ b/tests/draft-next/optional/bignum.json @@ -159,5 +159,34 @@ "valid": false } ] + }, + { + "description": "multipleOf with a very large dividend", + "schema": { + "multipleOf": 0.123456789 + }, + "tests": [ + { + "description": "true result", + "data": 1.23456789e+307, + "valid": true + }, + { + "description": "false result", + "data": 1e308, + "valid": false + } + ] + }, + { + "description": "all integers are multiples of 0.5, if overflow is handled", + "schema": { "multipleOf": 0.5 }, + "tests": [ + { + "description": "valid if optional overflow handling is implemented", + "data": 1e308, + "valid": true + } + ] } ] diff --git a/tests/draft-next/optional/float-overflow.json b/tests/draft-next/optional/float-overflow.json deleted file mode 100644 index 52ff9827..00000000 --- a/tests/draft-next/optional/float-overflow.json +++ /dev/null @@ -1,13 +0,0 @@ -[ - { - "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/multipleOf.json b/tests/draft2019-09/multipleOf.json index 6e10ac80..4a3410ef 100644 --- a/tests/draft2019-09/multipleOf.json +++ b/tests/draft2019-09/multipleOf.json @@ -122,16 +122,5 @@ "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/bignum.json b/tests/draft2019-09/optional/bignum.json index 0a04a4d6..a0210747 100644 --- a/tests/draft2019-09/optional/bignum.json +++ b/tests/draft2019-09/optional/bignum.json @@ -159,5 +159,34 @@ "valid": false } ] + }, + { + "description": "multipleOf with a very large dividend", + "schema": { + "multipleOf": 0.123456789 + }, + "tests": [ + { + "description": "true result", + "data": 1.23456789e+307, + "valid": true + }, + { + "description": "false result", + "data": 1e308, + "valid": false + } + ] + }, + { + "description": "all integers are multiples of 0.5, if overflow is handled", + "schema": { "multipleOf": 0.5 }, + "tests": [ + { + "description": "valid if optional overflow handling is implemented", + "data": 1e308, + "valid": true + } + ] } ] diff --git a/tests/draft2019-09/optional/float-overflow.json b/tests/draft2019-09/optional/float-overflow.json deleted file mode 100644 index 52ff9827..00000000 --- a/tests/draft2019-09/optional/float-overflow.json +++ /dev/null @@ -1,13 +0,0 @@ -[ - { - "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/draft2020-12/multipleOf.json b/tests/draft2020-12/multipleOf.json index 6e10ac80..4a3410ef 100644 --- a/tests/draft2020-12/multipleOf.json +++ b/tests/draft2020-12/multipleOf.json @@ -122,16 +122,5 @@ "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/draft2020-12/optional/bignum.json b/tests/draft2020-12/optional/bignum.json index 0a04a4d6..a0210747 100644 --- a/tests/draft2020-12/optional/bignum.json +++ b/tests/draft2020-12/optional/bignum.json @@ -159,5 +159,34 @@ "valid": false } ] + }, + { + "description": "multipleOf with a very large dividend", + "schema": { + "multipleOf": 0.123456789 + }, + "tests": [ + { + "description": "true result", + "data": 1.23456789e+307, + "valid": true + }, + { + "description": "false result", + "data": 1e308, + "valid": false + } + ] + }, + { + "description": "all integers are multiples of 0.5, if overflow is handled", + "schema": { "multipleOf": 0.5 }, + "tests": [ + { + "description": "valid if optional overflow handling is implemented", + "data": 1e308, + "valid": true + } + ] } ] diff --git a/tests/draft2020-12/optional/float-overflow.json b/tests/draft2020-12/optional/float-overflow.json deleted file mode 100644 index 52ff9827..00000000 --- a/tests/draft2020-12/optional/float-overflow.json +++ /dev/null @@ -1,13 +0,0 @@ -[ - { - "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/draft4/multipleOf.json b/tests/draft4/multipleOf.json index 6e10ac80..4a3410ef 100644 --- a/tests/draft4/multipleOf.json +++ b/tests/draft4/multipleOf.json @@ -122,16 +122,5 @@ "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/bignum.json b/tests/draft4/optional/bignum.json index 530ef52e..8055fe86 100644 --- a/tests/draft4/optional/bignum.json +++ b/tests/draft4/optional/bignum.json @@ -161,5 +161,34 @@ "valid": false } ] + }, + { + "description": "multipleOf with a very large dividend", + "schema": { + "multipleOf": 0.123456789 + }, + "tests": [ + { + "description": "true result", + "data": 1.23456789e+307, + "valid": true + }, + { + "description": "false result", + "data": 1e308, + "valid": false + } + ] + }, + { + "description": "all integers are multiples of 0.5, if overflow is handled", + "schema": { "multipleOf": 0.5 }, + "tests": [ + { + "description": "valid if optional overflow handling is implemented", + "data": 1e308, + "valid": true + } + ] } ] diff --git a/tests/draft4/optional/float-overflow.json b/tests/draft4/optional/float-overflow.json deleted file mode 100644 index 47fd5baa..00000000 --- a/tests/draft4/optional/float-overflow.json +++ /dev/null @@ -1,13 +0,0 @@ -[ - { - "description": "all integers are multiples of 0.5, if overflow is handled", - "schema": {"type": "number", "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 6e10ac80..4a3410ef 100644 --- a/tests/draft6/multipleOf.json +++ b/tests/draft6/multipleOf.json @@ -122,16 +122,5 @@ "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/bignum.json b/tests/draft6/optional/bignum.json index 0a04a4d6..a0210747 100644 --- a/tests/draft6/optional/bignum.json +++ b/tests/draft6/optional/bignum.json @@ -159,5 +159,34 @@ "valid": false } ] + }, + { + "description": "multipleOf with a very large dividend", + "schema": { + "multipleOf": 0.123456789 + }, + "tests": [ + { + "description": "true result", + "data": 1.23456789e+307, + "valid": true + }, + { + "description": "false result", + "data": 1e308, + "valid": false + } + ] + }, + { + "description": "all integers are multiples of 0.5, if overflow is handled", + "schema": { "multipleOf": 0.5 }, + "tests": [ + { + "description": "valid if optional overflow handling is implemented", + "data": 1e308, + "valid": true + } + ] } ] diff --git a/tests/draft6/optional/float-overflow.json b/tests/draft6/optional/float-overflow.json deleted file mode 100644 index 52ff9827..00000000 --- a/tests/draft6/optional/float-overflow.json +++ /dev/null @@ -1,13 +0,0 @@ -[ - { - "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/multipleOf.json b/tests/draft7/multipleOf.json index 6e10ac80..4a3410ef 100644 --- a/tests/draft7/multipleOf.json +++ b/tests/draft7/multipleOf.json @@ -122,16 +122,5 @@ "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/bignum.json b/tests/draft7/optional/bignum.json index 0a04a4d6..a0210747 100644 --- a/tests/draft7/optional/bignum.json +++ b/tests/draft7/optional/bignum.json @@ -159,5 +159,34 @@ "valid": false } ] + }, + { + "description": "multipleOf with a very large dividend", + "schema": { + "multipleOf": 0.123456789 + }, + "tests": [ + { + "description": "true result", + "data": 1.23456789e+307, + "valid": true + }, + { + "description": "false result", + "data": 1e308, + "valid": false + } + ] + }, + { + "description": "all integers are multiples of 0.5, if overflow is handled", + "schema": { "multipleOf": 0.5 }, + "tests": [ + { + "description": "valid if optional overflow handling is implemented", + "data": 1e308, + "valid": true + } + ] } ] diff --git a/tests/draft7/optional/float-overflow.json b/tests/draft7/optional/float-overflow.json deleted file mode 100644 index 52ff9827..00000000 --- a/tests/draft7/optional/float-overflow.json +++ /dev/null @@ -1,13 +0,0 @@ -[ - { - "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 - } - ] - } -]