1 AT_BANNER([OVSDB -- default values])
3 OVSDB_CHECK_POSITIVE([default atoms],
11 OVSDB_CHECK_POSITIVE([default data],
13 [[key integer, value void, n_min 0: OK
14 key integer, value integer, n_min 0: OK
15 key integer, value real, n_min 0: OK
16 key integer, value boolean, n_min 0: OK
17 key integer, value string, n_min 0: OK
18 key integer, value uuid, n_min 0: OK
19 key real, value void, n_min 0: OK
20 key real, value integer, n_min 0: OK
21 key real, value real, n_min 0: OK
22 key real, value boolean, n_min 0: OK
23 key real, value string, n_min 0: OK
24 key real, value uuid, n_min 0: OK
25 key boolean, value void, n_min 0: OK
26 key boolean, value integer, n_min 0: OK
27 key boolean, value real, n_min 0: OK
28 key boolean, value boolean, n_min 0: OK
29 key boolean, value string, n_min 0: OK
30 key boolean, value uuid, n_min 0: OK
31 key string, value void, n_min 0: OK
32 key string, value integer, n_min 0: OK
33 key string, value real, n_min 0: OK
34 key string, value boolean, n_min 0: OK
35 key string, value string, n_min 0: OK
36 key string, value uuid, n_min 0: OK
37 key uuid, value void, n_min 0: OK
38 key uuid, value integer, n_min 0: OK
39 key uuid, value real, n_min 0: OK
40 key uuid, value boolean, n_min 0: OK
41 key uuid, value string, n_min 0: OK
42 key uuid, value uuid, n_min 0: OK
43 key integer, value void, n_min 1: OK
44 key integer, value integer, n_min 1: OK
45 key integer, value real, n_min 1: OK
46 key integer, value boolean, n_min 1: OK
47 key integer, value string, n_min 1: OK
48 key integer, value uuid, n_min 1: OK
49 key real, value void, n_min 1: OK
50 key real, value integer, n_min 1: OK
51 key real, value real, n_min 1: OK
52 key real, value boolean, n_min 1: OK
53 key real, value string, n_min 1: OK
54 key real, value uuid, n_min 1: OK
55 key boolean, value void, n_min 1: OK
56 key boolean, value integer, n_min 1: OK
57 key boolean, value real, n_min 1: OK
58 key boolean, value boolean, n_min 1: OK
59 key boolean, value string, n_min 1: OK
60 key boolean, value uuid, n_min 1: OK
61 key string, value void, n_min 1: OK
62 key string, value integer, n_min 1: OK
63 key string, value real, n_min 1: OK
64 key string, value boolean, n_min 1: OK
65 key string, value string, n_min 1: OK
66 key string, value uuid, n_min 1: OK
67 key uuid, value void, n_min 1: OK
68 key uuid, value integer, n_min 1: OK
69 key uuid, value real, n_min 1: OK
70 key uuid, value boolean, n_min 1: OK
71 key uuid, value string, n_min 1: OK
72 key uuid, value uuid, n_min 1: OK]])
74 AT_BANNER([OVSDB -- atoms without constraints])
76 OVSDB_CHECK_POSITIVE([integer atom from JSON],
77 [[parse-atoms '["integer"]' \
81 '[9223372036854775807]' \
82 '[-9223372036854775808]' ]],
87 -9223372036854775808])
89 OVSDB_CHECK_POSITIVE([integer atom from string],
90 [[parse-atom-strings -- '["integer"]' \
94 '9223372036854775807' \
95 '-9223372036854775808' ]],
100 -9223372036854775808])
102 OVSDB_CHECK_POSITIVE([real atom from JSON],
103 [[parse-atoms '["real"]' \
119 OVSDB_CHECK_POSITIVE([real atom from string],
120 [[parse-atom-strings -- '["real"]' \
136 OVSDB_CHECK_POSITIVE([boolean atom from JSON],
137 [[parse-atoms '["boolean"]' '[true]' '[false]' ]],
141 OVSDB_CHECK_POSITIVE([boolean atom from string],
142 [[parse-atom-strings '["boolean"]' 'true' 'false' ]],
146 OVSDB_CHECK_POSITIVE([string atom from JSON],
147 [[parse-atoms '["string"]' '[""]' '["true"]' '["\"\\\/\b\f\n\r\t"]']],
152 OVSDB_CHECK_POSITIVE([string atom from string],
153 [[parse-atom-strings '["string"]' \
159 '"\"\\\/\b\f\n\r\t"']],
167 OVSDB_CHECK_POSITIVE([uuid atom from JSON],
168 [[parse-atoms '["uuid"]' '["uuid", "550e8400-e29b-41d4-a716-446655440000"]']],
169 [[["uuid","550e8400-e29b-41d4-a716-446655440000"]]])
171 OVSDB_CHECK_POSITIVE([uuid atom from string],
172 [[parse-atom-strings '["uuid"]' '550e8400-e29b-41d4-a716-446655440000']],
173 [550e8400-e29b-41d4-a716-446655440000])
175 OVSDB_CHECK_POSITIVE([integer atom sorting],
176 [[sort-atoms '["integer"]' '[55,0,-1,2,1]']],
179 OVSDB_CHECK_POSITIVE([real atom sorting],
180 [[sort-atoms '["real"]' '[1.25,1.23,0.0,-0.0,-1e99]']],
181 [[[-1e+99,0,0,1.23,1.25]]])
183 OVSDB_CHECK_POSITIVE([boolean atom sorting],
184 [[sort-atoms '["boolean"]' '[true,false,true,false,false]']],
185 [[[false,false,false,true,true]]])
187 OVSDB_CHECK_POSITIVE([string atom sorting],
188 [[sort-atoms '["string"]' '["abd","abc","\b","xxx"]']],
189 [[["\b","abc","abd","xxx"]]])
191 OVSDB_CHECK_POSITIVE([uuid atom sorting],
192 [[sort-atoms '["uuid"]' '[
193 ["uuid", "00000000-0000-0000-0000-000000000001"],
194 ["uuid", "00000000-1000-0000-0000-000000000000"],
195 ["uuid", "00000000-0000-1000-0000-000000000000"],
196 ["uuid", "00010000-0000-0000-0000-000000000000"],
197 ["uuid", "00000000-0000-0000-0000-000000000100"],
198 ["uuid", "00000000-0000-0000-0000-000100000000"],
199 ["uuid", "00000000-0000-0010-0000-000000000000"],
200 ["uuid", "00000100-0000-0000-0000-000000000000"],
201 ["uuid", "00000000-0000-0001-0000-000000000000"],
202 ["uuid", "00000000-0000-0000-0000-000001000000"],
203 ["uuid", "01000000-0000-0000-0000-000000000000"],
204 ["uuid", "00000000-0000-0000-0000-000000001000"],
205 ["uuid", "00000000-0000-0000-0000-000010000000"],
206 ["uuid", "00000000-0000-0000-0000-010000000000"],
207 ["uuid", "00000000-0000-0100-0000-000000000000"],
208 ["uuid", "10000000-0000-0000-0000-000000000000"],
209 ["uuid", "00000000-0000-0000-0000-000000000010"],
210 ["uuid", "00000000-0100-0000-0000-000000000000"],
211 ["uuid", "00000000-0000-0000-0100-000000000000"],
212 ["uuid", "00000000-0000-0000-0001-000000000000"],
213 ["uuid", "00000010-0000-0000-0000-000000000000"],
214 ["uuid", "00000000-0000-0000-0010-000000000000"],
215 ["uuid", "00000000-0000-0000-0000-000000010000"],
216 ["uuid", "00000000-0000-0000-1000-000000000000"],
217 ["uuid", "00000000-0000-0000-0000-100000000000"],
218 ["uuid", "00000000-0000-0000-0000-001000000000"],
219 ["uuid", "00000000-0000-0000-0000-000000100000"],
220 ["uuid", "00000000-0000-0000-0000-000000000000"],
221 ["uuid", "00000000-0010-0000-0000-000000000000"],
222 ["uuid", "00100000-0000-0000-0000-000000000000"],
223 ["uuid", "00000000-0001-0000-0000-000000000000"],
224 ["uuid", "00000001-0000-0000-0000-000000000000"],
225 ["uuid", "00001000-0000-0000-0000-000000000000"]]']],
226 [[[["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"]]]])
228 OVSDB_CHECK_POSITIVE([real not acceptable integer JSON atom],
229 [[parse-atoms '["integer"]' '[0.5]' ]],
230 [syntax "0.5": syntax error: expected integer])
232 dnl <C0> is not allowed anywhere in a UTF-8 string.
233 dnl <ED A0 80> is a surrogate and not allowed in UTF-8.
234 OVSDB_CHECK_POSITIVE([no invalid UTF-8 sequences in strings],
235 [parse-atoms '[["string"]]' \
236 '@<:@"m4_esyscmd([printf "\300"])"@:>@' \
237 '@<:@"m4_esyscmd([printf "\355\240\200"])"@:>@' \
239 [constraint violation: "m4_esyscmd([printf "\300"])" is not a valid UTF-8 string: invalid UTF-8 sequence 0xc0
240 constraint violation: "m4_esyscmd([printf "\355\240\200"])" is not a valid UTF-8 string: invalid UTF-8 sequence 0xed 0xa0])
242 OVSDB_CHECK_NEGATIVE([real not acceptable integer string atom],
243 [[parse-atom-strings '["integer"]' '0.5' ]],
244 ["0.5" is not a valid integer])
246 OVSDB_CHECK_POSITIVE([string "true" not acceptable boolean JSON atom],
247 [[parse-atoms '["boolean"]' '["true"]' ]],
248 [syntax ""true"": syntax error: expected boolean])
250 OVSDB_CHECK_NEGATIVE([string "true" not acceptable boolean string atom],
251 [[parse-atom-strings '["boolean"]' '"true"' ]],
252 [""true"" is not a valid boolean (use "true" or "false")])
254 OVSDB_CHECK_POSITIVE([integer not acceptable string JSON atom],
255 [[parse-atoms '["string"]' '[1]']],
256 [syntax "1": syntax error: expected string])
258 OVSDB_CHECK_POSITIVE([uuid atom must be expressed as JSON array],
259 [[parse-atoms '["uuid"]' '["550e8400-e29b-41d4-a716-446655440000"]']],
260 [[syntax ""550e8400-e29b-41d4-a716-446655440000"": syntax error: expected ["uuid", <string>]]])
262 OVSDB_CHECK_NEGATIVE([empty string atom must be quoted],
263 [[parse-atom-strings '["string"]' '']],
264 [An empty string is not valid as input; use "" to represent the empty string])
266 OVSDB_CHECK_NEGATIVE([quotes must be balanced],
267 [parse-atom-strings '[["string"]]' '"asdf'],
268 ["asdf: missing quote at end of quoted string])
270 OVSDB_CHECK_NEGATIVE([uuids must be valid],
271 [parse-atom-strings '[["uuid"]]' '1234-5678'],
272 ["1234-5678" is not a valid UUID])
274 AT_BANNER([OVSDB -- atoms with enum constraints])
276 OVSDB_CHECK_POSITIVE([integer atom enum],
277 [[parse-atoms '[{"type": "integer", "enum": ["set", [1, 6, 8, 10]]}]' \
288 [[constraint violation: 0 is not one of the allowed values ([1, 6, 8, 10])
290 constraint violation: 2 is not one of the allowed values ([1, 6, 8, 10])
291 constraint violation: 3 is not one of the allowed values ([1, 6, 8, 10])
293 constraint violation: 7 is not one of the allowed values ([1, 6, 8, 10])
295 constraint violation: 9 is not one of the allowed values ([1, 6, 8, 10])
297 constraint violation: 11 is not one of the allowed values ([1, 6, 8, 10])]])
299 OVSDB_CHECK_POSITIVE([real atom enum],
300 [[parse-atoms '[{"type": "real", "enum": ["set", [-1.5, 1.5]]}]' \
308 [[constraint violation: -2 is not one of the allowed values ([-1.5, 1.5])
309 constraint violation: -1 is not one of the allowed values ([-1.5, 1.5])
311 constraint violation: 0 is not one of the allowed values ([-1.5, 1.5])
312 constraint violation: 1 is not one of the allowed values ([-1.5, 1.5])
314 constraint violation: 2 is not one of the allowed values ([-1.5, 1.5])]])
316 OVSDB_CHECK_POSITIVE([boolean atom enum],
317 [[parse-atoms '[{"type": "boolean", "enum": false}]' \
321 constraint violation: true is not one of the allowed values ([false])]])
323 OVSDB_CHECK_POSITIVE([string atom enum],
324 [[parse-atoms '[{"type": "string", "enum": ["set", ["abc", "def"]]}]' \
331 [[constraint violation: "" is not one of the allowed values ([abc, def])
332 constraint violation: ab is not one of the allowed values ([abc, def])
335 constraint violation: defg is not one of the allowed values ([abc, def])
336 constraint violation: DEF is not one of the allowed values ([abc, def])]])
338 OVSDB_CHECK_POSITIVE([uuid atom enum],
339 [[parse-atoms '[{"type": "uuid", "enum": ["set", [["uuid", "6d53a6dd-2da7-4924-9927-97f613812382"], ["uuid", "52cbc842-137a-4db5-804f-9f34106a0ba3"]]]}]' \
340 '["uuid", "6d53a6dd-2da7-4924-9927-97f613812382"]' \
341 '["uuid", "52cbc842-137a-4db5-804f-9f34106a0ba3"]' \
342 '["uuid", "dab2a6b2-6094-4f43-a7ef-4c0f0608f176"]']],
343 [[["uuid","6d53a6dd-2da7-4924-9927-97f613812382"]
344 ["uuid","52cbc842-137a-4db5-804f-9f34106a0ba3"]
345 constraint violation: dab2a6b2-6094-4f43-a7ef-4c0f0608f176 is not one of the allowed values ([52cbc842-137a-4db5-804f-9f34106a0ba3, 6d53a6dd-2da7-4924-9927-97f613812382])]])
347 AT_BANNER([OVSDB -- atoms with other constraints])
349 OVSDB_CHECK_POSITIVE([integers >= 5],
350 [[parse-atoms '[{"type": "integer", "minInteger": 5}]' \
356 [constraint violation: 0 is less than minimum allowed value 5
357 constraint violation: 4 is less than minimum allowed value 5
362 OVSDB_CHECK_POSITIVE([integers <= -1],
363 [[parse-atoms '[{"type": "integer", "maxInteger": -1}]' \
368 [constraint violation: 0 is greater than maximum allowed value -1
373 OVSDB_CHECK_POSITIVE([integers in range -10 to 10],
374 [[parse-atoms '[{"type": "integer", "minInteger": -10, "maxInteger": 10}]' \
384 [constraint violation: -20 is not in the valid range -10 to 10 (inclusive)
385 constraint violation: -11 is not in the valid range -10 to 10 (inclusive)
391 constraint violation: 11 is not in the valid range -10 to 10 (inclusive)
392 constraint violation: 123576 is not in the valid range -10 to 10 (inclusive)])
394 OVSDB_CHECK_POSITIVE([reals >= 5],
395 [[parse-atoms '[{"type": "real", "minReal": 5}]' \
401 [constraint violation: 0 is less than minimum allowed value 5
402 constraint violation: 4 is less than minimum allowed value 5
407 OVSDB_CHECK_POSITIVE([reals <= -1],
408 [[parse-atoms '[{"type": "real", "maxReal": -1}]' \
413 [constraint violation: 0 is greater than maximum allowed value -1
418 OVSDB_CHECK_POSITIVE([reals in range -10 to 10],
419 [[parse-atoms '[{"type": "real", "minReal": -10, "maxReal": 10}]' \
429 [constraint violation: -20 is not in the valid range -10 to 10 (inclusive)
430 constraint violation: -11 is not in the valid range -10 to 10 (inclusive)
436 constraint violation: 11 is not in the valid range -10 to 10 (inclusive)
437 constraint violation: 123576 is not in the valid range -10 to 10 (inclusive)])
439 OVSDB_CHECK_POSITIVE([strings at least 2 characters long],
440 [[parse-atoms '{"type": "string", "minLength": 2}' \
445 '["\ud834\udd1e"]']],
446 [[constraint violation: "" length 0 is less than minimum allowed length 2
447 constraint violation: "a" length 1 is less than minimum allowed length 2
450 constraint violation: "𝄞" length 1 is less than minimum allowed length 2]])
452 OVSDB_CHECK_POSITIVE([strings no more than 2 characters long],
453 [[parse-atoms '{"type": "string", "maxLength": 2}' \
458 '["\ud834\udd1e"]']],
462 constraint violation: "abc" length 3 is greater than maximum allowed length 2
465 AT_BANNER([OSVDB -- simple data])
467 OVSDB_CHECK_POSITIVE([integer JSON datum],
468 [[parse-data '["integer"]' '[0]' '["set",[1]]' '[-1]']],
473 OVSDB_CHECK_POSITIVE([integer string datum],
474 [[parse-data-strings -- '["integer"]' '0' '1' '-1' '+1']],
480 OVSDB_CHECK_POSITIVE([real JSON datum],
481 [[parse-data '["real"]' '[0]' '["set",[1.0]]' '[-1.25]']],
486 OVSDB_CHECK_POSITIVE([real string datum],
487 [[parse-data-strings -- '["real"]' '0' '1.0' '-1.25']],
492 OVSDB_CHECK_POSITIVE([boolean JSON datum],
493 [[parse-data '["boolean"]' '["set", [true]]' '[false]' ]],
497 OVSDB_CHECK_POSITIVE([boolean string datum],
498 [[parse-data-strings '["boolean"]' 'true' 'false' ]],
502 OVSDB_CHECK_POSITIVE([string JSON datum],
503 [[parse-data '["string"]' '["set",[""]]' '["true"]' '["\"\\\/\b\f\n\r\t"]']],
508 OVSDB_CHECK_POSITIVE([string string datum],
509 [[parse-data-strings '["string"]' '"x"' '""' '"true"' '"\"\\\/\b\f\n\r\t"']],
515 AT_BANNER([OVSDB -- set data])
517 OVSDB_CHECK_POSITIVE([JSON optional boolean],
518 [[parse-data '{"key": "boolean", "min": 0}' \
527 OVSDB_CHECK_POSITIVE([string optional boolean],
528 [[parse-data-strings '{"key": "boolean", "min": 0}' \
537 OVSDB_CHECK_POSITIVE([JSON set of 0 or more integers],
538 [[parse-data '{"key": "integer", "min": 0, "max": "unlimited"}' \
542 '["set", [0, 1, 2]]' \
543 '["set", [0, 1, 2, 3, 4, 5]]' \
544 '["set", [0, 1, 2, 3, 4, 5, 6, 7, 8]]' \
545 '["set", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]']],
550 ["set",[0,1,2,3,4,5]]
551 ["set",[0,1,2,3,4,5,6,7,8]]
552 ["set",[0,1,2,3,4,5,6,7,8,9,10]]]])
554 OVSDB_CHECK_POSITIVE([string set of 0 or more integers],
555 [[parse-data-strings '{"key": "integer", "min": 0, "max": "unlimited"}' \
559 '[0, 1,2, 3, 4, 5]' \
560 '0, 1,2, 3,4, 5, 6, 7, 8' \
561 '[0, 1, 2, 3, 4,5, 6,7, 8, 9, 10]']],
566 [0, 1, 2, 3, 4, 5, 6, 7, 8]
567 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]])
569 OVSDB_CHECK_POSITIVE([JSON set of 1 to 3 uuids],
570 [[parse-data '{"key": "uuid", "min": 1, "max": 3}' \
571 '["set", [["uuid", "550e8400-e29b-41d4-a716-446655440000"]]]' \
572 '["uuid", "b5078be0-7664-4299-b836-8bcc03ef941f"]' \
573 '["set", [["uuid", "c5051240-30ff-43ed-b4b9-93cf3f050813"],
574 ["uuid", "90558331-09af-4d2f-a572-509cad2e9088"],
575 ["uuid", "550e8400-e29b-41d4-a716-446655440000"]]]']],
576 [[["uuid","550e8400-e29b-41d4-a716-446655440000"]
577 ["uuid","b5078be0-7664-4299-b836-8bcc03ef941f"]
578 ["set",[["uuid","550e8400-e29b-41d4-a716-446655440000"],["uuid","90558331-09af-4d2f-a572-509cad2e9088"],["uuid","c5051240-30ff-43ed-b4b9-93cf3f050813"]]]]])
580 OVSDB_CHECK_POSITIVE([string set of 1 to 3 uuids],
581 [[parse-data-strings '{"key": "uuid", "min": 1, "max": 3}' \
582 '[550e8400-e29b-41d4-a716-446655440000]' \
583 '[c5051240-30ff-43ed-b4b9-93cf3f050813,
584 90558331-09af-4d2f-a572-509cad2e9088,
585 550e8400-e29b-41d4-a716-446655440000]']],
586 [[[550e8400-e29b-41d4-a716-446655440000]
587 [550e8400-e29b-41d4-a716-446655440000, 90558331-09af-4d2f-a572-509cad2e9088, c5051240-30ff-43ed-b4b9-93cf3f050813]]])
589 OVSDB_CHECK_POSITIVE([JSON set of 0 to 3 strings],
590 [[parse-data '{"key": "string", "min": 0, "max": 3}' \
592 '["a longer string"]' \
593 '["set", ["a relatively long string"]]' \
594 '["set", ["short string", "a relatively long string"]]' \
595 '["set", ["zzz", "short string", "a relatively long string"]]']],
598 "a relatively long string"
599 ["set",["a relatively long string","short string"]]
600 ["set",["a relatively long string","short string","zzz"]]]])
602 OVSDB_CHECK_POSITIVE([string set of 0 to 3 strings],
603 [[parse-data-strings '{"key": "string", "min": 0, "max": 3}' \
605 '"a relatively long string"' \
606 '["short string", "a relatively long string"]' \
607 '"zzz","short string","a relatively long string"']],
609 ["a relatively long string"]
610 ["a relatively long string", "short string"]
611 ["a relatively long string", "short string", zzz]]])
613 OVSDB_CHECK_NEGATIVE([duplicate boolean not allowed in JSON set],
614 [[parse-data '{"key": "boolean", "max": 5}' '["set", [true, true]]']],
615 [ovsdb error: set contains duplicate])
617 OVSDB_CHECK_NEGATIVE([duplicate boolean not allowed in string set],
618 [[parse-data-strings '{"key": "boolean", "max": 5}' 'true, true']],
619 [set contains duplicate value])
621 OVSDB_CHECK_NEGATIVE([duplicate integer not allowed in JSON set],
622 [[parse-data '{"key": "integer", "max": 5}' '["set", [1, 2, 3, 1]]']],
623 [ovsdb error: set contains duplicate])
625 OVSDB_CHECK_NEGATIVE([duplicate integer not allowed in string set],
626 [[parse-data-strings '{"key": "integer", "max": 5}' '[1, 2, 3, 1]']],
627 [set contains duplicate value])
629 OVSDB_CHECK_NEGATIVE([duplicate real not allowed in JSON set],
630 [[parse-data '{"key": "real", "max": 5}' '["set", [0.0, -0.0]]']],
631 [ovsdb error: set contains duplicate])
633 OVSDB_CHECK_NEGATIVE([duplicate real not allowed in string set],
634 [[parse-data-strings '{"key": "real", "max": 5}' '0.0, -0.0']],
635 [set contains duplicate value])
637 OVSDB_CHECK_NEGATIVE([duplicate string not allowed in JSON set],
638 [[parse-data '{"key": "string", "max": 5}' '["set", ["asdf", "ASDF", "asdf"]]']],
639 [ovsdb error: set contains duplicate])
641 OVSDB_CHECK_NEGATIVE([duplicate string not allowed in string set],
642 [[parse-data-strings '{"key": "string", "max": 5}' 'asdf, ASDF, "asdf"']],
643 [set contains duplicate value])
645 OVSDB_CHECK_NEGATIVE([duplicate uuid not allowed in JSON set],
646 [[parse-data '{"key": "uuid", "max": 5}' \
647 '["set", [["uuid", "7ef21525-0088-4a28-a418-5518413e43ea"],
648 ["uuid", "355ad037-f1da-40aa-b47c-ff9c7e8c6a38"],
649 ["uuid", "7ef21525-0088-4a28-a418-5518413e43ea"]]]']],
650 [ovsdb error: set contains duplicate])
652 OVSDB_CHECK_NEGATIVE([duplicate uuid not allowed in string set],
653 [[parse-data-strings '{"key": "uuid", "max": 5}' \
654 '7ef21525-0088-4a28-a418-5518413e43ea,
655 355ad037-f1da-40aa-b47c-ff9c7e8c6a38,
656 7ef21525-0088-4a28-a418-5518413e43ea']],
657 [set contains duplicate value])
659 AT_BANNER([OVSDB -- map data])
661 OVSDB_CHECK_POSITIVE([JSON map of 1 integer to boolean],
662 [[parse-data '{"key": "integer", "value": "boolean"}' \
663 '["map", [[1, true]]]']],
664 [[["map",[[1,true]]]]])
666 OVSDB_CHECK_POSITIVE([string map of 1 integer to boolean],
667 [[parse-data-strings '{"key": "integer", "value": "boolean"}' \
671 OVSDB_CHECK_POSITIVE([JSON map of at least 1 integer to boolean],
672 [[parse-data '{"key": "integer", "value": "boolean", "max": "unlimited"}' \
673 '["map", [[1, true]]]' \
674 '["map", [[0, true], [1, false], [2, true], [3, true], [4, true]]]' \
675 '["map", [[3, false], [0, true], [4, false]]]']],
677 ["map",[[0,true],[1,false],[2,true],[3,true],[4,true]]]
678 ["map",[[0,true],[3,false],[4,false]]]]])
680 OVSDB_CHECK_POSITIVE([string map of at least 1 integer to boolean],
681 [[parse-data-strings '{"key": "integer", "value": "boolean", "max": "unlimited"}' \
683 '0=true 1=false 2=true, 3=true 4=true,' \
684 '3=false,0=true ,4=false']],
686 {0=true, 1=false, 2=true, 3=true, 4=true}
687 {0=true, 3=false, 4=false}]])
689 OVSDB_CHECK_POSITIVE([JSON map of 1 boolean to integer],
690 [[parse-data '{"key": "boolean", "value": "integer"}' \
691 '["map", [[true, 1]]]']],
692 [[["map",[[true,1]]]]])
694 OVSDB_CHECK_POSITIVE([string map of 1 boolean to integer],
695 [[parse-data-strings '{"key": "boolean", "value": "integer"}' \
699 OVSDB_CHECK_POSITIVE([JSON map of 1 uuid to real],
700 [[parse-data '{"key": "uuid", "value": "real", "min": 1, "max": 5}' \
701 '["map", [[["uuid", "cad8542b-6ee1-486b-971b-7dcbf6e14979"], 1.0],
702 [["uuid", "6b94b968-2702-4f64-9457-314a34d69b8c"], 2.0],
703 [["uuid", "d2c4a168-24de-47eb-a8a3-c1abfc814979"], 3.0],
704 [["uuid", "25bfa475-d072-4f60-8be1-00f48643e9cb"], 4.0],
705 [["uuid", "1c92b8ca-d5e4-4628-a85d-1dc2d099a99a"], 5.0]]]']],
706 [[["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]]]]])
708 OVSDB_CHECK_POSITIVE([string map of 1 uuid to real],
709 [[parse-data-strings '{"key": "uuid", "value": "real", "min": 1, "max": 5}' \
710 'cad8542b-6ee1-486b-971b-7dcbf6e14979=1.0,
711 6b94b968-2702-4f64-9457-314a34d69b8c=2.0,
712 d2c4a168-24de-47eb-a8a3-c1abfc814979=3.0,
713 25bfa475-d072-4f60-8be1-00f48643e9cb=4.0,
714 1c92b8ca-d5e4-4628-a85d-1dc2d099a99a=5.0']],
715 [[{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}]])
717 OVSDB_CHECK_POSITIVE([JSON map of 10 string to string],
718 [[parse-data '{"key": "string", "value": "string", "min": 1, "max": 10}' \
719 '["map", [["2 gills", "1 chopin"],
720 ["2 chopins", "1 pint"],
721 ["2 pints", "1 quart"],
722 ["2 quarts", "1 pottle"],
723 ["2 pottles", "1 gallon"],
724 ["2 gallons", "1 peck"],
725 ["2 pecks", "1 demibushel"],
726 ["2 demibushel", "1 firkin"],
727 ["2 firkins", "1 kilderkin"],
728 ["2 kilderkins", "1 barrel"]]]']],
729 [[["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"]]]]])
731 OVSDB_CHECK_POSITIVE([string map of 10 string to string],
732 [[parse-data-strings '{"key": "string", "value": "string", "min": 1, "max": 10}' \
733 '{"2 gills"="1 chopin",
734 "2 chopins"= "1 pint",
735 "2 pints"= "1 quart",
736 "2 quarts"= "1 pottle",
737 "2 pottles"= "1 gallon",
738 "2 gallons"= "1 peck",
739 "2 pecks"= "1 demibushel",
740 "2 demibushel"= "1 firkin",
741 "2 firkins"= "1 kilderkin",
742 "2 kilderkins"= "1 barrel"}']],
743 [[{"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"}]])
745 OVSDB_CHECK_NEGATIVE([duplicate integer key not allowed in JSON map],
746 [[parse-data '{"key": "integer", "value": "boolean", "max": 5}' \
747 '["map", [[1, true], [2, false], [1, false]]]']],
748 [ovsdb error: map contains duplicate key])
750 OVSDB_CHECK_NEGATIVE([duplicate integer key not allowed in string map],
751 [[parse-data-strings '{"key": "integer", "value": "boolean", "max": 5}' \
752 '1=true 2=false 1=false']],
753 [map contains duplicate key])