Skip to content

Commit 42b8de3

Browse files
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
1 parent 14c8102 commit 42b8de3

18 files changed

+174
-144
lines changed

tests/draft-next/multipleOf.json

-11
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,5 @@
122122
"valid": false
123123
}
124124
]
125-
},
126-
{
127-
"description": "invalid instance should not raise error when float division = inf",
128-
"schema": {"type": "integer", "multipleOf": 0.123456789},
129-
"tests": [
130-
{
131-
"description": "always invalid, but naive implementations may raise an overflow error",
132-
"data": 1e308,
133-
"valid": false
134-
}
135-
]
136125
}
137126
]

tests/draft-next/optional/bignum.json

+29
Original file line numberDiff line numberDiff line change
@@ -159,5 +159,34 @@
159159
"valid": false
160160
}
161161
]
162+
},
163+
{
164+
"description": "multipleOf with a very large dividend",
165+
"schema": {
166+
"multipleOf": 0.123456789
167+
},
168+
"tests": [
169+
{
170+
"description": "true result",
171+
"data": 1.23456789e+307,
172+
"valid": true
173+
},
174+
{
175+
"description": "false result",
176+
"data": 1e308,
177+
"valid": false
178+
}
179+
]
180+
},
181+
{
182+
"description": "all integers are multiples of 0.5, if overflow is handled",
183+
"schema": { "multipleOf": 0.5 },
184+
"tests": [
185+
{
186+
"description": "valid if optional overflow handling is implemented",
187+
"data": 1e308,
188+
"valid": true
189+
}
190+
]
162191
}
163192
]

tests/draft-next/optional/float-overflow.json

-13
This file was deleted.

tests/draft2019-09/multipleOf.json

-11
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,5 @@
122122
"valid": false
123123
}
124124
]
125-
},
126-
{
127-
"description": "invalid instance should not raise error when float division = inf",
128-
"schema": {"type": "integer", "multipleOf": 0.123456789},
129-
"tests": [
130-
{
131-
"description": "always invalid, but naive implementations may raise an overflow error",
132-
"data": 1e308,
133-
"valid": false
134-
}
135-
]
136125
}
137126
]

tests/draft2019-09/optional/bignum.json

+29
Original file line numberDiff line numberDiff line change
@@ -159,5 +159,34 @@
159159
"valid": false
160160
}
161161
]
162+
},
163+
{
164+
"description": "multipleOf with a very large dividend",
165+
"schema": {
166+
"multipleOf": 0.123456789
167+
},
168+
"tests": [
169+
{
170+
"description": "true result",
171+
"data": 1.23456789e+307,
172+
"valid": true
173+
},
174+
{
175+
"description": "false result",
176+
"data": 1e308,
177+
"valid": false
178+
}
179+
]
180+
},
181+
{
182+
"description": "all integers are multiples of 0.5, if overflow is handled",
183+
"schema": { "multipleOf": 0.5 },
184+
"tests": [
185+
{
186+
"description": "valid if optional overflow handling is implemented",
187+
"data": 1e308,
188+
"valid": true
189+
}
190+
]
162191
}
163192
]

tests/draft2019-09/optional/float-overflow.json

-13
This file was deleted.

tests/draft2020-12/multipleOf.json

-11
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,5 @@
122122
"valid": false
123123
}
124124
]
125-
},
126-
{
127-
"description": "invalid instance should not raise error when float division = inf",
128-
"schema": {"type": "integer", "multipleOf": 0.123456789},
129-
"tests": [
130-
{
131-
"description": "always invalid, but naive implementations may raise an overflow error",
132-
"data": 1e308,
133-
"valid": false
134-
}
135-
]
136125
}
137126
]

tests/draft2020-12/optional/bignum.json

+29
Original file line numberDiff line numberDiff line change
@@ -159,5 +159,34 @@
159159
"valid": false
160160
}
161161
]
162+
},
163+
{
164+
"description": "multipleOf with a very large dividend",
165+
"schema": {
166+
"multipleOf": 0.123456789
167+
},
168+
"tests": [
169+
{
170+
"description": "true result",
171+
"data": 1.23456789e+307,
172+
"valid": true
173+
},
174+
{
175+
"description": "false result",
176+
"data": 1e308,
177+
"valid": false
178+
}
179+
]
180+
},
181+
{
182+
"description": "all integers are multiples of 0.5, if overflow is handled",
183+
"schema": { "multipleOf": 0.5 },
184+
"tests": [
185+
{
186+
"description": "valid if optional overflow handling is implemented",
187+
"data": 1e308,
188+
"valid": true
189+
}
190+
]
162191
}
163192
]

