]>
Commit | Line | Data |
---|---|---|
f85f8ebb BP |
1 | AT_BANNER([OVSDB -- atoms]) |
2 | ||
5c414a2e | 3 | OVSDB_CHECK_POSITIVE([integer atom from JSON], |
f85f8ebb BP |
4 | [[parse-atoms '["integer"]' \ |
5 | '[0]' \ | |
6 | '[-1]' \ | |
7 | '[1e3]' \ | |
8 | '[9223372036854775807]' \ | |
9 | '[-9223372036854775808]' ]], | |
10 | [0 | |
11 | -1 | |
12 | 1000 | |
13 | 9223372036854775807 | |
14 | -9223372036854775808]) | |
15 | ||
5c414a2e BP |
16 | OVSDB_CHECK_POSITIVE([integer atom from string], |
17 | [[parse-atom-strings -- '["integer"]' \ | |
18 | '0' \ | |
19 | '-1' \ | |
20 | '+1000' \ | |
21 | '9223372036854775807' \ | |
22 | '-9223372036854775808' ]], | |
23 | [0 | |
24 | -1 | |
25 | 1000 | |
26 | 9223372036854775807 | |
27 | -9223372036854775808]) | |
28 | ||
29 | OVSDB_CHECK_POSITIVE([real atom from JSON], | |
f85f8ebb BP |
30 | [[parse-atoms '["real"]' \ |
31 | '[0]' \ | |
32 | '[0.0]' \ | |
33 | '[-0.0]' \ | |
34 | '[-1.25]' \ | |
35 | '[1e3]' \ | |
36 | '[1e37]' \ | |
37 | '[0.00390625]' ]], | |
38 | [0 | |
39 | 0 | |
40 | 0 | |
41 | -1.25 | |
42 | 1000 | |
43 | 1e+37 | |
44 | 0.00390625]) | |
45 | ||
5c414a2e BP |
46 | OVSDB_CHECK_POSITIVE([real atom from string], |
47 | [[parse-atom-strings -- '["real"]' \ | |
48 | '0' \ | |
49 | '0.0' \ | |
50 | '-0.0' \ | |
51 | '-1.25' \ | |
52 | '1e3' \ | |
53 | '1e37' \ | |
54 | '0.00390625' ]], | |
55 | [0 | |
56 | 0 | |
57 | 0 | |
58 | -1.25 | |
59 | 1000 | |
60 | 1e+37 | |
61 | 0.00390625]) | |
62 | ||
63 | OVSDB_CHECK_POSITIVE([boolean atom from JSON], | |
f85f8ebb BP |
64 | [[parse-atoms '["boolean"]' '[true]' '[false]' ]], |
65 | [true | |
66 | false]) | |
67 | ||
5c414a2e BP |
68 | OVSDB_CHECK_POSITIVE([boolean atom from string], |
69 | [[parse-atom-strings '["boolean"]' 'true' 'false' ]], | |
70 | [true | |
71 | false]) | |
72 | ||
73 | OVSDB_CHECK_POSITIVE([string atom from JSON], | |
f85f8ebb BP |
74 | [[parse-atoms '["string"]' '[""]' '["true"]' '["\"\\\/\b\f\n\r\t"]']], |
75 | ["" | |
76 | "true" | |
77 | "\"\\/\b\f\n\r\t"]) | |
78 | ||
5c414a2e BP |
79 | OVSDB_CHECK_POSITIVE([string atom from string], |
80 | [[parse-atom-strings '["string"]' \ | |
81 | 'unquoted' \ | |
82 | '"quoted-string"' \ | |
83 | '"needs quotes"' \ | |
84 | '""' \ | |
85 | '"true"' \ | |
86 | '"\"\\\/\b\f\n\r\t"']], | |
87 | [unquoted | |
88 | quoted-string | |
89 | "needs quotes" | |
90 | "" | |
91 | "true" | |
92 | "\"\\/\b\f\n\r\t"]) | |
93 | ||
94 | OVSDB_CHECK_POSITIVE([uuid atom from JSON], | |
f85f8ebb BP |
95 | [[parse-atoms '["uuid"]' '["uuid", "550e8400-e29b-41d4-a716-446655440000"]']], |
96 | [[["uuid","550e8400-e29b-41d4-a716-446655440000"]]]) | |
97 | ||
5c414a2e BP |
98 | OVSDB_CHECK_POSITIVE([uuid atom from string], |
99 | [[parse-atom-strings '["uuid"]' '550e8400-e29b-41d4-a716-446655440000']], | |
100 | [550e8400-e29b-41d4-a716-446655440000]) | |
101 | ||
f85f8ebb BP |
102 | OVSDB_CHECK_POSITIVE([integer atom sorting], |
103 | [[sort-atoms '["integer"]' '[55,0,-1,2,1]']], | |
104 | [[[-1,0,1,2,55]]]) | |
105 | ||
106 | OVSDB_CHECK_POSITIVE([real atom sorting], | |
107 | [[sort-atoms '["real"]' '[1.25,1.23,0.0,-0.0,-1e99]']], | |
108 | [[[-1e+99,0,0,1.23,1.25]]]) | |
109 | ||
110 | OVSDB_CHECK_POSITIVE([boolean atom sorting], | |
111 | [[sort-atoms '["boolean"]' '[true,false,true,false,false]']], | |
112 | [[[false,false,false,true,true]]]) | |
113 | ||
114 | OVSDB_CHECK_POSITIVE([string atom sorting], | |
115 | [[sort-atoms '["string"]' '["abd","abc","\b","xxx"]']], | |
116 | [[["\b","abc","abd","xxx"]]]) | |
117 | ||
118 | OVSDB_CHECK_POSITIVE([uuid atom sorting], | |
119 | [[sort-atoms '["uuid"]' '[ | |
120 | ["uuid", "00000000-0000-0000-0000-000000000001"], | |
121 | ["uuid", "00000000-1000-0000-0000-000000000000"], | |
122 | ["uuid", "00000000-0000-1000-0000-000000000000"], | |
123 | ["uuid", "00010000-0000-0000-0000-000000000000"], | |
124 | ["uuid", "00000000-0000-0000-0000-000000000100"], | |
125 | ["uuid", "00000000-0000-0000-0000-000100000000"], | |
126 | ["uuid", "00000000-0000-0010-0000-000000000000"], | |
127 | ["uuid", "00000100-0000-0000-0000-000000000000"], | |
128 | ["uuid", "00000000-0000-0001-0000-000000000000"], | |
129 | ["uuid", "00000000-0000-0000-0000-000001000000"], | |
130 | ["uuid", "01000000-0000-0000-0000-000000000000"], | |
131 | ["uuid", "00000000-0000-0000-0000-000000001000"], | |
132 | ["uuid", "00000000-0000-0000-0000-000010000000"], | |
133 | ["uuid", "00000000-0000-0000-0000-010000000000"], | |
134 | ["uuid", "00000000-0000-0100-0000-000000000000"], | |
135 | ["uuid", "10000000-0000-0000-0000-000000000000"], | |
136 | ["uuid", "00000000-0000-0000-0000-000000000010"], | |
137 | ["uuid", "00000000-0100-0000-0000-000000000000"], | |
138 | ["uuid", "00000000-0000-0000-0100-000000000000"], | |
139 | ["uuid", "00000000-0000-0000-0001-000000000000"], | |
140 | ["uuid", "00000010-0000-0000-0000-000000000000"], | |
141 | ["uuid", "00000000-0000-0000-0010-000000000000"], | |
142 | ["uuid", "00000000-0000-0000-0000-000000010000"], | |
143 | ["uuid", "00000000-0000-0000-1000-000000000000"], | |
144 | ["uuid", "00000000-0000-0000-0000-100000000000"], | |
145 | ["uuid", "00000000-0000-0000-0000-001000000000"], | |
146 | ["uuid", "00000000-0000-0000-0000-000000100000"], | |
147 | ["uuid", "00000000-0000-0000-0000-000000000000"], | |
148 | ["uuid", "00000000-0010-0000-0000-000000000000"], | |
149 | ["uuid", "00100000-0000-0000-0000-000000000000"], | |
150 | ["uuid", "00000000-0001-0000-0000-000000000000"], | |
151 | ["uuid", "00000001-0000-0000-0000-000000000000"], | |
152 | ["uuid", "00001000-0000-0000-0000-000000000000"]]']], | |
153 | [[[["uuid","00000000-0000-0000-0000-000000000000"],["uuid","00000000-0000-0000-0000-000000000001"],["uuid","00000000-0000-0000-0000-000000000010"],["uuid","00000000-0000-0000-0000-000000000100"],["uuid","00000000-0000-0000-0000-000000001000"],["uuid","00000000-0000-0000-0000-000000010000"],["uuid","00000000-0000-0000-0000-000000100000"],["uuid","00000000-0000-0000-0000-000001000000"],["uuid","00000000-0000-0000-0000-000010000000"],["uuid","00000000-0000-0000-0000-000100000000"],["uuid","00000000-0000-0000-0000-001000000000"],["uuid","00000000-0000-0000-0000-010000000000"],["uuid","00000000-0000-0000-0000-100000000000"],["uuid","00000000-0000-0000-0001-000000000000"],["uuid","00000000-0000-0000-0010-000000000000"],["uuid","00000000-0000-0000-0100-000000000000"],["uuid","00000000-0000-0000-1000-000000000000"],["uuid","00000000-0000-0001-0000-000000000000"],["uuid","00000000-0000-0010-0000-000000000000"],["uuid","00000000-0000-0100-0000-000000000000"],["uuid","00000000-0000-1000-0000-000000000000"],["uuid","00000000-0001-0000-0000-000000000000"],["uuid","00000000-0010-0000-0000-000000000000"],["uuid","00000000-0100-0000-0000-000000000000"],["uuid","00000000-1000-0000-0000-000000000000"],["uuid","00000001-0000-0000-0000-000000000000"],["uuid","00000010-0000-0000-0000-000000000000"],["uuid","00000100-0000-0000-0000-000000000000"],["uuid","00001000-0000-0000-0000-000000000000"],["uuid","00010000-0000-0000-0000-000000000000"],["uuid","00100000-0000-0000-0000-000000000000"],["uuid","01000000-0000-0000-0000-000000000000"],["uuid","10000000-0000-0000-0000-000000000000"]]]]) | |
154 | ||
5c414a2e | 155 | OVSDB_CHECK_NEGATIVE([real not acceptable integer JSON atom], |
f85f8ebb BP |
156 | [[parse-atoms '["integer"]' '[0.5]' ]], |
157 | [expected integer]) | |
158 | ||
5c414a2e BP |
159 | OVSDB_CHECK_NEGATIVE([real not acceptable integer string atom], |
160 | [[parse-atom-strings '["integer"]' '0.5' ]], | |
161 | ["0.5" is not a valid integer]) | |
162 | ||
163 | OVSDB_CHECK_NEGATIVE([string "true" not acceptable boolean JSON atom], | |
f85f8ebb BP |
164 | [[parse-atoms '["boolean"]' '["true"]' ]], |
165 | [expected boolean]) | |
166 | ||
5c414a2e BP |
167 | OVSDB_CHECK_NEGATIVE([string "true" not acceptable boolean string atom], |
168 | [[parse-atom-strings '["boolean"]' '"true"' ]], | |
169 | [""true"" is not a valid boolean (use "true" or "false")]) | |
170 | ||
171 | OVSDB_CHECK_NEGATIVE([integer not acceptable string JSON atom], | |
f85f8ebb BP |
172 | [[parse-atoms '["string"]' '[1]']], |
173 | [expected string]) | |
174 | ||
5c414a2e | 175 | OVSDB_CHECK_NEGATIVE([uuid atom must be expressed as JSON array], |
f85f8ebb BP |
176 | [[parse-atoms '["uuid"]' '["550e8400-e29b-41d4-a716-446655440000"]']], |
177 | [[expected ["uuid", <string>]]]) | |
178 | ||
5c414a2e BP |
179 | OVSDB_CHECK_NEGATIVE([empty string atom must be quoted], |
180 | [[parse-atom-strings '["string"]' '']], | |
181 | [An empty string is not valid as input; use "" to represent the empty string]) | |
182 | ||
183 | OVSDB_CHECK_NEGATIVE([quotes must be balanced], | |
184 | [parse-atom-strings '[["string"]]' '"asdf'], | |
185 | ["asdf: missing quote at end of quoted string]) | |
186 | ||
187 | OVSDB_CHECK_NEGATIVE([uuids must be valid], | |
188 | [parse-atom-strings '[["uuid"]]' '1234-5678'], | |
189 | ["1234-5678" is not a valid UUID]) | |
190 | ||
f85f8ebb BP |
191 | AT_BANNER([OSVDB -- simple data]) |
192 | ||
5c414a2e | 193 | OVSDB_CHECK_POSITIVE([integer JSON datum], |
f85f8ebb BP |
194 | [[parse-data '["integer"]' '[0]' '[1]' '[-1]']], |
195 | [0 | |
196 | 1 | |
197 | -1]) | |
198 | ||
5c414a2e BP |
199 | OVSDB_CHECK_POSITIVE([integer string datum], |
200 | [[parse-data-strings -- '["integer"]' '0' '1' '-1' '+1']], | |
201 | [0 | |
202 | 1 | |
203 | -1 | |
204 | 1]) | |
205 | ||
206 | OVSDB_CHECK_POSITIVE([real JSON datum], | |
f85f8ebb BP |
207 | [[parse-data '["real"]' '[0]' '[1.0]' '[-1.25]']], |
208 | [0 | |
209 | 1 | |
210 | -1.25]) | |
211 | ||
5c414a2e BP |
212 | OVSDB_CHECK_POSITIVE([real string datum], |
213 | [[parse-data-strings -- '["real"]' '0' '1.0' '-1.25']], | |
214 | [0 | |
215 | 1 | |
216 | -1.25]) | |
217 | ||
218 | OVSDB_CHECK_POSITIVE([boolean JSON datum], | |
f85f8ebb BP |
219 | [[parse-data '["boolean"]' '[true]' '[false]' ]], |
220 | [true | |
221 | false]) | |
222 | ||
5c414a2e BP |
223 | OVSDB_CHECK_POSITIVE([boolean string datum], |
224 | [[parse-data-strings '["boolean"]' 'true' 'false' ]], | |
225 | [true | |
226 | false]) | |
227 | ||
228 | OVSDB_CHECK_POSITIVE([string JSON datum], | |
f85f8ebb BP |
229 | [[parse-data '["string"]' '[""]' '["true"]' '["\"\\\/\b\f\n\r\t"]']], |
230 | ["" | |
231 | "true" | |
232 | "\"\\/\b\f\n\r\t"]) | |
233 | ||
5c414a2e BP |
234 | OVSDB_CHECK_POSITIVE([string string datum], |
235 | [[parse-data-strings '["string"]' '"x"' '""' '"true"' '"\"\\\/\b\f\n\r\t"']], | |
236 | [x | |
237 | "" | |
238 | "true" | |
239 | "\"\\/\b\f\n\r\t"]) | |
240 | ||
f85f8ebb BP |
241 | AT_BANNER([OVSDB -- set data]) |
242 | ||
5c414a2e | 243 | OVSDB_CHECK_POSITIVE([JSON optional boolean], |
f85f8ebb BP |
244 | [[parse-data '{"key": "boolean", "min": 0}' \ |
245 | '["set", [true]]' \ | |
246 | '["set", [false]]' \ | |
247 | '["set", []]']], | |
248 | [[["set",[true]] | |
249 | ["set",[false]] | |
250 | ["set",[]]]], | |
251 | [set]) | |
252 | ||
5c414a2e BP |
253 | OVSDB_CHECK_POSITIVE([string optional boolean], |
254 | [[parse-data-strings '{"key": "boolean", "min": 0}' \ | |
255 | 'true' \ | |
256 | 'false' \ | |
257 | '[]']], | |
258 | [[true | |
259 | false | |
260 | []]], | |
261 | [set]) | |
262 | ||
263 | OVSDB_CHECK_POSITIVE([JSON set of 0 or more integers], | |
f85f8ebb BP |
264 | [[parse-data '{"key": "integer", "min": 0, "max": "unlimited"}' \ |
265 | '["set", [0]]' \ | |
266 | '["set", [0, 1]]' \ | |
267 | '["set", [0, 1, 2]]' \ | |
268 | '["set", [0, 1, 2, 3, 4, 5]]' \ | |
269 | '["set", [0, 1, 2, 3, 4, 5, 6, 7, 8]]' \ | |
270 | '["set", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]']], | |
271 | [[["set",[0]] | |
272 | ["set",[0,1]] | |
273 | ["set",[0,1,2]] | |
274 | ["set",[0,1,2,3,4,5]] | |
275 | ["set",[0,1,2,3,4,5,6,7,8]] | |
276 | ["set",[0,1,2,3,4,5,6,7,8,9,10]]]]) | |
277 | ||
5c414a2e BP |
278 | OVSDB_CHECK_POSITIVE([string set of 0 or more integers], |
279 | [[parse-data-strings '{"key": "integer", "min": 0, "max": "unlimited"}' \ | |
280 | '0' \ | |
281 | '0,1' \ | |
282 | '0, 1, 2' \ | |
283 | '[0, 1,2, 3, 4, 5]' \ | |
284 | '0, 1,2, 3,4, 5, 6, 7, 8' \ | |
285 | '[0, 1, 2, 3, 4,5, 6,7, 8, 9, 10]']], | |
286 | [[[0] | |
287 | [0, 1] | |
288 | [0, 1, 2] | |
289 | [0, 1, 2, 3, 4, 5] | |
290 | [0, 1, 2, 3, 4, 5, 6, 7, 8] | |
291 | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]]) | |
292 | ||
293 | OVSDB_CHECK_POSITIVE([JSON set of 1 to 3 uuids], | |
f85f8ebb BP |
294 | [[parse-data '{"key": "uuid", "min": 1, "max": 3}' \ |
295 | '["set", [["uuid", "550e8400-e29b-41d4-a716-446655440000"]]]' \ | |
296 | '["set", [["uuid", "c5051240-30ff-43ed-b4b9-93cf3f050813"], | |
297 | ["uuid", "90558331-09af-4d2f-a572-509cad2e9088"], | |
298 | ["uuid", "550e8400-e29b-41d4-a716-446655440000"]]]']], | |
299 | [[["set",[["uuid","550e8400-e29b-41d4-a716-446655440000"]]] | |
300 | ["set",[["uuid","550e8400-e29b-41d4-a716-446655440000"],["uuid","90558331-09af-4d2f-a572-509cad2e9088"],["uuid","c5051240-30ff-43ed-b4b9-93cf3f050813"]]]]]) | |
301 | ||
5c414a2e BP |
302 | OVSDB_CHECK_POSITIVE([string set of 1 to 3 uuids], |
303 | [[parse-data-strings '{"key": "uuid", "min": 1, "max": 3}' \ | |
304 | '[550e8400-e29b-41d4-a716-446655440000]' \ | |
305 | '[c5051240-30ff-43ed-b4b9-93cf3f050813, | |
306 | 90558331-09af-4d2f-a572-509cad2e9088, | |
307 | 550e8400-e29b-41d4-a716-446655440000]']], | |
308 | [[[550e8400-e29b-41d4-a716-446655440000] | |
309 | [550e8400-e29b-41d4-a716-446655440000, 90558331-09af-4d2f-a572-509cad2e9088, c5051240-30ff-43ed-b4b9-93cf3f050813]]]) | |
310 | ||
311 | OVSDB_CHECK_POSITIVE([JSON set of 0 to 3 strings], | |
f85f8ebb BP |
312 | [[parse-data '{"key": "string", "min": 0, "max": 3}' \ |
313 | '["set", []]' \ | |
314 | '["set", ["a relatively long string"]]' \ | |
315 | '["set", ["short string", "a relatively long string"]]' \ | |
316 | '["set", ["zzz", "short string", "a relatively long string"]]']], | |
317 | [[["set",[]] | |
318 | ["set",["a relatively long string"]] | |
319 | ["set",["a relatively long string","short string"]] | |
320 | ["set",["a relatively long string","short string","zzz"]]]]) | |
321 | ||
5c414a2e BP |
322 | OVSDB_CHECK_POSITIVE([string set of 0 to 3 strings], |
323 | [[parse-data-strings '{"key": "string", "min": 0, "max": 3}' \ | |
324 | '[]' \ | |
325 | '"a relatively long string"' \ | |
326 | '["short string", "a relatively long string"]' \ | |
327 | '"zzz","short string","a relatively long string"']], | |
328 | [[[] | |
329 | ["a relatively long string"] | |
330 | ["a relatively long string", "short string"] | |
331 | ["a relatively long string", "short string", zzz]]]) | |
332 | ||
333 | OVSDB_CHECK_NEGATIVE([duplicate boolean not allowed in JSON set], | |
f85f8ebb BP |
334 | [[parse-data '{"key": "boolean", "max": 5}' '["set", [true, true]]']], |
335 | [ovsdb error: set contains duplicate]) | |
336 | ||
5c414a2e BP |
337 | OVSDB_CHECK_NEGATIVE([duplicate boolean not allowed in string set], |
338 | [[parse-data-strings '{"key": "boolean", "max": 5}' 'true, true']], | |
339 | [set contains duplicate value]) | |
340 | ||
341 | OVSDB_CHECK_NEGATIVE([duplicate integer not allowed in JSON set], | |
f85f8ebb BP |
342 | [[parse-data '{"key": "integer", "max": 5}' '["set", [1, 2, 3, 1]]']], |
343 | [ovsdb error: set contains duplicate]) | |
344 | ||
5c414a2e BP |
345 | OVSDB_CHECK_NEGATIVE([duplicate integer not allowed in string set], |
346 | [[parse-data-strings '{"key": "integer", "max": 5}' '[1, 2, 3, 1]']], | |
347 | [set contains duplicate value]) | |
348 | ||
349 | OVSDB_CHECK_NEGATIVE([duplicate real not allowed in JSON set], | |
f85f8ebb BP |
350 | [[parse-data '{"key": "real", "max": 5}' '["set", [0.0, -0.0]]']], |
351 | [ovsdb error: set contains duplicate]) | |
352 | ||
5c414a2e BP |
353 | OVSDB_CHECK_NEGATIVE([duplicate real not allowed in string set], |
354 | [[parse-data-strings '{"key": "real", "max": 5}' '0.0, -0.0']], | |
355 | [set contains duplicate value]) | |
356 | ||
357 | OVSDB_CHECK_NEGATIVE([duplicate string not allowed in JSON set], | |
f85f8ebb BP |
358 | [[parse-data '{"key": "string", "max": 5}' '["set", ["asdf", "ASDF", "asdf"]]']], |
359 | [ovsdb error: set contains duplicate]) | |
360 | ||
5c414a2e BP |
361 | OVSDB_CHECK_NEGATIVE([duplicate string not allowed in string set], |
362 | [[parse-data-strings '{"key": "string", "max": 5}' 'asdf, ASDF, "asdf"']], | |
363 | [set contains duplicate value]) | |
364 | ||
365 | OVSDB_CHECK_NEGATIVE([duplicate uuid not allowed in JSON set], | |
f85f8ebb BP |
366 | [[parse-data '{"key": "uuid", "max": 5}' \ |
367 | '["set", [["uuid", "7ef21525-0088-4a28-a418-5518413e43ea"], | |
368 | ["uuid", "355ad037-f1da-40aa-b47c-ff9c7e8c6a38"], | |
369 | ["uuid", "7ef21525-0088-4a28-a418-5518413e43ea"]]]']], | |
370 | [ovsdb error: set contains duplicate]) | |
371 | ||
5c414a2e BP |
372 | OVSDB_CHECK_NEGATIVE([duplicate uuid not allowed in string set], |
373 | [[parse-data-strings '{"key": "uuid", "max": 5}' \ | |
374 | '7ef21525-0088-4a28-a418-5518413e43ea, | |
375 | 355ad037-f1da-40aa-b47c-ff9c7e8c6a38, | |
376 | 7ef21525-0088-4a28-a418-5518413e43ea']], | |
377 | [set contains duplicate value]) | |
378 | ||
f85f8ebb BP |
379 | AT_BANNER([OVSDB -- map data]) |
380 | ||
5c414a2e | 381 | OVSDB_CHECK_POSITIVE([JSON map of 1 integer to boolean], |
f85f8ebb BP |
382 | [[parse-data '{"key": "integer", "value": "boolean"}' \ |
383 | '["map", [[1, true]]]']], | |
384 | [[["map",[[1,true]]]]]) | |
385 | ||
5c414a2e BP |
386 | OVSDB_CHECK_POSITIVE([string map of 1 integer to boolean], |
387 | [[parse-data-strings '{"key": "integer", "value": "boolean"}' \ | |
388 | '1=true']], | |
389 | [[1=true]]) | |
390 | ||
391 | OVSDB_CHECK_POSITIVE([JSON map of at least 1 integer to boolean], | |
f85f8ebb BP |
392 | [[parse-data '{"key": "integer", "value": "boolean", "max": "unlimited"}' \ |
393 | '["map", [[1, true]]]' \ | |
394 | '["map", [[0, true], [1, false], [2, true], [3, true], [4, true]]]' \ | |
395 | '["map", [[3, false], [0, true], [4, false]]]']], | |
396 | [[["map",[[1,true]]] | |
397 | ["map",[[0,true],[1,false],[2,true],[3,true],[4,true]]] | |
398 | ["map",[[0,true],[3,false],[4,false]]]]]) | |
399 | ||
5c414a2e BP |
400 | OVSDB_CHECK_POSITIVE([string map of at least 1 integer to boolean], |
401 | [[parse-data-strings '{"key": "integer", "value": "boolean", "max": "unlimited"}' \ | |
402 | '1=true' \ | |
403 | '0=true 1=false 2=true, 3=true 4=true,' \ | |
404 | '3=false,0=true ,4=false']], | |
405 | [[{1=true} | |
406 | {0=true, 1=false, 2=true, 3=true, 4=true} | |
407 | {0=true, 3=false, 4=false}]]) | |
408 | ||
409 | OVSDB_CHECK_POSITIVE([JSON map of 1 boolean to integer], | |
f85f8ebb BP |
410 | [[parse-data '{"key": "boolean", "value": "integer"}' \ |
411 | '["map", [[true, 1]]]']], | |
412 | [[["map",[[true,1]]]]]) | |
413 | ||
5c414a2e BP |
414 | OVSDB_CHECK_POSITIVE([string map of 1 boolean to integer], |
415 | [[parse-data-strings '{"key": "boolean", "value": "integer"}' \ | |
416 | 'true=1']], | |
417 | [[true=1]]) | |
418 | ||
419 | OVSDB_CHECK_POSITIVE([JSON map of 1 uuid to real], | |
31a763d7 | 420 | [[parse-data '{"key": "uuid", "value": "real", "min": 1, "max": 5}' \ |
f85f8ebb BP |
421 | '["map", [[["uuid", "cad8542b-6ee1-486b-971b-7dcbf6e14979"], 1.0], |
422 | [["uuid", "6b94b968-2702-4f64-9457-314a34d69b8c"], 2.0], | |
423 | [["uuid", "d2c4a168-24de-47eb-a8a3-c1abfc814979"], 3.0], | |
424 | [["uuid", "25bfa475-d072-4f60-8be1-00f48643e9cb"], 4.0], | |
425 | [["uuid", "1c92b8ca-d5e4-4628-a85d-1dc2d099a99a"], 5.0]]]']], | |
426 | [[["map",[[["uuid","1c92b8ca-d5e4-4628-a85d-1dc2d099a99a"],5],[["uuid","25bfa475-d072-4f60-8be1-00f48643e9cb"],4],[["uuid","6b94b968-2702-4f64-9457-314a34d69b8c"],2],[["uuid","cad8542b-6ee1-486b-971b-7dcbf6e14979"],1],[["uuid","d2c4a168-24de-47eb-a8a3-c1abfc814979"],3]]]]]) | |
427 | ||
5c414a2e BP |
428 | OVSDB_CHECK_POSITIVE([string map of 1 uuid to real], |
429 | [[parse-data-strings '{"key": "uuid", "value": "real", "min": 1, "max": 5}' \ | |
430 | 'cad8542b-6ee1-486b-971b-7dcbf6e14979=1.0, | |
431 | 6b94b968-2702-4f64-9457-314a34d69b8c=2.0, | |
432 | d2c4a168-24de-47eb-a8a3-c1abfc814979=3.0, | |
433 | 25bfa475-d072-4f60-8be1-00f48643e9cb=4.0, | |
434 | 1c92b8ca-d5e4-4628-a85d-1dc2d099a99a=5.0']], | |
435 | [[{1c92b8ca-d5e4-4628-a85d-1dc2d099a99a=5, 25bfa475-d072-4f60-8be1-00f48643e9cb=4, 6b94b968-2702-4f64-9457-314a34d69b8c=2, cad8542b-6ee1-486b-971b-7dcbf6e14979=1, d2c4a168-24de-47eb-a8a3-c1abfc814979=3}]]) | |
436 | ||
437 | OVSDB_CHECK_POSITIVE([JSON map of 10 string to string], | |
31a763d7 | 438 | [[parse-data '{"key": "string", "value": "string", "min": 1, "max": 10}' \ |
f85f8ebb BP |
439 | '["map", [["2 gills", "1 chopin"], |
440 | ["2 chopins", "1 pint"], | |
441 | ["2 pints", "1 quart"], | |
442 | ["2 quarts", "1 pottle"], | |
443 | ["2 pottles", "1 gallon"], | |
444 | ["2 gallons", "1 peck"], | |
445 | ["2 pecks", "1 demibushel"], | |
446 | ["2 demibushel", "1 firkin"], | |
447 | ["2 firkins", "1 kilderkin"], | |
448 | ["2 kilderkins", "1 barrel"]]]']], | |
449 | [[["map",[["2 chopins","1 pint"],["2 demibushel","1 firkin"],["2 firkins","1 kilderkin"],["2 gallons","1 peck"],["2 gills","1 chopin"],["2 kilderkins","1 barrel"],["2 pecks","1 demibushel"],["2 pints","1 quart"],["2 pottles","1 gallon"],["2 quarts","1 pottle"]]]]]) | |
450 | ||
5c414a2e BP |
451 | OVSDB_CHECK_POSITIVE([string map of 10 string to string], |
452 | [[parse-data-strings '{"key": "string", "value": "string", "min": 1, "max": 10}' \ | |
453 | '{"2 gills"="1 chopin", | |
454 | "2 chopins"= "1 pint", | |
455 | "2 pints"= "1 quart", | |
456 | "2 quarts"= "1 pottle", | |
457 | "2 pottles"= "1 gallon", | |
458 | "2 gallons"= "1 peck", | |
459 | "2 pecks"= "1 demibushel", | |
460 | "2 demibushel"= "1 firkin", | |
461 | "2 firkins"= "1 kilderkin", | |
462 | "2 kilderkins"= "1 barrel"}']], | |
463 | [[{"2 chopins"="1 pint", "2 demibushel"="1 firkin", "2 firkins"="1 kilderkin", "2 gallons"="1 peck", "2 gills"="1 chopin", "2 kilderkins"="1 barrel", "2 pecks"="1 demibushel", "2 pints"="1 quart", "2 pottles"="1 gallon", "2 quarts"="1 pottle"}]]) | |
464 | ||
465 | OVSDB_CHECK_NEGATIVE([duplicate integer key not allowed in JSON map], | |
f85f8ebb BP |
466 | [[parse-data '{"key": "integer", "value": "boolean", "max": 5}' \ |
467 | '["map", [[1, true], [2, false], [1, false]]]']], | |
468 | [ovsdb error: map contains duplicate key]) | |
5c414a2e BP |
469 | |
470 | OVSDB_CHECK_NEGATIVE([duplicate integer key not allowed in string map], | |
471 | [[parse-data-strings '{"key": "integer", "value": "boolean", "max": 5}' \ | |
472 | '1=true 2=false 1=false']], | |
473 | [map contains duplicate key]) |