Skip to content

Commit

Permalink
consolidate bignum and overflow tests in one file under optional/
Browse files Browse the repository at this point in the history
an overflow result is an error, which may not be treated as valid: false by an implementation
  • Loading branch information
karenetheridge committed Dec 30, 2021
1 parent 14c8102 commit 42b8de3
Show file tree
Hide file tree
Showing 18 changed files with 174 additions and 144 deletions.
11 changes: 0 additions & 11 deletions tests/draft-next/multipleOf.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
}
]
29 changes: 29 additions & 0 deletions tests/draft-next/optional/bignum.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
}
]
13 changes: 0 additions & 13 deletions tests/draft-next/optional/float-overflow.json

This file was deleted.

11 changes: 0 additions & 11 deletions tests/draft2019-09/multipleOf.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
}
]
29 changes: 29 additions & 0 deletions tests/draft2019-09/optional/bignum.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
}
]
13 changes: 0 additions & 13 deletions tests/draft2019-09/optional/float-overflow.json

This file was deleted.

11 changes: 0 additions & 11 deletions tests/draft2020-12/multipleOf.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
}
]
29 changes: 29 additions & 0 deletions tests/draft2020-12/optional/bignum.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
}
]
13 changes: 0 additions & 13 deletions tests/draft2020-12/optional/float-overflow.json

This file was deleted.

11 changes: 0 additions & 11 deletions tests/draft4/multipleOf.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
}
]
29 changes: 29 additions & 0 deletions tests/draft4/optional/bignum.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
}
]
13 changes: 0 additions & 13 deletions tests/draft4/optional/float-overflow.json

This file was deleted.

11 changes: 0 additions & 11 deletions tests/draft6/multipleOf.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
}
]
29 changes: 29 additions & 0 deletions tests/draft6/optional/bignum.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
}
]
13 changes: 0 additions & 13 deletions tests/draft6/optional/float-overflow.json

This file was deleted.

11 changes: 0 additions & 11 deletions tests/draft7/multipleOf.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
}
]
29 changes: 29 additions & 0 deletions tests/draft7/optional/bignum.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
}
]
13 changes: 0 additions & 13 deletions tests/draft7/optional/float-overflow.json

This file was deleted.

0 comments on commit 42b8de3

Please sign in to comment.