tests/draft2020-12/optional/float-overflow.json

-13
This file was deleted.

tests/draft4/multipleOf.json

-11
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,5 @@
122122
"valid": false
123123
}
124124
]
125-
},
126-
{
127-
"description": "invalid instance should not raise error when float division = inf",
128-
"schema": {"type": "integer", "multipleOf": 0.123456789},
129-
"tests": [
130-
{
131-
"description": "always invalid, but naive implementations may raise an overflow error",
132-
"data": 1e308,
133-
"valid": false
134-
}
135-
]
136125
}
137126
]

tests/draft4/optional/bignum.json

+29
Original file line numberDiff line numberDiff line change
@@ -161,5 +161,34 @@
161161
"valid": false
162162
}
163163
]
164+
},
165+
{
166+
"description": "multipleOf with a very large dividend",
167+
"schema": {
168+
"multipleOf": 0.123456789
169+
},
170+
"tests": [
171+
{
172+
"description": "true result",
173+
"data": 1.23456789e+307,
174+
"valid": true
175+
},
176+
{
177+
"description": "false result",
178+
"data": 1e308,
179+
"valid": false
180+
}
181+
]
182+
},
183+
{
184+
"description": "all integers are multiples of 0.5, if overflow is handled",
185+
"schema": { "multipleOf": 0.5 },
186+
"tests": [
187+
{
188+
"description": "valid if optional overflow handling is implemented",
189+
"data": 1e308,
190+
"valid": true
191+
}
192+
]
164193
}
165194
]

tests/draft4/optional/float-overflow.json

-13
This file was deleted.

tests/draft6/multipleOf.json

-11
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,5 @@
122122
"valid": false
123123
}
124124
]
125-
},
126-
{
127-
"description": "invalid instance should not raise error when float division = inf",
128-
"schema": {"type": "integer", "multipleOf": 0.123456789},
129-
"tests": [
130-
{
131-
"description": "always invalid, but naive implementations may raise an overflow error",
132-
"data": 1e308,
133-
"valid": false
134-
}
135-
]
136125
}
137126
]

tests/draft6/optional/bignum.json

+29
Original file line numberDiff line numberDiff line change
@@ -159,5 +159,34 @@
159159
"valid": false
160160
}
161161
]
162+
},
163+
{
164+
"description": "multipleOf with a very large dividend",
165+
"schema": {
166+
"multipleOf": 0.123456789
167+
},
168+
"tests": [
169+
{
170+
"description": "true result",
171+
"data": 1.23456789e+307,
172+
"valid": true
173+
},
174+
{
175+
"description": "false result",
176+
"data": 1e308,
177+
"valid": false
178+
}
179+
]
180+
},
181+
{
182+
"description": "all integers are multiples of 0.5, if overflow is handled",
183+
"schema": { "multipleOf": 0.5 },
184+
"tests": [
185+
{
186+
"description": "valid if optional overflow handling is implemented",
187+
"data": 1e308,
188+
"valid": true
189+
}
190+
]
162191
}
163192
]

tests/draft6/optional/float-overflow.json

-13
This file was deleted.

tests/draft7/multipleOf.json

-11
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,5 @@
122122
"valid": false
123123
}
124124
]
125-
},
126-
{
127-
"description": "invalid instance should not raise error when float division = inf",
128-
"schema": {"type": "integer", "multipleOf": 0.123456789},
129-
"tests": [
130-
{
131-
"description": "always invalid, but naive implementations may raise an overflow error",
132-
"data": 1e308,
133-
"valid": false
134-
}
135-
]
136125
}
137126
]

tests/draft7/optional/bignum.json

+29
Original file line numberDiff line numberDiff line change
@@ -159,5 +159,34 @@
159159
"valid": false
160160
}
161161
]
162+
},
163+
{
164+
"description": "multipleOf with a very large dividend",
165+
"schema": {
166+
"multipleOf": 0.123456789
167+
},
168+
"tests": [
169+
{
170+
"description": "true result",
171+
"data": 1.23456789e+307,
172+
"valid": true
173+
},
174+
{
175+
"description": "false result",
176+
"data": 1e308,
177+
"valid": false
178+
}
179+
]
180+
},
181+
{
182+
"description": "all integers are multiples of 0.5, if overflow is handled",
183+
"schema": { "multipleOf": 0.5 },
184+
"tests": [
185+
{
186+
"description": "valid if optional overflow handling is implemented",
187+
"data": 1e308,
188+
"valid": true
189+
}
190+
]
162191
}
163192
]

tests/draft7/optional/float-overflow.json

-13
This file was deleted.

0 commit comments

Comments
 (0)