Debian Codegraph @

share/tests/draft2020-12/multipleOf.json

raw
1 [
2 {
3 "description": "by int",
4 "schema": {
5 "$schema": "https://json-schema.org/draft/2020-12/schema",
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/draft/2020-12/schema",
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/draft/2020-12/schema",
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/draft/2020-12/schema",
78 "type": "integer", "multipleOf": 0.123456789
79 },
80 "tests": [
81 {
82 "description": "always invalid, but naive implementations may raise an overflow error",
83 "data": 1e308,
84 "valid": false
85 }
86 ]
87 },
88 {
89 "description": "small multiple of large integer",
90 "schema": {
91 "$schema": "https://json-schema.org/draft/2020-12/schema",
92 "type": "integer", "multipleOf": 1e-8
93 },
94 "tests": [
95 {
96 "description": "any integer is a multiple of 1e-8",
97 "data": 12391239123,
98 "valid": true
99 }
100 ]
101 }
102 ]