]> git.proxmox.com Git - ovs.git/blame - tests/ovsdb-data.at
flow: Convert tunnel IDs to host byte order for formatting.
[ovs.git] / tests / ovsdb-data.at
CommitLineData
958ac03a
BP
1AT_BANNER([OVSDB -- default values])
2
99155935 3OVSDB_CHECK_POSITIVE_CPY([default atoms],
958ac03a
BP
4 [default-atoms],
5 [[integer: OK
6real: OK
7boolean: OK
8string: OK
9uuid: OK]])
10
99155935 11OVSDB_CHECK_POSITIVE_CPY([default data],
958ac03a
BP
12 [default-data],
13 [[key integer, value void, n_min 0: OK
14key integer, value integer, n_min 0: OK
15key integer, value real, n_min 0: OK
16key integer, value boolean, n_min 0: OK
17key integer, value string, n_min 0: OK
18key integer, value uuid, n_min 0: OK
19key real, value void, n_min 0: OK
20key real, value integer, n_min 0: OK
21key real, value real, n_min 0: OK
22key real, value boolean, n_min 0: OK
23key real, value string, n_min 0: OK
24key real, value uuid, n_min 0: OK
25key boolean, value void, n_min 0: OK
26key boolean, value integer, n_min 0: OK
27key boolean, value real, n_min 0: OK
28key boolean, value boolean, n_min 0: OK
29key boolean, value string, n_min 0: OK
30key boolean, value uuid, n_min 0: OK
31key string, value void, n_min 0: OK
32key string, value integer, n_min 0: OK
33key string, value real, n_min 0: OK
34key string, value boolean, n_min 0: OK
35key string, value string, n_min 0: OK
36key string, value uuid, n_min 0: OK
37key uuid, value void, n_min 0: OK
38key uuid, value integer, n_min 0: OK
39key uuid, value real, n_min 0: OK
40key uuid, value boolean, n_min 0: OK
41key uuid, value string, n_min 0: OK
42key uuid, value uuid, n_min 0: OK
43key integer, value void, n_min 1: OK
44key integer, value integer, n_min 1: OK
45key integer, value real, n_min 1: OK
46key integer, value boolean, n_min 1: OK
47key integer, value string, n_min 1: OK
48key integer, value uuid, n_min 1: OK
49key real, value void, n_min 1: OK
50key real, value integer, n_min 1: OK
51key real, value real, n_min 1: OK
52key real, value boolean, n_min 1: OK
53key real, value string, n_min 1: OK
54key real, value uuid, n_min 1: OK
55key boolean, value void, n_min 1: OK
56key boolean, value integer, n_min 1: OK
57key boolean, value real, n_min 1: OK
58key boolean, value boolean, n_min 1: OK
59key boolean, value string, n_min 1: OK
60key boolean, value uuid, n_min 1: OK
61key string, value void, n_min 1: OK
62key string, value integer, n_min 1: OK
63key string, value real, n_min 1: OK
64key string, value boolean, n_min 1: OK
65key string, value string, n_min 1: OK
66key string, value uuid, n_min 1: OK
67key uuid, value void, n_min 1: OK
68key uuid, value integer, n_min 1: OK
69key uuid, value real, n_min 1: OK
70key uuid, value boolean, n_min 1: OK
71key uuid, value string, n_min 1: OK
72key uuid, value uuid, n_min 1: OK]])
73
bd76d25d 74AT_BANNER([OVSDB -- atoms without constraints])
f85f8ebb 75
99155935 76OVSDB_CHECK_POSITIVE_CPY([integer atom from JSON],
f85f8ebb
BP
77 [[parse-atoms '["integer"]' \
78 '[0]' \
79 '[-1]' \
80 '[1e3]' \
81 '[9223372036854775807]' \
82 '[-9223372036854775808]' ]],
83 [0
84-1
851000
869223372036854775807
87-9223372036854775808])
88
5c414a2e
BP
89OVSDB_CHECK_POSITIVE([integer atom from string],
90 [[parse-atom-strings -- '["integer"]' \
91 '0' \
92 '-1' \
93 '+1000' \
94 '9223372036854775807' \
95 '-9223372036854775808' ]],
96 [0
97-1
981000
999223372036854775807
100-9223372036854775808])
101
99155935 102OVSDB_CHECK_POSITIVE_CPY([real atom from JSON],
f85f8ebb
BP
103 [[parse-atoms '["real"]' \
104 '[0]' \
105 '[0.0]' \
106 '[-0.0]' \
107 '[-1.25]' \
108 '[1e3]' \
109 '[1e37]' \
110 '[0.00390625]' ]],
111 [0
1120
1130
114-1.25
1151000
1161e+37
1170.00390625])
118
5c414a2e
BP
119OVSDB_CHECK_POSITIVE([real atom from string],
120 [[parse-atom-strings -- '["real"]' \
121 '0' \
122 '0.0' \
123 '-0.0' \
124 '-1.25' \
125 '1e3' \
126 '1e37' \
127 '0.00390625' ]],
128 [0
1290
1300
131-1.25
1321000
1331e+37
1340.00390625])
135
99155935 136OVSDB_CHECK_POSITIVE_CPY([boolean atom from JSON],
f85f8ebb
BP
137 [[parse-atoms '["boolean"]' '[true]' '[false]' ]],
138 [true
139false])
140
5c414a2e
BP
141OVSDB_CHECK_POSITIVE([boolean atom from string],
142 [[parse-atom-strings '["boolean"]' 'true' 'false' ]],
143 [true
144false])
145
99155935 146OVSDB_CHECK_POSITIVE_CPY([string atom from JSON],
f85f8ebb
BP
147 [[parse-atoms '["string"]' '[""]' '["true"]' '["\"\\\/\b\f\n\r\t"]']],
148 [""
149"true"
150"\"\\/\b\f\n\r\t"])
151
5c414a2e
BP
152OVSDB_CHECK_POSITIVE([string atom from string],
153 [[parse-atom-strings '["string"]' \
154 'unquoted' \
155 '"quoted-string"' \
156 '"needs quotes"' \
157 '""' \
158 '"true"' \
159 '"\"\\\/\b\f\n\r\t"']],
160 [unquoted
161quoted-string
162"needs quotes"
163""
164"true"
165"\"\\/\b\f\n\r\t"])
166
99155935 167OVSDB_CHECK_POSITIVE_CPY([uuid atom from JSON],
f85f8ebb
BP
168 [[parse-atoms '["uuid"]' '["uuid", "550e8400-e29b-41d4-a716-446655440000"]']],
169 [[["uuid","550e8400-e29b-41d4-a716-446655440000"]]])
170
5c414a2e
BP
171OVSDB_CHECK_POSITIVE([uuid atom from string],
172 [[parse-atom-strings '["uuid"]' '550e8400-e29b-41d4-a716-446655440000']],
173 [550e8400-e29b-41d4-a716-446655440000])
174
99155935 175OVSDB_CHECK_POSITIVE_CPY([integer atom sorting],
f85f8ebb
BP
176 [[sort-atoms '["integer"]' '[55,0,-1,2,1]']],
177 [[[-1,0,1,2,55]]])
178
99155935 179OVSDB_CHECK_POSITIVE_CPY([real atom sorting],
f85f8ebb
BP
180 [[sort-atoms '["real"]' '[1.25,1.23,0.0,-0.0,-1e99]']],
181 [[[-1e+99,0,0,1.23,1.25]]])
182
99155935 183OVSDB_CHECK_POSITIVE_CPY([boolean atom sorting],
f85f8ebb
BP
184 [[sort-atoms '["boolean"]' '[true,false,true,false,false]']],
185 [[[false,false,false,true,true]]])
186
99155935 187OVSDB_CHECK_POSITIVE_CPY([string atom sorting],
f85f8ebb
BP
188 [[sort-atoms '["string"]' '["abd","abc","\b","xxx"]']],
189 [[["\b","abc","abd","xxx"]]])
190
99155935 191OVSDB_CHECK_POSITIVE_CPY([uuid atom sorting],
f85f8ebb
BP
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"]]]])
227
99155935 228OVSDB_CHECK_POSITIVE_CPY([real not acceptable integer JSON atom],
f85f8ebb 229 [[parse-atoms '["integer"]' '[0.5]' ]],
bd76d25d
BP
230 [syntax "0.5": syntax error: expected integer])
231
232dnl <C0> is not allowed anywhere in a UTF-8 string.
233dnl <ED A0 80> is a surrogate and not allowed in UTF-8.
99155935 234OVSDB_CHECK_POSITIVE_CPY([no invalid UTF-8 sequences in strings],
bd76d25d 235 [parse-atoms '[["string"]]' \
a238d75e
BP
236 '@<:@"m4_esyscmd([printf "\300"])"@:>@' \
237 '@<:@"m4_esyscmd([printf "\355\240\200"])"@:>@' \
bd76d25d 238],
a238d75e 239 [constraint violation: "m4_esyscmd([printf "\300"])" is not a valid UTF-8 string: invalid UTF-8 sequence 0xc0
99155935
BP
240constraint violation: "m4_esyscmd([printf "\355\240\200"])" is not a valid UTF-8 string: invalid UTF-8 sequence 0xed 0xa0],
241 [], [], [xfail])
f85f8ebb 242
5c414a2e
BP
243OVSDB_CHECK_NEGATIVE([real not acceptable integer string atom],
244 [[parse-atom-strings '["integer"]' '0.5' ]],
245 ["0.5" is not a valid integer])
246
99155935 247OVSDB_CHECK_POSITIVE_CPY([string "true" not acceptable boolean JSON atom],
f85f8ebb 248 [[parse-atoms '["boolean"]' '["true"]' ]],
bd76d25d 249 [syntax ""true"": syntax error: expected boolean])
f85f8ebb 250
5c414a2e
BP
251OVSDB_CHECK_NEGATIVE([string "true" not acceptable boolean string atom],
252 [[parse-atom-strings '["boolean"]' '"true"' ]],
253 [""true"" is not a valid boolean (use "true" or "false")])
254
99155935 255OVSDB_CHECK_POSITIVE_CPY([integer not acceptable string JSON atom],
f85f8ebb 256 [[parse-atoms '["string"]' '[1]']],
bd76d25d 257 [syntax "1": syntax error: expected string])
f85f8ebb 258
99155935 259OVSDB_CHECK_POSITIVE_CPY([uuid atom must be expressed as JSON array],
f85f8ebb 260 [[parse-atoms '["uuid"]' '["550e8400-e29b-41d4-a716-446655440000"]']],
bd76d25d 261 [[syntax ""550e8400-e29b-41d4-a716-446655440000"": syntax error: expected ["uuid", <string>]]])
fdba6728
BP
262
263OVSDB_CHECK_POSITIVE_CPY([named-uuid requires symbol table],
264 [parse-atoms '[["uuid"]]' '[["named-uuid", "x"]]'],
265 [[syntax "["named-uuid","x"]": syntax error: expected ["uuid", <string>]]])
f85f8ebb 266
5c414a2e
BP
267OVSDB_CHECK_NEGATIVE([empty string atom must be quoted],
268 [[parse-atom-strings '["string"]' '']],
269 [An empty string is not valid as input; use "" to represent the empty string])
270
271OVSDB_CHECK_NEGATIVE([quotes must be balanced],
272 [parse-atom-strings '[["string"]]' '"asdf'],
273 ["asdf: missing quote at end of quoted string])
274
275OVSDB_CHECK_NEGATIVE([uuids must be valid],
276 [parse-atom-strings '[["uuid"]]' '1234-5678'],
277 ["1234-5678" is not a valid UUID])
bd76d25d 278\f
bfc96d9b
BP
279AT_BANNER([OVSDB -- atoms with enum constraints])
280
99155935 281OVSDB_CHECK_POSITIVE_CPY([integer atom enum],
bfc96d9b
BP
282 [[parse-atoms '[{"type": "integer", "enum": ["set", [1, 6, 8, 10]]}]' \
283 '[0]' \
284 '[1]' \
285 '[2]' \
286 '[3]' \
287 '[6]' \
288 '[7]' \
289 '[8]' \
290 '[9]' \
291 '[10]' \
292 '[11]']],
293 [[constraint violation: 0 is not one of the allowed values ([1, 6, 8, 10])
2941
295constraint violation: 2 is not one of the allowed values ([1, 6, 8, 10])
296constraint violation: 3 is not one of the allowed values ([1, 6, 8, 10])
2976
298constraint violation: 7 is not one of the allowed values ([1, 6, 8, 10])
2998
300constraint violation: 9 is not one of the allowed values ([1, 6, 8, 10])
30110
302constraint violation: 11 is not one of the allowed values ([1, 6, 8, 10])]])
303
99155935 304OVSDB_CHECK_POSITIVE_CPY([real atom enum],
bfc96d9b
BP
305 [[parse-atoms '[{"type": "real", "enum": ["set", [-1.5, 1.5]]}]' \
306 '[-2]' \
307 '[-1]' \
308 '[-1.5]' \
309 '[0]' \
310 '[1]' \
311 '[1.5]' \
312 '[2]']],
313 [[constraint violation: -2 is not one of the allowed values ([-1.5, 1.5])
314constraint violation: -1 is not one of the allowed values ([-1.5, 1.5])
315-1.5
316constraint violation: 0 is not one of the allowed values ([-1.5, 1.5])
317constraint violation: 1 is not one of the allowed values ([-1.5, 1.5])
3181.5
319constraint violation: 2 is not one of the allowed values ([-1.5, 1.5])]])
320
99155935 321OVSDB_CHECK_POSITIVE_CPY([boolean atom enum],
bfc96d9b
BP
322 [[parse-atoms '[{"type": "boolean", "enum": false}]' \
323 '[false]' \
324 '[true]']],
325 [[false
326constraint violation: true is not one of the allowed values ([false])]])
327
99155935 328OVSDB_CHECK_POSITIVE_CPY([string atom enum],
bfc96d9b
BP
329 [[parse-atoms '[{"type": "string", "enum": ["set", ["abc", "def"]]}]' \
330 '[""]' \
331 '["ab"]' \
332 '["abc"]' \
333 '["def"]' \
334 '["defg"]' \
335 '["DEF"]']],
336 [[constraint violation: "" is not one of the allowed values ([abc, def])
337constraint violation: ab is not one of the allowed values ([abc, def])
338"abc"
339"def"
340constraint violation: defg is not one of the allowed values ([abc, def])
341constraint violation: DEF is not one of the allowed values ([abc, def])]])
342
99155935 343OVSDB_CHECK_POSITIVE_CPY([uuid atom enum],
bfc96d9b
BP
344 [[parse-atoms '[{"type": "uuid", "enum": ["set", [["uuid", "6d53a6dd-2da7-4924-9927-97f613812382"], ["uuid", "52cbc842-137a-4db5-804f-9f34106a0ba3"]]]}]' \
345 '["uuid", "6d53a6dd-2da7-4924-9927-97f613812382"]' \
346 '["uuid", "52cbc842-137a-4db5-804f-9f34106a0ba3"]' \
347 '["uuid", "dab2a6b2-6094-4f43-a7ef-4c0f0608f176"]']],
348 [[["uuid","6d53a6dd-2da7-4924-9927-97f613812382"]
349["uuid","52cbc842-137a-4db5-804f-9f34106a0ba3"]
350constraint violation: dab2a6b2-6094-4f43-a7ef-4c0f0608f176 is not one of the allowed values ([52cbc842-137a-4db5-804f-9f34106a0ba3, 6d53a6dd-2da7-4924-9927-97f613812382])]])
351\f
352AT_BANNER([OVSDB -- atoms with other constraints])
bd76d25d 353
99155935 354OVSDB_CHECK_POSITIVE_CPY([integers >= 5],
bd76d25d
BP
355 [[parse-atoms '[{"type": "integer", "minInteger": 5}]' \
356 '[0]' \
357 '[4]' \
358 '[5]' \
359 '[6]' \
360 '[12345]']],
361 [constraint violation: 0 is less than minimum allowed value 5
362constraint violation: 4 is less than minimum allowed value 5
3635
3646
36512345])
366
99155935 367OVSDB_CHECK_POSITIVE_CPY([integers <= -1],
bd76d25d
BP
368 [[parse-atoms '[{"type": "integer", "maxInteger": -1}]' \
369 '[0]' \
370 '[-1]' \
371 '[-2]' \
372 '[-123]']],
373 [constraint violation: 0 is greater than maximum allowed value -1
374-1
375-2
376-123])
377
99155935 378OVSDB_CHECK_POSITIVE_CPY([integers in range -10 to 10],
bd76d25d
BP
379 [[parse-atoms '[{"type": "integer", "minInteger": -10, "maxInteger": 10}]' \
380 '[-20]' \
381 '[-11]' \
382 '[-10]' \
383 '[-9]' \
384 '[1]' \
385 '[9]' \
386 '[10]' \
387 '[11]' \
388 '[123576]']],
389 [constraint violation: -20 is not in the valid range -10 to 10 (inclusive)
390constraint violation: -11 is not in the valid range -10 to 10 (inclusive)
391-10
392-9
3931
3949
39510
396constraint violation: 11 is not in the valid range -10 to 10 (inclusive)
397constraint violation: 123576 is not in the valid range -10 to 10 (inclusive)])
398
99155935 399OVSDB_CHECK_POSITIVE_CPY([reals >= 5],
bd76d25d
BP
400 [[parse-atoms '[{"type": "real", "minReal": 5}]' \
401 '[0]' \
402 '[4]' \
403 '[5]' \
404 '[6]' \
405 '[12345]']],
406 [constraint violation: 0 is less than minimum allowed value 5
407constraint violation: 4 is less than minimum allowed value 5
4085
4096
41012345])
411
99155935 412OVSDB_CHECK_POSITIVE_CPY([reals <= -1],
bd76d25d
BP
413 [[parse-atoms '[{"type": "real", "maxReal": -1}]' \
414 '[0]' \
415 '[-1]' \
416 '[-2]' \
417 '[-123]']],
418 [constraint violation: 0 is greater than maximum allowed value -1
419-1
420-2
421-123])
422
99155935 423OVSDB_CHECK_POSITIVE_CPY([reals in range -10 to 10],
bd76d25d
BP
424 [[parse-atoms '[{"type": "real", "minReal": -10, "maxReal": 10}]' \
425 '[-20]' \
426 '[-11]' \
427 '[-10]' \
428 '[-9]' \
429 '[1]' \
430 '[9]' \
431 '[10]' \
432 '[11]' \
433 '[123576]']],
434 [constraint violation: -20 is not in the valid range -10 to 10 (inclusive)
435constraint violation: -11 is not in the valid range -10 to 10 (inclusive)
436-10
437-9
4381
4399
44010
441constraint violation: 11 is not in the valid range -10 to 10 (inclusive)
442constraint violation: 123576 is not in the valid range -10 to 10 (inclusive)])
443
99155935 444OVSDB_CHECK_POSITIVE_CPY([strings at least 2 characters long],
bd76d25d
BP
445 [[parse-atoms '{"type": "string", "minLength": 2}' \
446 '[""]' \
447 '["a"]' \
448 '["ab"]' \
449 '["abc"]' \
450 '["\ud834\udd1e"]']],
451 [[constraint violation: "" length 0 is less than minimum allowed length 2
452constraint violation: "a" length 1 is less than minimum allowed length 2
453"ab"
454"abc"
99155935
BP
455constraint violation: "𝄞" length 1 is less than minimum allowed length 2]],
456 [], [], [xfail])
bd76d25d 457
99155935 458OVSDB_CHECK_POSITIVE_CPY([strings no more than 2 characters long],
bd76d25d
BP
459 [[parse-atoms '{"type": "string", "maxLength": 2}' \
460 '[""]' \
461 '["a"]' \
462 '["ab"]' \
463 '["abc"]' \
65683353 464 '["de"]']],
bd76d25d
BP
465 [[""
466"a"
467"ab"
468constraint violation: "abc" length 3 is greater than maximum allowed length 2
65683353 469"de"]])
5c414a2e 470
f85f8ebb
BP
471AT_BANNER([OSVDB -- simple data])
472
99155935 473OVSDB_CHECK_POSITIVE_CPY([integer JSON datum],
ae8f13e2 474 [[parse-data '["integer"]' '[0]' '["set",[1]]' '[-1]']],
f85f8ebb
BP
475 [0
4761
477-1])
478
5c414a2e
BP
479OVSDB_CHECK_POSITIVE([integer string datum],
480 [[parse-data-strings -- '["integer"]' '0' '1' '-1' '+1']],
481 [0
4821
483-1
4841])
485
99155935 486OVSDB_CHECK_POSITIVE_CPY([real JSON datum],
ae8f13e2 487 [[parse-data '["real"]' '[0]' '["set",[1.0]]' '[-1.25]']],
f85f8ebb
BP
488 [0
4891
490-1.25])
491
5c414a2e
BP
492OVSDB_CHECK_POSITIVE([real string datum],
493 [[parse-data-strings -- '["real"]' '0' '1.0' '-1.25']],
494 [0
4951
496-1.25])
497
99155935 498OVSDB_CHECK_POSITIVE_CPY([boolean JSON datum],
ae8f13e2 499 [[parse-data '["boolean"]' '["set", [true]]' '[false]' ]],
f85f8ebb
BP
500 [true
501false])
502
5c414a2e
BP
503OVSDB_CHECK_POSITIVE([boolean string datum],
504 [[parse-data-strings '["boolean"]' 'true' 'false' ]],
505 [true
506false])
507
99155935 508OVSDB_CHECK_POSITIVE_CPY([string JSON datum],
ae8f13e2 509 [[parse-data '["string"]' '["set",[""]]' '["true"]' '["\"\\\/\b\f\n\r\t"]']],
f85f8ebb
BP
510 [""
511"true"
512"\"\\/\b\f\n\r\t"])
513
5c414a2e
BP
514OVSDB_CHECK_POSITIVE([string string datum],
515 [[parse-data-strings '["string"]' '"x"' '""' '"true"' '"\"\\\/\b\f\n\r\t"']],
516 [x
517""
518"true"
519"\"\\/\b\f\n\r\t"])
bd76d25d 520\f
f85f8ebb
BP
521AT_BANNER([OVSDB -- set data])
522
99155935 523OVSDB_CHECK_POSITIVE_CPY([JSON optional boolean],
f85f8ebb 524 [[parse-data '{"key": "boolean", "min": 0}' \
ae8f13e2 525 '[true]' \
f85f8ebb
BP
526 '["set", [false]]' \
527 '["set", []]']],
ae8f13e2
BP
528 [[true
529false
f85f8ebb
BP
530["set",[]]]],
531 [set])
532
5c414a2e
BP
533OVSDB_CHECK_POSITIVE([string optional boolean],
534 [[parse-data-strings '{"key": "boolean", "min": 0}' \
535 'true' \
536 'false' \
537 '[]']],
538 [[true
539false
540[]]],
541 [set])
542
99155935 543OVSDB_CHECK_POSITIVE_CPY([JSON set of 0 or more integers],
f85f8ebb
BP
544 [[parse-data '{"key": "integer", "min": 0, "max": "unlimited"}' \
545 '["set", [0]]' \
ae8f13e2 546 '[1]' \
f85f8ebb
BP
547 '["set", [0, 1]]' \
548 '["set", [0, 1, 2]]' \
549 '["set", [0, 1, 2, 3, 4, 5]]' \
550 '["set", [0, 1, 2, 3, 4, 5, 6, 7, 8]]' \
551 '["set", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]']],
ae8f13e2
BP
552 [[0
5531
f85f8ebb
BP
554["set",[0,1]]
555["set",[0,1,2]]
556["set",[0,1,2,3,4,5]]
557["set",[0,1,2,3,4,5,6,7,8]]
558["set",[0,1,2,3,4,5,6,7,8,9,10]]]])
559
5c414a2e
BP
560OVSDB_CHECK_POSITIVE([string set of 0 or more integers],
561 [[parse-data-strings '{"key": "integer", "min": 0, "max": "unlimited"}' \
562 '0' \
563 '0,1' \
564 '0, 1, 2' \
565 '[0, 1,2, 3, 4, 5]' \
566 '0, 1,2, 3,4, 5, 6, 7, 8' \
567 '[0, 1, 2, 3, 4,5, 6,7, 8, 9, 10]']],
568 [[[0]
569[0, 1]
570[0, 1, 2]
571[0, 1, 2, 3, 4, 5]
572[0, 1, 2, 3, 4, 5, 6, 7, 8]
573[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]])
574
99155935 575OVSDB_CHECK_POSITIVE_CPY([JSON set of 1 to 3 uuids],
f85f8ebb
BP
576 [[parse-data '{"key": "uuid", "min": 1, "max": 3}' \
577 '["set", [["uuid", "550e8400-e29b-41d4-a716-446655440000"]]]' \
ae8f13e2 578 '["uuid", "b5078be0-7664-4299-b836-8bcc03ef941f"]' \
f85f8ebb
BP
579 '["set", [["uuid", "c5051240-30ff-43ed-b4b9-93cf3f050813"],
580 ["uuid", "90558331-09af-4d2f-a572-509cad2e9088"],
581 ["uuid", "550e8400-e29b-41d4-a716-446655440000"]]]']],
ae8f13e2
BP
582 [[["uuid","550e8400-e29b-41d4-a716-446655440000"]
583["uuid","b5078be0-7664-4299-b836-8bcc03ef941f"]
f85f8ebb
BP
584["set",[["uuid","550e8400-e29b-41d4-a716-446655440000"],["uuid","90558331-09af-4d2f-a572-509cad2e9088"],["uuid","c5051240-30ff-43ed-b4b9-93cf3f050813"]]]]])
585
5c414a2e
BP
586OVSDB_CHECK_POSITIVE([string set of 1 to 3 uuids],
587 [[parse-data-strings '{"key": "uuid", "min": 1, "max": 3}' \
588 '[550e8400-e29b-41d4-a716-446655440000]' \
589 '[c5051240-30ff-43ed-b4b9-93cf3f050813,
590 90558331-09af-4d2f-a572-509cad2e9088,
591 550e8400-e29b-41d4-a716-446655440000]']],
592 [[[550e8400-e29b-41d4-a716-446655440000]
593[550e8400-e29b-41d4-a716-446655440000, 90558331-09af-4d2f-a572-509cad2e9088, c5051240-30ff-43ed-b4b9-93cf3f050813]]])
594
99155935 595OVSDB_CHECK_POSITIVE_CPY([JSON set of 0 to 3 strings],
f85f8ebb
BP
596 [[parse-data '{"key": "string", "min": 0, "max": 3}' \
597 '["set", []]' \
ae8f13e2 598 '["a longer string"]' \
f85f8ebb
BP
599 '["set", ["a relatively long string"]]' \
600 '["set", ["short string", "a relatively long string"]]' \
601 '["set", ["zzz", "short string", "a relatively long string"]]']],
602 [[["set",[]]
ae8f13e2
BP
603"a longer string"
604"a relatively long string"
f85f8ebb
BP
605["set",["a relatively long string","short string"]]
606["set",["a relatively long string","short string","zzz"]]]])
607
5c414a2e
BP
608OVSDB_CHECK_POSITIVE([string set of 0 to 3 strings],
609 [[parse-data-strings '{"key": "string", "min": 0, "max": 3}' \
610 '[]' \
611 '"a relatively long string"' \
612 '["short string", "a relatively long string"]' \
613 '"zzz","short string","a relatively long string"']],
614 [[[]
615["a relatively long string"]
616["a relatively long string", "short string"]
617["a relatively long string", "short string", zzz]]])
618
99155935 619OVSDB_CHECK_NEGATIVE_CPY([duplicate boolean not allowed in JSON set],
f85f8ebb
BP
620 [[parse-data '{"key": "boolean", "max": 5}' '["set", [true, true]]']],
621 [ovsdb error: set contains duplicate])
622
5c414a2e
BP
623OVSDB_CHECK_NEGATIVE([duplicate boolean not allowed in string set],
624 [[parse-data-strings '{"key": "boolean", "max": 5}' 'true, true']],
625 [set contains duplicate value])
626
99155935 627OVSDB_CHECK_NEGATIVE_CPY([duplicate integer not allowed in JSON set],
f85f8ebb
BP
628 [[parse-data '{"key": "integer", "max": 5}' '["set", [1, 2, 3, 1]]']],
629 [ovsdb error: set contains duplicate])
630
5c414a2e
BP
631OVSDB_CHECK_NEGATIVE([duplicate integer not allowed in string set],
632 [[parse-data-strings '{"key": "integer", "max": 5}' '[1, 2, 3, 1]']],
633 [set contains duplicate value])
634
99155935 635OVSDB_CHECK_NEGATIVE_CPY([duplicate real not allowed in JSON set],
f85f8ebb
BP
636 [[parse-data '{"key": "real", "max": 5}' '["set", [0.0, -0.0]]']],
637 [ovsdb error: set contains duplicate])
638
5c414a2e
BP
639OVSDB_CHECK_NEGATIVE([duplicate real not allowed in string set],
640 [[parse-data-strings '{"key": "real", "max": 5}' '0.0, -0.0']],
641 [set contains duplicate value])
642
99155935 643OVSDB_CHECK_NEGATIVE_CPY([duplicate string not allowed in JSON set],
f85f8ebb
BP
644 [[parse-data '{"key": "string", "max": 5}' '["set", ["asdf", "ASDF", "asdf"]]']],
645 [ovsdb error: set contains duplicate])
646
5c414a2e
BP
647OVSDB_CHECK_NEGATIVE([duplicate string not allowed in string set],
648 [[parse-data-strings '{"key": "string", "max": 5}' 'asdf, ASDF, "asdf"']],
649 [set contains duplicate value])
650
99155935 651OVSDB_CHECK_NEGATIVE_CPY([duplicate uuid not allowed in JSON set],
f85f8ebb
BP
652 [[parse-data '{"key": "uuid", "max": 5}' \
653 '["set", [["uuid", "7ef21525-0088-4a28-a418-5518413e43ea"],
654 ["uuid", "355ad037-f1da-40aa-b47c-ff9c7e8c6a38"],
655 ["uuid", "7ef21525-0088-4a28-a418-5518413e43ea"]]]']],
656 [ovsdb error: set contains duplicate])
657
5c414a2e
BP
658OVSDB_CHECK_NEGATIVE([duplicate uuid not allowed in string set],
659 [[parse-data-strings '{"key": "uuid", "max": 5}' \
660 '7ef21525-0088-4a28-a418-5518413e43ea,
661 355ad037-f1da-40aa-b47c-ff9c7e8c6a38,
662 7ef21525-0088-4a28-a418-5518413e43ea']],
663 [set contains duplicate value])
bd76d25d 664\f
f85f8ebb
BP
665AT_BANNER([OVSDB -- map data])
666
99155935 667OVSDB_CHECK_POSITIVE_CPY([JSON map of 1 integer to boolean],
f85f8ebb
BP
668 [[parse-data '{"key": "integer", "value": "boolean"}' \
669 '["map", [[1, true]]]']],
670 [[["map",[[1,true]]]]])
671
5c414a2e
BP
672OVSDB_CHECK_POSITIVE([string map of 1 integer to boolean],
673 [[parse-data-strings '{"key": "integer", "value": "boolean"}' \
674 '1=true']],
675 [[1=true]])
676
99155935 677OVSDB_CHECK_POSITIVE_CPY([JSON map of at least 1 integer to boolean],
f85f8ebb
BP
678 [[parse-data '{"key": "integer", "value": "boolean", "max": "unlimited"}' \
679 '["map", [[1, true]]]' \
680 '["map", [[0, true], [1, false], [2, true], [3, true], [4, true]]]' \
681 '["map", [[3, false], [0, true], [4, false]]]']],
682 [[["map",[[1,true]]]
683["map",[[0,true],[1,false],[2,true],[3,true],[4,true]]]
684["map",[[0,true],[3,false],[4,false]]]]])
685
5c414a2e
BP
686OVSDB_CHECK_POSITIVE([string map of at least 1 integer to boolean],
687 [[parse-data-strings '{"key": "integer", "value": "boolean", "max": "unlimited"}' \
688 '1=true' \
689 '0=true 1=false 2=true, 3=true 4=true,' \
690 '3=false,0=true ,4=false']],
691 [[{1=true}
692{0=true, 1=false, 2=true, 3=true, 4=true}
693{0=true, 3=false, 4=false}]])
694
99155935 695OVSDB_CHECK_POSITIVE_CPY([JSON map of 1 boolean to integer],
f85f8ebb
BP
696 [[parse-data '{"key": "boolean", "value": "integer"}' \
697 '["map", [[true, 1]]]']],
698 [[["map",[[true,1]]]]])
699
5c414a2e
BP
700OVSDB_CHECK_POSITIVE([string map of 1 boolean to integer],
701 [[parse-data-strings '{"key": "boolean", "value": "integer"}' \
702 'true=1']],
703 [[true=1]])
704
99155935 705OVSDB_CHECK_POSITIVE_CPY([JSON map of 1 uuid to real],
31a763d7 706 [[parse-data '{"key": "uuid", "value": "real", "min": 1, "max": 5}' \
f85f8ebb
BP
707 '["map", [[["uuid", "cad8542b-6ee1-486b-971b-7dcbf6e14979"], 1.0],
708 [["uuid", "6b94b968-2702-4f64-9457-314a34d69b8c"], 2.0],
709 [["uuid", "d2c4a168-24de-47eb-a8a3-c1abfc814979"], 3.0],
710 [["uuid", "25bfa475-d072-4f60-8be1-00f48643e9cb"], 4.0],
711 [["uuid", "1c92b8ca-d5e4-4628-a85d-1dc2d099a99a"], 5.0]]]']],
712 [[["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]]]]])
713
5c414a2e
BP
714OVSDB_CHECK_POSITIVE([string map of 1 uuid to real],
715 [[parse-data-strings '{"key": "uuid", "value": "real", "min": 1, "max": 5}' \
716 'cad8542b-6ee1-486b-971b-7dcbf6e14979=1.0,
717 6b94b968-2702-4f64-9457-314a34d69b8c=2.0,
718 d2c4a168-24de-47eb-a8a3-c1abfc814979=3.0,
719 25bfa475-d072-4f60-8be1-00f48643e9cb=4.0,
720 1c92b8ca-d5e4-4628-a85d-1dc2d099a99a=5.0']],
721 [[{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}]])
722
99155935 723OVSDB_CHECK_POSITIVE_CPY([JSON map of 10 string to string],
31a763d7 724 [[parse-data '{"key": "string", "value": "string", "min": 1, "max": 10}' \
f85f8ebb
BP
725 '["map", [["2 gills", "1 chopin"],
726 ["2 chopins", "1 pint"],
727 ["2 pints", "1 quart"],
728 ["2 quarts", "1 pottle"],
729 ["2 pottles", "1 gallon"],
730 ["2 gallons", "1 peck"],
731 ["2 pecks", "1 demibushel"],
732 ["2 demibushel", "1 firkin"],
733 ["2 firkins", "1 kilderkin"],
734 ["2 kilderkins", "1 barrel"]]]']],
735 [[["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"]]]]])
736
5c414a2e
BP
737OVSDB_CHECK_POSITIVE([string map of 10 string to string],
738 [[parse-data-strings '{"key": "string", "value": "string", "min": 1, "max": 10}' \
739 '{"2 gills"="1 chopin",
740 "2 chopins"= "1 pint",
741 "2 pints"= "1 quart",
742 "2 quarts"= "1 pottle",
743 "2 pottles"= "1 gallon",
744 "2 gallons"= "1 peck",
745 "2 pecks"= "1 demibushel",
746 "2 demibushel"= "1 firkin",
747 "2 firkins"= "1 kilderkin",
748 "2 kilderkins"= "1 barrel"}']],
749 [[{"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"}]])
750
99155935 751OVSDB_CHECK_NEGATIVE_CPY([duplicate integer key not allowed in JSON map],
f85f8ebb
BP
752 [[parse-data '{"key": "integer", "value": "boolean", "max": 5}' \
753 '["map", [[1, true], [2, false], [1, false]]]']],
754 [ovsdb error: map contains duplicate key])
5c414a2e
BP
755
756OVSDB_CHECK_NEGATIVE([duplicate integer key not allowed in string map],
757 [[parse-data-strings '{"key": "integer", "value": "boolean", "max": 5}' \
758 '1=true 2=false 1=false']],
759 [map contains duplicate key])