Skip to content

Commit 96742ba

Browse files
authored
Merge pull request #438 from Zac-HD/overflow-with-multipleOf
Check for `multipleOf` overflow
2 parents c12b0db + c5ba4ba commit 96742ba

File tree

8 files changed

+96
-0
lines changed

8 files changed

+96
-0
lines changed

tests/draft2019-09/multipleOf.json

Lines changed: 11 additions & 0 deletions
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
]
Lines changed: 13 additions & 0 deletions
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/draft4/multipleOf.json

Lines changed: 11 additions & 0 deletions
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
]
Lines changed: 13 additions & 0 deletions
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

Lines changed: 11 additions & 0 deletions
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
]
Lines changed: 13 additions & 0 deletions
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/multipleOf.json

Lines changed: 11 additions & 0 deletions
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
]
Lines changed: 13 additions & 0 deletions
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)