JSON-Schema-Test-Suite
JSON-Schema-Test-Suite copied to clipboard
Add test for multipleOf to ensure that implementation does not have an issue regarding scale
This is not a float/double related issue but is one regarding scale. Consider the following schema:
[
{
"description": "by deep scale",
"schema": {"multipleOf": 0.25},
"tests": [
{
"description": "8.75 is multiple of 0.25",
"data": 8.75,
"valid": true
},
{
"description": "8.750000000001 is not multiple of 0.25",
"data": 8.750000000001,
"valid": false
},
{
"description": "8.7500000000001 is not multiple of 0.25",
"data": 8.7500000000001,
"valid": false
},
{
"description": "8.75000000000001 is not multiple of 0.25",
"data": 8.75000000000001,
"valid": false
}
]
}
]
This will ensure libraries with language support for a rich big decimal are not constrained by a low exponent check.
For implementations that don't use a big decimal library, since the validation will fail ("valid" will turn out to be true), is there a way to ignore these tests?
This repository is just a bunch of data files. It's up to the individual implementation libraries to decide how to pull those files in and provide interfaces for running tests with them. So: check with your library to see what options are available, or submit a patch to enhance them :)