Debian Codegraph @

jsonpath-compliance-test-suite/tests/functions/length.json

raw symbols SCIP
1 {
2 "tests": [
3 {
4 "name": "string data",
5 "selector" : "$[?length(@.a)>=2]",
6 "document" : [{"a": "ab"}, {"a": "d"}],
7 "result": [
8 {"a": "ab"}
9 ]
10 },
11 {
12 "name": "string data, unicode",
13 "selector": "$[?length(@)==2]",
14 "document": ["☺", "☺☺", "☺☺☺", "ж", "жж", "жжж", "磨", "阿美", "形声字"],
15 "result": ["☺☺", "жж", "阿美"]
16 },
17 {
18 "name": "array data",
19 "selector" : "$[?length(@.a)>=2]",
20 "document" : [{"a": [1,2,3]}, {"a": [1]}],
21 "result": [
22 {"a": [1,2,3]}
23 ]
24 },
25 {
26 "name": "missing data",
27 "selector" : "$[?length(@.a)>=2]",
28 "document" : [{"d": "f"}],
29 "result": []
30 },
31 {
32 "name": "number arg",
33 "selector" : "$[?length(1)>=2]",
34 "document" : [{"d": "f"}],
35 "result": []
36 },
37 {
38 "name": "true arg",
39 "selector" : "$[?length(true)>=2]",
40 "document" : [{"d": "f"}],
41 "result": []
42 },
43 {
44 "name": "false arg",
45 "selector" : "$[?length(false)>=2]",
46 "document" : [{"d": "f"}],
47 "result": []
48 },
49 {
50 "name": "null arg",
51 "selector" : "$[?length(null)>=2]",
52 "document" : [{"d": "f"}],
53 "result": []
54 },
55 {
56 "name": "result must be compared",
57 "selector" : "$[?length(@.a)]",
58 "invalid_selector": true
59 },
60 {
61 "name": "no params",
62 "selector" : "$[?length()==1]",
63 "invalid_selector": true
64 },
65 {
66 "name": "too many params",
67 "selector" : "$[?length(@.a,@.b)==1]",
68 "invalid_selector": true
69 },
70 {
71 "name": "non-singular query arg",
72 "selector": "$[?length(@.*)<3]",
73 "invalid_selector": true
74 },
75 {
76 "name": "arg is a function expression",
77 "selector" : "$.values[?length(@.a)==length(value($..c))]",
78 "document" : {
79 "c": "cd",
80 "values": [{"a": "ab"}, {"a": "d"}]
81 },
82 "result": [
83 {"a": "ab"}
84 ]
85 },
86 {
87 "name": "arg is special nothing",
88 "selector" : "$[?length(value(@.a))>0]",
89 "document" : [
90 {"a": "ab"},
91 {"c": "d"},
92 {"a": null}
93 ],
94 "result": [
95 {"a": "ab"}
96 ]
97 }
98 ]
99 }