Debian Codegraph @

share/tests/v1/multipleOf.json

raw
1 [
2 {
3 "description": "by int",
4 "schema": {
5 "$schema": "https://json-schema.org/v1",
6 "multipleOf": 2
7 },
8 "tests": [
9 {
10 "description": "int by int",
11 "data": 10,
12 "valid": true
13 },
14 {
15 "description": "int by int fail",
16 "data": 7,
17 "valid": false
18 },
19 {
20 "description": "ignores non-numbers",
21 "data": "foo",
22 "valid": true
23 }
24 ]
25 },
26 {
27 "description": "by number",
28 "schema": {
29 "$schema": "https://json-schema.org/v1",
30 "multipleOf": 1.5
31 },
32 "tests": [
33 {
34 "description": "zero is multiple of anything",
35 "data": 0,
36 "valid": true
37 },
38 {
39 "description": "4.5 is multiple of 1.5",
40 "data": 4.5,
41 "valid": true
42 },
43 {
44 "description": "-4.5 is multiple of 1.5",
45 "data": -4.5,
46 "valid": true
47 },
48 {
49 "description": "35 is not multiple of 1.5",
50 "data": 35,
51 "valid": false
52 }
53 ]
54 },
55 {
56 "description": "by small number",
57 "schema": {
58 "$schema": "https://json-schema.org/v1",
59 "multipleOf": 0.0001
60 },
61 "tests": [
62 {
63 "description": "0.0075 is multiple of 0.0001",
64 "data": 0.0075,
65 "valid": true
66 },
67 {
68 "description": "0.00751 is not multiple of 0.0001",
69 "data": 0.00751,
70 "valid": false
71 }
72 ]
73 },
74 {
75 "description": "float division = inf",
76 "schema": {
77 "$schema": "https://json-schema.org/v1",
78 "type": "integer",
79 "multipleOf": 0.123456789
80 },
81 "tests": [
82 {
83 "description": "always invalid, but naive implementations may raise an overflow error",
84 "data": 1e308,
85 "valid": false
86 }
87 ]
88 },
89 {
90 "description": "small multiple of large integer",
91 "schema": {
92 "$schema": "https://json-schema.org/v1",
93 "type": "integer", "multipleOf": 1e-8
94 },
95 "tests": [
96 {
97 "description": "any integer is a multiple of 1e-8",
98 "data": 12391239123,
99 "valid": true
100 }
101 ]
102 }
103 ]