|
126 | 126 | ]
|
127 | 127 | },
|
128 | 128 | {
|
129 |
| - "description": "const with 0 does not match false", |
| 129 | + "description": "const with 0 does not match other zero-like types", |
130 | 130 | "schema": {"const": 0},
|
131 | 131 | "tests": [
|
132 | 132 | {
|
|
143 | 143 | "description": "float zero is valid",
|
144 | 144 | "data": 0.0,
|
145 | 145 | "valid": true
|
| 146 | + }, |
| 147 | + { |
| 148 | + "description": "empty object is invalid", |
| 149 | + "data": {}, |
| 150 | + "valid": false |
| 151 | + }, |
| 152 | + { |
| 153 | + "description": "empty array is invalid", |
| 154 | + "data": [], |
| 155 | + "valid": false |
| 156 | + }, |
| 157 | + { |
| 158 | + "description": "empty string is invalid", |
| 159 | + "data": "", |
| 160 | + "valid": false |
146 | 161 | }
|
147 | 162 | ]
|
148 | 163 | },
|
|
166 | 181 | "valid": true
|
167 | 182 | }
|
168 | 183 | ]
|
| 184 | + }, |
| 185 | + { |
| 186 | + "description": "const with -2.0 matches integer and float types", |
| 187 | + "schema": {"const": -2.0}, |
| 188 | + "tests": [ |
| 189 | + { |
| 190 | + "description": "integer -2 is valid", |
| 191 | + "data": -2, |
| 192 | + "valid": true |
| 193 | + }, |
| 194 | + { |
| 195 | + "description": "integer 2 is invalid", |
| 196 | + "data": 2, |
| 197 | + "valid": false |
| 198 | + }, |
| 199 | + { |
| 200 | + "description": "float -2.0 is valid", |
| 201 | + "data": -2.0, |
| 202 | + "valid": true |
| 203 | + }, |
| 204 | + { |
| 205 | + "description": "float 2.0 is invalid", |
| 206 | + "data": 2.0, |
| 207 | + "valid": false |
| 208 | + }, |
| 209 | + { |
| 210 | + "description": "float -2.00001 is invalid", |
| 211 | + "data": -2.00001, |
| 212 | + "valid": false |
| 213 | + } |
| 214 | + ] |
| 215 | + }, |
| 216 | + { |
| 217 | + "description": "float and integers are equal up to 64-bit representation limits", |
| 218 | + "schema": {"const": 9007199254740992}, |
| 219 | + "tests": [ |
| 220 | + { |
| 221 | + "description": "integer is valid", |
| 222 | + "data": 9007199254740992, |
| 223 | + "valid": true |
| 224 | + }, |
| 225 | + { |
| 226 | + "description": "integer minus one is invalid", |
| 227 | + "data": 9007199254740991, |
| 228 | + "valid": false |
| 229 | + }, |
| 230 | + { |
| 231 | + "description": "float is valid", |
| 232 | + "data": 9007199254740992.0, |
| 233 | + "valid": true |
| 234 | + }, |
| 235 | + { |
| 236 | + "description": "float minus one is invalid", |
| 237 | + "data": 9007199254740991.0, |
| 238 | + "valid": false |
| 239 | + } |
| 240 | + ] |
169 | 241 | }
|
170 | 242 | ]
|
0 commit comments