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