xref: /freebsd/contrib/libucl/tests/schema/multipleOf.json (revision dd41de95a84d979615a2ef11df6850622bf6184e)
1[
2    {
3        "description": "by int",
4        "schema": {"multipleOf": 2},
5        "tests": [
6            {
7                "description": "int by int",
8                "data": 10,
9                "valid": true
10            },
11            {
12                "description": "int by int fail",
13                "data": 7,
14                "valid": false
15            },
16            {
17                "description": "ignores non-numbers",
18                "data": "foo",
19                "valid": true
20            }
21        ]
22    },
23    {
24        "description": "by number",
25        "schema": {"multipleOf": 1.5},
26        "tests": [
27            {
28                "description": "zero is multiple of anything",
29                "data": 0,
30                "valid": true
31            },
32            {
33                "description": "4.5 is multiple of 1.5",
34                "data": 4.5,
35                "valid": true
36            },
37            {
38                "description": "35 is not multiple of 1.5",
39                "data": 35,
40                "valid": false
41            }
42        ]
43    },
44    {
45        "description": "by small number",
46        "schema": {"multipleOf": 0.0001},
47        "tests": [
48            {
49                "description": "0.0075 is multiple of 0.0001",
50                "data": 0.0075,
51                "valid": true
52            },
53            {
54                "description": "0.00751 is not multiple of 0.0001",
55                "data": 0.00751,
56                "valid": false
57            }
58        ]
59    }
60]
61