summaryrefslogtreecommitdiff
path: root/json/tests/draft2020-12/multipleOf.json
blob: 25c25a913c97867a0b77ff53da816aad94f9d3c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
[
    {
        "description": "by int",
        "schema": {"multipleOf": 2},
        "tests": [
            {
                "description": "int by int",
                "data": 10,
                "valid": true
            },
            {
                "description": "int by int fail",
                "data": 7,
                "valid": false
            },
            {
                "description": "ignores non-numbers",
                "data": "foo",
                "valid": true
            }
        ]
    },
    {
        "description": "by number",
        "schema": {"multipleOf": 1.5},
        "tests": [
            {
                "description": "zero is multiple of anything",
                "data": 0,
                "valid": true
            },
            {
                "description": "4.5 is multiple of 1.5",
                "data": 4.5,
                "valid": true
            },
            {
                "description": "35 is not multiple of 1.5",
                "data": 35,
                "valid": false
            }
        ]
    },
    {
        "description": "by small number",
        "schema": {"multipleOf": 0.0001},
        "tests": [
            {
                "description": "0.0075 is multiple of 0.0001",
                "data": 0.0075,
                "valid": true
            },
            {
                "description": "0.00751 is not multiple of 0.0001",
                "data": 0.00751,
                "valid": false
            }
        ]
    },
    {
        "description": "float division = inf",
        "schema": {"type": "integer", "multipleOf": 0.123456789},
        "tests": [
            {
                "description": "always invalid, but naive implementations may raise an overflow error",
                "data": 1e308,
                "valid": false
            }
        ]
    }
]