Skip to content

Commit 48a0295

Browse files
committed
Add additional compliance tests for verifying float/boolean correctness
1 parent f24f04b commit 48a0295

File tree

2 files changed

+92
-1
lines changed

2 files changed

+92
-1
lines changed

tests/compliance/boolean.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@
7676
"False": false,
7777
"Number": 5,
7878
"EmptyList": [],
79-
"Zero": 0
79+
"Zero": 0,
80+
"ZeroFloat": 0.0
8081
},
8182
"cases": [
8283
{
@@ -198,6 +199,14 @@
198199
{
199200
"expression": "!!Zero",
200201
"result": true
202+
},
203+
{
204+
"expression": "Zero || Number",
205+
"result": 0
206+
},
207+
{
208+
"expression": "ZeroFloat || Number",
209+
"result": 0.0
201210
}
202211
]
203212
},

tests/compliance/filters.json

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,88 @@
265265
}
266266
]
267267
},
268+
{
269+
"given": {"foo": [
270+
{"key": true},
271+
{"key": false},
272+
{"key": 0},
273+
{"key": 0.0},
274+
{"key": 1},
275+
{"key": 1.0},
276+
{"key": [0]},
277+
{"key": null},
278+
{"key": [1]},
279+
{"key": []},
280+
{"key": {}},
281+
{"key": {"a":2}}
282+
]},
283+
"cases": [
284+
{
285+
"expression": "foo[?key == `true`]",
286+
"result": [{"key": true}]
287+
},
288+
{
289+
"expression": "foo[?key == `false`]",
290+
"result": [{"key": false}]
291+
},
292+
{
293+
"expression": "foo[?key]",
294+
"result": [
295+
{"key": true},
296+
{"key": 0},
297+
{"key": 0.0},
298+
{"key": 1},
299+
{"key": 1.0},
300+
{"key": [0]},
301+
{"key": [1]},
302+
{"key": {"a": 2}}
303+
]
304+
},
305+
{
306+
"expression": "foo[? !key]",
307+
"result": [
308+
{"key": false},
309+
{"key": null},
310+
{"key": []},
311+
{"key": {}}
312+
]
313+
},
314+
{
315+
"expression": "foo[? !!key]",
316+
"result": [
317+
{"key": true},
318+
{"key": 0},
319+
{"key": 0.0},
320+
{"key": 1},
321+
{"key": 1.0},
322+
{"key": [0]},
323+
{"key": [1]},
324+
{"key": {"a": 2}}
325+
]
326+
},
327+
{
328+
"expression": "foo[? `true`]",
329+
"result": [
330+
{"key": true},
331+
{"key": false},
332+
{"key": 0},
333+
{"key": 0.0},
334+
{"key": 1},
335+
{"key": 1.0},
336+
{"key": [0]},
337+
{"key": null},
338+
{"key": [1]},
339+
{"key": []},
340+
{"key": {}},
341+
{"key": {"a":2}}
342+
]
343+
},
344+
{
345+
"expression": "foo[? `false`]",
346+
"result": []
347+
}
348+
]
349+
},
268350
{
269351
"given": {"reservations": [
270352
{"instances": [

0 commit comments

Comments
 (0)