]>
Commit | Line | Data |
---|---|---|
958ac03a BP |
1 | AT_BANNER([OVSDB -- default values]) |
2 | ||
99155935 | 3 | OVSDB_CHECK_POSITIVE_CPY([default atoms], |
958ac03a BP |
4 | [default-atoms], |
5 | [[integer: OK | |
6 | real: OK | |
7 | boolean: OK | |
8 | string: OK | |
9 | uuid: OK]]) | |
10 | ||
99155935 | 11 | OVSDB_CHECK_POSITIVE_CPY([default data], |
958ac03a BP |
12 | [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]]) | |
73 | ||
bd76d25d | 74 | AT_BANNER([OVSDB -- atoms without constraints]) |
f85f8ebb | 75 | |
99155935 | 76 | OVSDB_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 | |
85 | 1000 | |
86 | 9223372036854775807 | |
87 | -9223372036854775808]) | |
88 | ||
5c414a2e BP |
89 | OVSDB_CHECK_POSITIVE([integer atom from string], |
90 | [[parse-atom-strings -- '["integer"]' \ | |
91 | '0' \ | |
92 | '-1' \ | |
93 | '+1000' \ | |
94 | '9223372036854775807' \ | |
1ab39058 LR |
95 | '-9223372036854775808' \ |
96 | '0-1000' \ | |
97 | '-1000-+1000' \ | |
98 | '-1000--10' \ | |
99 | '+10-+1000' \ | |
100 | '1-4096' \ | |
101 | '-4096--1' \ | |
102 | '-2000-2095']], | |
5c414a2e BP |
103 | [0 |
104 | -1 | |
105 | 1000 | |
106 | 9223372036854775807 | |
1ab39058 LR |
107 | -9223372036854775808 |
108 | 0-1000 | |
109 | -1000-1000 | |
110 | -1000--10 | |
111 | 10-1000 | |
112 | 1-4096 | |
113 | -4096--1 | |
114 | -2000-2095]) | |
5c414a2e | 115 | |
99155935 | 116 | OVSDB_CHECK_POSITIVE_CPY([real atom from JSON], |
f85f8ebb BP |
117 | [[parse-atoms '["real"]' \ |
118 | '[0]' \ | |
119 | '[0.0]' \ | |
120 | '[-0.0]' \ | |
121 | '[-1.25]' \ | |
122 | '[1e3]' \ | |
123 | '[1e37]' \ | |
124 | '[0.00390625]' ]], | |
125 | [0 | |
126 | 0 | |
127 | 0 | |
128 | -1.25 | |
129 | 1000 | |
130 | 1e+37 | |
131 | 0.00390625]) | |
132 | ||
5c414a2e BP |
133 | OVSDB_CHECK_POSITIVE([real atom from string], |
134 | [[parse-atom-strings -- '["real"]' \ | |
135 | '0' \ | |
136 | '0.0' \ | |
137 | '-0.0' \ | |
138 | '-1.25' \ | |
139 | '1e3' \ | |
140 | '1e37' \ | |
141 | '0.00390625' ]], | |
142 | [0 | |
143 | 0 | |
144 | 0 | |
145 | -1.25 | |
146 | 1000 | |
147 | 1e+37 | |
148 | 0.00390625]) | |
149 | ||
99155935 | 150 | OVSDB_CHECK_POSITIVE_CPY([boolean atom from JSON], |
f85f8ebb BP |
151 | [[parse-atoms '["boolean"]' '[true]' '[false]' ]], |
152 | [true | |
153 | false]) | |
154 | ||
5c414a2e BP |
155 | OVSDB_CHECK_POSITIVE([boolean atom from string], |
156 | [[parse-atom-strings '["boolean"]' 'true' 'false' ]], | |
157 | [true | |
158 | false]) | |
159 | ||
99155935 | 160 | OVSDB_CHECK_POSITIVE_CPY([string atom from JSON], |
f85f8ebb BP |
161 | [[parse-atoms '["string"]' '[""]' '["true"]' '["\"\\\/\b\f\n\r\t"]']], |
162 | ["" | |
163 | "true" | |
164 | "\"\\/\b\f\n\r\t"]) | |
165 | ||
5c414a2e BP |
166 | OVSDB_CHECK_POSITIVE([string atom from string], |
167 | [[parse-atom-strings '["string"]' \ | |
168 | 'unquoted' \ | |
169 | '"quoted-string"' \ | |
170 | '"needs quotes"' \ | |
171 | '""' \ | |
172 | '"true"' \ | |
173 | '"\"\\\/\b\f\n\r\t"']], | |
174 | [unquoted | |
175 | quoted-string | |
176 | "needs quotes" | |
177 | "" | |
178 | "true" | |
179 | "\"\\/\b\f\n\r\t"]) | |
180 | ||
99155935 | 181 | OVSDB_CHECK_POSITIVE_CPY([uuid atom from JSON], |
f85f8ebb BP |
182 | [[parse-atoms '["uuid"]' '["uuid", "550e8400-e29b-41d4-a716-446655440000"]']], |
183 | [[["uuid","550e8400-e29b-41d4-a716-446655440000"]]]) | |
184 | ||
5c414a2e BP |
185 | OVSDB_CHECK_POSITIVE([uuid atom from string], |
186 | [[parse-atom-strings '["uuid"]' '550e8400-e29b-41d4-a716-446655440000']], | |
187 | [550e8400-e29b-41d4-a716-446655440000]) | |
188 | ||
99155935 | 189 | OVSDB_CHECK_POSITIVE_CPY([integer atom sorting], |
f85f8ebb BP |
190 | [[sort-atoms '["integer"]' '[55,0,-1,2,1]']], |
191 | [[[-1,0,1,2,55]]]) | |
192 | ||
99155935 | 193 | OVSDB_CHECK_POSITIVE_CPY([real atom sorting], |
f85f8ebb BP |
194 | [[sort-atoms '["real"]' '[1.25,1.23,0.0,-0.0,-1e99]']], |
195 | [[[-1e+99,0,0,1.23,1.25]]]) | |
196 | ||
99155935 | 197 | OVSDB_CHECK_POSITIVE_CPY([boolean atom sorting], |
f85f8ebb BP |
198 | [[sort-atoms '["boolean"]' '[true,false,true,false,false]']], |
199 | [[[false,false,false,true,true]]]) | |
200 | ||
99155935 | 201 | OVSDB_CHECK_POSITIVE_CPY([string atom sorting], |
f85f8ebb BP |
202 | [[sort-atoms '["string"]' '["abd","abc","\b","xxx"]']], |
203 | [[["\b","abc","abd","xxx"]]]) | |
204 | ||
99155935 | 205 | OVSDB_CHECK_POSITIVE_CPY([uuid atom sorting], |
f85f8ebb BP |
206 | [[sort-atoms '["uuid"]' '[ |
207 | ["uuid", "00000000-0000-0000-0000-000000000001"], | |
208 | ["uuid", "00000000-1000-0000-0000-000000000000"], | |
209 | ["uuid", "00000000-0000-1000-0000-000000000000"], | |
210 | ["uuid", "00010000-0000-0000-0000-000000000000"], | |
211 | ["uuid", "00000000-0000-0000-0000-000000000100"], | |
212 | ["uuid", "00000000-0000-0000-0000-000100000000"], | |
213 | ["uuid", "00000000-0000-0010-0000-000000000000"], | |
214 | ["uuid", "00000100-0000-0000-0000-000000000000"], | |
215 | ["uuid", "00000000-0000-0001-0000-000000000000"], | |
216 | ["uuid", "00000000-0000-0000-0000-000001000000"], | |
217 | ["uuid", "01000000-0000-0000-0000-000000000000"], | |
218 | ["uuid", "00000000-0000-0000-0000-000000001000"], | |
219 | ["uuid", "00000000-0000-0000-0000-000010000000"], | |
220 | ["uuid", "00000000-0000-0000-0000-010000000000"], | |
221 | ["uuid", "00000000-0000-0100-0000-000000000000"], | |
222 | ["uuid", "10000000-0000-0000-0000-000000000000"], | |
223 | ["uuid", "00000000-0000-0000-0000-000000000010"], | |
224 | ["uuid", "00000000-0100-0000-0000-000000000000"], | |
225 | ["uuid", "00000000-0000-0000-0100-000000000000"], | |
226 | ["uuid", "00000000-0000-0000-0001-000000000000"], | |
227 | ["uuid", "00000010-0000-0000-0000-000000000000"], | |
228 | ["uuid", "00000000-0000-0000-0010-000000000000"], | |
229 | ["uuid", "00000000-0000-0000-0000-000000010000"], | |
230 | ["uuid", "00000000-0000-0000-1000-000000000000"], | |
231 | ["uuid", "00000000-0000-0000-0000-100000000000"], | |
232 | ["uuid", "00000000-0000-0000-0000-001000000000"], | |
233 | ["uuid", "00000000-0000-0000-0000-000000100000"], | |
234 | ["uuid", "00000000-0000-0000-0000-000000000000"], | |
235 | ["uuid", "00000000-0010-0000-0000-000000000000"], | |
236 | ["uuid", "00100000-0000-0000-0000-000000000000"], | |
237 | ["uuid", "00000000-0001-0000-0000-000000000000"], | |
238 | ["uuid", "00000001-0000-0000-0000-000000000000"], | |
239 | ["uuid", "00001000-0000-0000-0000-000000000000"]]']], | |
240 | [[[["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"]]]]) | |
241 | ||
99155935 | 242 | OVSDB_CHECK_POSITIVE_CPY([real not acceptable integer JSON atom], |
f85f8ebb | 243 | [[parse-atoms '["integer"]' '[0.5]' ]], |
bd76d25d BP |
244 | [syntax "0.5": syntax error: expected integer]) |
245 | ||
246 | dnl <C0> is not allowed anywhere in a UTF-8 string. | |
247 | dnl <ED A0 80> is a surrogate and not allowed in UTF-8. | |
be44585c | 248 | OVSDB_CHECK_POSITIVE([no invalid UTF-8 sequences in strings], |
bd76d25d | 249 | [parse-atoms '[["string"]]' \ |
a238d75e BP |
250 | '@<:@"m4_esyscmd([printf "\300"])"@:>@' \ |
251 | '@<:@"m4_esyscmd([printf "\355\240\200"])"@:>@' \ | |
bd76d25d | 252 | ], |
be44585c BP |
253 | [constraint violation: not a valid UTF-8 string: invalid UTF-8 sequence 0xc0 |
254 | constraint violation: not a valid UTF-8 string: invalid UTF-8 sequence 0xed 0xa0]) | |
255 | ||
256 | dnl Python won't let invalid UTF-8 (its idea of invalid UTF-8, anyway) into it | |
257 | dnl at all, so this test never gets as far as a constraint violation. It's | |
258 | dnl just a JSON parse error. | |
259 | dnl | |
260 | dnl <C0> is not allowed anywhere in a UTF-8 string. | |
261 | dnl (<ED A0 80> is not allowed in UTF-8 but Python doesn't care.) | |
262 | dnl <ED 80 7F> is not allowed in UTF-8. | |
263 | OVSDB_CHECK_POSITIVE_PY([no invalid UTF-8 sequences in strings - Python], | |
264 | [parse-atoms '[["string"]]' \ | |
265 | '@<:@"m4_esyscmd([printf "\300"])"@:>@' \ | |
266 | '@<:@"m4_esyscmd([printf "\355\200\177"])"@:>@' \ | |
267 | ], | |
268 | ["not a valid UTF-8 string: invalid UTF-8 sequence 0xc0" | |
269 | "not a valid UTF-8 string: invalid UTF-8 sequence 0xed 0x80"]) | |
f85f8ebb | 270 | |
5c414a2e BP |
271 | OVSDB_CHECK_NEGATIVE([real not acceptable integer string atom], |
272 | [[parse-atom-strings '["integer"]' '0.5' ]], | |
273 | ["0.5" is not a valid integer]) | |
274 | ||
1ab39058 LR |
275 | OVSDB_CHECK_NEGATIVE([inverted range is not acceptable integer string atom positive and negative], |
276 | [[parse-atom-strings -- '["integer"]' '10--10' ]], | |
277 | ["10--10" is not a valid range. Range end cannot be before start.]) | |
278 | ||
279 | OVSDB_CHECK_NEGATIVE([inverted range is not acceptable integer string atom negative], | |
280 | [[parse-atom-strings -- '["integer"]' '-10--100' ]], | |
281 | ["-10--100" is not a valid range. Range end cannot be before start.]) | |
282 | ||
283 | OVSDB_CHECK_NEGATIVE([inverted range is not acceptable integer string atom positive], | |
284 | [[parse-atom-strings -- '["integer"]' '100-10' ]], | |
285 | ["100-10" is not a valid range. Range end cannot be before start.]) | |
286 | ||
287 | OVSDB_CHECK_NEGATIVE([too big range is not acceptable integer string atom positive and negative], | |
288 | [[parse-atom-strings -- '["integer"]' '-2000-2096' ]], | |
289 | [Range "-2000-2096" is too big.]) | |
290 | ||
291 | OVSDB_CHECK_NEGATIVE([too big range is not acceptable integer string atom negative], | |
292 | [[parse-atom-strings -- '["integer"]' '-4097--1' ]], | |
293 | [Range "-4097--1" is too big.]) | |
294 | ||
295 | OVSDB_CHECK_NEGATIVE([too big range is not acceptable integer string atom positive], | |
296 | [[parse-atom-strings -- '["integer"]' '1-4097' ]], | |
297 | [Range "1-4097" is too big.]) | |
298 | ||
99155935 | 299 | OVSDB_CHECK_POSITIVE_CPY([string "true" not acceptable boolean JSON atom], |
f85f8ebb | 300 | [[parse-atoms '["boolean"]' '["true"]' ]], |
bd76d25d | 301 | [syntax ""true"": syntax error: expected boolean]) |
f85f8ebb | 302 | |
5c414a2e BP |
303 | OVSDB_CHECK_NEGATIVE([string "true" not acceptable boolean string atom], |
304 | [[parse-atom-strings '["boolean"]' '"true"' ]], | |
305 | [""true"" is not a valid boolean (use "true" or "false")]) | |
306 | ||
99155935 | 307 | OVSDB_CHECK_POSITIVE_CPY([integer not acceptable string JSON atom], |
f85f8ebb | 308 | [[parse-atoms '["string"]' '[1]']], |
bd76d25d | 309 | [syntax "1": syntax error: expected string]) |
f85f8ebb | 310 | |
99155935 | 311 | OVSDB_CHECK_POSITIVE_CPY([uuid atom must be expressed as JSON array], |
f85f8ebb | 312 | [[parse-atoms '["uuid"]' '["550e8400-e29b-41d4-a716-446655440000"]']], |
bd76d25d | 313 | [[syntax ""550e8400-e29b-41d4-a716-446655440000"": syntax error: expected ["uuid", <string>]]]) |
fdba6728 BP |
314 | |
315 | OVSDB_CHECK_POSITIVE_CPY([named-uuid requires symbol table], | |
316 | [parse-atoms '[["uuid"]]' '[["named-uuid", "x"]]'], | |
317 | [[syntax "["named-uuid","x"]": syntax error: expected ["uuid", <string>]]]) | |
f85f8ebb | 318 | |
5c414a2e BP |
319 | OVSDB_CHECK_NEGATIVE([empty string atom must be quoted], |
320 | [[parse-atom-strings '["string"]' '']], | |
321 | [An empty string is not valid as input; use "" to represent the empty string]) | |
322 | ||
323 | OVSDB_CHECK_NEGATIVE([quotes must be balanced], | |
324 | [parse-atom-strings '[["string"]]' '"asdf'], | |
325 | ["asdf: missing quote at end of quoted string]) | |
326 | ||
5aa7f168 BP |
327 | OVSDB_CHECK_NEGATIVE([quoted string must not contain unescaped quote], |
328 | [parse-atom-strings '[["string"]]' '"as"df"'], | |
329 | ["as"df": quoted string may not include unescaped "]) | |
330 | ||
331 | OVSDB_CHECK_NEGATIVE([quoted string must not end with backslash], | |
332 | [parse-atom-strings '[["string"]]' '"asdf\"'], | |
333 | ["asdf\": quoted string may not end with backslash]) | |
334 | ||
5c414a2e BP |
335 | OVSDB_CHECK_NEGATIVE([uuids must be valid], |
336 | [parse-atom-strings '[["uuid"]]' '1234-5678'], | |
337 | ["1234-5678" is not a valid UUID]) | |
bd76d25d | 338 | \f |
bfc96d9b BP |
339 | AT_BANNER([OVSDB -- atoms with enum constraints]) |
340 | ||
99155935 | 341 | OVSDB_CHECK_POSITIVE_CPY([integer atom enum], |
bfc96d9b BP |
342 | [[parse-atoms '[{"type": "integer", "enum": ["set", [1, 6, 8, 10]]}]' \ |
343 | '[0]' \ | |
344 | '[1]' \ | |
345 | '[2]' \ | |
346 | '[3]' \ | |
347 | '[6]' \ | |
348 | '[7]' \ | |
349 | '[8]' \ | |
350 | '[9]' \ | |
351 | '[10]' \ | |
352 | '[11]']], | |
353 | [[constraint violation: 0 is not one of the allowed values ([1, 6, 8, 10]) | |
354 | 1 | |
355 | constraint violation: 2 is not one of the allowed values ([1, 6, 8, 10]) | |
356 | constraint violation: 3 is not one of the allowed values ([1, 6, 8, 10]) | |
357 | 6 | |
358 | constraint violation: 7 is not one of the allowed values ([1, 6, 8, 10]) | |
359 | 8 | |
360 | constraint violation: 9 is not one of the allowed values ([1, 6, 8, 10]) | |
361 | 10 | |
362 | constraint violation: 11 is not one of the allowed values ([1, 6, 8, 10])]]) | |
363 | ||
1ab39058 LR |
364 | OVSDB_CHECK_POSITIVE([integer atom enum from string], |
365 | [[parse-atom-strings '[{"type": "integer", "enum": ["set", [1, 6, 8, 10, 20, 21, 22, 23, 24, 25]]}]' \ | |
366 | '1' \ | |
367 | '6' \ | |
368 | '8' \ | |
369 | '10' \ | |
370 | '20-25']], | |
371 | [[1 | |
372 | 6 | |
373 | 8 | |
374 | 10 | |
375 | 20-25]]) | |
376 | ||
377 | OVSDB_CHECK_NEGATIVE([integer not in enum set from string], | |
378 | [[parse-atom-strings '[{"type": "integer", "enum": ["set", [1, 6, 8, 10]]}]' '0' ]], | |
379 | [[constraint violation: 0 is not one of the allowed values ([1, 6, 8, 10])]]) | |
380 | ||
381 | OVSDB_CHECK_NEGATIVE([integer range not in enum set from string], | |
382 | [[parse-atom-strings '[{"type": "integer", "enum": ["set", [1, 6, 8, 10]]}]' '8-10' ]], | |
383 | [[constraint violation: 9 is not one of the allowed values ([1, 6, 8, 10])]]) | |
384 | ||
99155935 | 385 | OVSDB_CHECK_POSITIVE_CPY([real atom enum], |
bfc96d9b BP |
386 | [[parse-atoms '[{"type": "real", "enum": ["set", [-1.5, 1.5]]}]' \ |
387 | '[-2]' \ | |
388 | '[-1]' \ | |
389 | '[-1.5]' \ | |
390 | '[0]' \ | |
391 | '[1]' \ | |
392 | '[1.5]' \ | |
393 | '[2]']], | |
394 | [[constraint violation: -2 is not one of the allowed values ([-1.5, 1.5]) | |
395 | constraint violation: -1 is not one of the allowed values ([-1.5, 1.5]) | |
396 | -1.5 | |
397 | constraint violation: 0 is not one of the allowed values ([-1.5, 1.5]) | |
398 | constraint violation: 1 is not one of the allowed values ([-1.5, 1.5]) | |
399 | 1.5 | |
400 | constraint violation: 2 is not one of the allowed values ([-1.5, 1.5])]]) | |
401 | ||
99155935 | 402 | OVSDB_CHECK_POSITIVE_CPY([boolean atom enum], |
bfc96d9b BP |
403 | [[parse-atoms '[{"type": "boolean", "enum": false}]' \ |
404 | '[false]' \ | |
405 | '[true]']], | |
406 | [[false | |
407 | constraint violation: true is not one of the allowed values ([false])]]) | |
408 | ||
99155935 | 409 | OVSDB_CHECK_POSITIVE_CPY([string atom enum], |
bfc96d9b BP |
410 | [[parse-atoms '[{"type": "string", "enum": ["set", ["abc", "def"]]}]' \ |
411 | '[""]' \ | |
412 | '["ab"]' \ | |
413 | '["abc"]' \ | |
414 | '["def"]' \ | |
415 | '["defg"]' \ | |
416 | '["DEF"]']], | |
417 | [[constraint violation: "" is not one of the allowed values ([abc, def]) | |
418 | constraint violation: ab is not one of the allowed values ([abc, def]) | |
419 | "abc" | |
420 | "def" | |
421 | constraint violation: defg is not one of the allowed values ([abc, def]) | |
422 | constraint violation: DEF is not one of the allowed values ([abc, def])]]) | |
423 | ||
99155935 | 424 | OVSDB_CHECK_POSITIVE_CPY([uuid atom enum], |
bfc96d9b BP |
425 | [[parse-atoms '[{"type": "uuid", "enum": ["set", [["uuid", "6d53a6dd-2da7-4924-9927-97f613812382"], ["uuid", "52cbc842-137a-4db5-804f-9f34106a0ba3"]]]}]' \ |
426 | '["uuid", "6d53a6dd-2da7-4924-9927-97f613812382"]' \ | |
427 | '["uuid", "52cbc842-137a-4db5-804f-9f34106a0ba3"]' \ | |
428 | '["uuid", "dab2a6b2-6094-4f43-a7ef-4c0f0608f176"]']], | |
429 | [[["uuid","6d53a6dd-2da7-4924-9927-97f613812382"] | |
430 | ["uuid","52cbc842-137a-4db5-804f-9f34106a0ba3"] | |
431 | constraint violation: dab2a6b2-6094-4f43-a7ef-4c0f0608f176 is not one of the allowed values ([52cbc842-137a-4db5-804f-9f34106a0ba3, 6d53a6dd-2da7-4924-9927-97f613812382])]]) | |
432 | \f | |
433 | AT_BANNER([OVSDB -- atoms with other constraints]) | |
bd76d25d | 434 | |
99155935 | 435 | OVSDB_CHECK_POSITIVE_CPY([integers >= 5], |
bd76d25d BP |
436 | [[parse-atoms '[{"type": "integer", "minInteger": 5}]' \ |
437 | '[0]' \ | |
438 | '[4]' \ | |
439 | '[5]' \ | |
440 | '[6]' \ | |
441 | '[12345]']], | |
442 | [constraint violation: 0 is less than minimum allowed value 5 | |
443 | constraint violation: 4 is less than minimum allowed value 5 | |
444 | 5 | |
445 | 6 | |
446 | 12345]) | |
447 | ||
99155935 | 448 | OVSDB_CHECK_POSITIVE_CPY([integers <= -1], |
bd76d25d BP |
449 | [[parse-atoms '[{"type": "integer", "maxInteger": -1}]' \ |
450 | '[0]' \ | |
451 | '[-1]' \ | |
452 | '[-2]' \ | |
453 | '[-123]']], | |
454 | [constraint violation: 0 is greater than maximum allowed value -1 | |
455 | -1 | |
456 | -2 | |
457 | -123]) | |
458 | ||
99155935 | 459 | OVSDB_CHECK_POSITIVE_CPY([integers in range -10 to 10], |
bd76d25d BP |
460 | [[parse-atoms '[{"type": "integer", "minInteger": -10, "maxInteger": 10}]' \ |
461 | '[-20]' \ | |
462 | '[-11]' \ | |
463 | '[-10]' \ | |
464 | '[-9]' \ | |
465 | '[1]' \ | |
466 | '[9]' \ | |
467 | '[10]' \ | |
468 | '[11]' \ | |
469 | '[123576]']], | |
470 | [constraint violation: -20 is not in the valid range -10 to 10 (inclusive) | |
471 | constraint violation: -11 is not in the valid range -10 to 10 (inclusive) | |
472 | -10 | |
473 | -9 | |
474 | 1 | |
475 | 9 | |
476 | 10 | |
477 | constraint violation: 11 is not in the valid range -10 to 10 (inclusive) | |
478 | constraint violation: 123576 is not in the valid range -10 to 10 (inclusive)]) | |
479 | ||
99155935 | 480 | OVSDB_CHECK_POSITIVE_CPY([reals >= 5], |
bd76d25d BP |
481 | [[parse-atoms '[{"type": "real", "minReal": 5}]' \ |
482 | '[0]' \ | |
483 | '[4]' \ | |
484 | '[5]' \ | |
485 | '[6]' \ | |
486 | '[12345]']], | |
487 | [constraint violation: 0 is less than minimum allowed value 5 | |
488 | constraint violation: 4 is less than minimum allowed value 5 | |
489 | 5 | |
490 | 6 | |
491 | 12345]) | |
492 | ||
99155935 | 493 | OVSDB_CHECK_POSITIVE_CPY([reals <= -1], |
bd76d25d BP |
494 | [[parse-atoms '[{"type": "real", "maxReal": -1}]' \ |
495 | '[0]' \ | |
496 | '[-1]' \ | |
497 | '[-2]' \ | |
498 | '[-123]']], | |
499 | [constraint violation: 0 is greater than maximum allowed value -1 | |
500 | -1 | |
501 | -2 | |
502 | -123]) | |
503 | ||
99155935 | 504 | OVSDB_CHECK_POSITIVE_CPY([reals in range -10 to 10], |
bd76d25d BP |
505 | [[parse-atoms '[{"type": "real", "minReal": -10, "maxReal": 10}]' \ |
506 | '[-20]' \ | |
507 | '[-11]' \ | |
508 | '[-10]' \ | |
509 | '[-9]' \ | |
510 | '[1]' \ | |
511 | '[9]' \ | |
512 | '[10]' \ | |
513 | '[11]' \ | |
514 | '[123576]']], | |
515 | [constraint violation: -20 is not in the valid range -10 to 10 (inclusive) | |
516 | constraint violation: -11 is not in the valid range -10 to 10 (inclusive) | |
517 | -10 | |
518 | -9 | |
519 | 1 | |
520 | 9 | |
521 | 10 | |
522 | constraint violation: 11 is not in the valid range -10 to 10 (inclusive) | |
523 | constraint violation: 123576 is not in the valid range -10 to 10 (inclusive)]) | |
524 | ||
99155935 | 525 | OVSDB_CHECK_POSITIVE_CPY([strings at least 2 characters long], |
bd76d25d BP |
526 | [[parse-atoms '{"type": "string", "minLength": 2}' \ |
527 | '[""]' \ | |
528 | '["a"]' \ | |
529 | '["ab"]' \ | |
530 | '["abc"]' \ | |
531 | '["\ud834\udd1e"]']], | |
532 | [[constraint violation: "" length 0 is less than minimum allowed length 2 | |
533 | constraint violation: "a" length 1 is less than minimum allowed length 2 | |
534 | "ab" | |
535 | "abc" | |
4807bca9 BP |
536 | constraint violation: "𝄞" length 1 is less than minimum allowed length 2]], |
537 | [], | |
538 | [], | |
539 | [dnl This test requires a wide build of Python. | |
540 | AT_CHECK([$PYTHON -c 'unichr(0x10000)' || exit 77], | |
541 | [0], [ignore], [ignore])]) | |
bd76d25d | 542 | |
99155935 | 543 | OVSDB_CHECK_POSITIVE_CPY([strings no more than 2 characters long], |
bd76d25d BP |
544 | [[parse-atoms '{"type": "string", "maxLength": 2}' \ |
545 | '[""]' \ | |
546 | '["a"]' \ | |
547 | '["ab"]' \ | |
548 | '["abc"]' \ | |
65683353 | 549 | '["de"]']], |
bd76d25d BP |
550 | [["" |
551 | "a" | |
552 | "ab" | |
553 | constraint violation: "abc" length 3 is greater than maximum allowed length 2 | |
65683353 | 554 | "de"]]) |
5c414a2e | 555 | |
218f9539 | 556 | AT_BANNER([OVSDB -- simple data]) |
f85f8ebb | 557 | |
99155935 | 558 | OVSDB_CHECK_POSITIVE_CPY([integer JSON datum], |
ae8f13e2 | 559 | [[parse-data '["integer"]' '[0]' '["set",[1]]' '[-1]']], |
f85f8ebb BP |
560 | [0 |
561 | 1 | |
562 | -1]) | |
563 | ||
5c414a2e BP |
564 | OVSDB_CHECK_POSITIVE([integer string datum], |
565 | [[parse-data-strings -- '["integer"]' '0' '1' '-1' '+1']], | |
566 | [0 | |
567 | 1 | |
568 | -1 | |
569 | 1]) | |
570 | ||
99155935 | 571 | OVSDB_CHECK_POSITIVE_CPY([real JSON datum], |
ae8f13e2 | 572 | [[parse-data '["real"]' '[0]' '["set",[1.0]]' '[-1.25]']], |
f85f8ebb BP |
573 | [0 |
574 | 1 | |
575 | -1.25]) | |
576 | ||
5c414a2e BP |
577 | OVSDB_CHECK_POSITIVE([real string datum], |
578 | [[parse-data-strings -- '["real"]' '0' '1.0' '-1.25']], | |
579 | [0 | |
580 | 1 | |
581 | -1.25]) | |
582 | ||
99155935 | 583 | OVSDB_CHECK_POSITIVE_CPY([boolean JSON datum], |
ae8f13e2 | 584 | [[parse-data '["boolean"]' '["set", [true]]' '[false]' ]], |
f85f8ebb BP |
585 | [true |
586 | false]) | |
587 | ||
5c414a2e BP |
588 | OVSDB_CHECK_POSITIVE([boolean string datum], |
589 | [[parse-data-strings '["boolean"]' 'true' 'false' ]], | |
590 | [true | |
591 | false]) | |
592 | ||
99155935 | 593 | OVSDB_CHECK_POSITIVE_CPY([string JSON datum], |
ae8f13e2 | 594 | [[parse-data '["string"]' '["set",[""]]' '["true"]' '["\"\\\/\b\f\n\r\t"]']], |
f85f8ebb BP |
595 | ["" |
596 | "true" | |
597 | "\"\\/\b\f\n\r\t"]) | |
598 | ||
5c414a2e BP |
599 | OVSDB_CHECK_POSITIVE([string string datum], |
600 | [[parse-data-strings '["string"]' '"x"' '""' '"true"' '"\"\\\/\b\f\n\r\t"']], | |
601 | [x | |
602 | "" | |
603 | "true" | |
604 | "\"\\/\b\f\n\r\t"]) | |
bd76d25d | 605 | \f |
f85f8ebb BP |
606 | AT_BANNER([OVSDB -- set data]) |
607 | ||
99155935 | 608 | OVSDB_CHECK_POSITIVE_CPY([JSON optional boolean], |
f85f8ebb | 609 | [[parse-data '{"key": "boolean", "min": 0}' \ |
ae8f13e2 | 610 | '[true]' \ |
f85f8ebb BP |
611 | '["set", [false]]' \ |
612 | '["set", []]']], | |
ae8f13e2 BP |
613 | [[true |
614 | false | |
f85f8ebb BP |
615 | ["set",[]]]], |
616 | [set]) | |
617 | ||
5c414a2e BP |
618 | OVSDB_CHECK_POSITIVE([string optional boolean], |
619 | [[parse-data-strings '{"key": "boolean", "min": 0}' \ | |
620 | 'true' \ | |
621 | 'false' \ | |
622 | '[]']], | |
623 | [[true | |
624 | false | |
625 | []]], | |
626 | [set]) | |
627 | ||
99155935 | 628 | OVSDB_CHECK_POSITIVE_CPY([JSON set of 0 or more integers], |
f85f8ebb BP |
629 | [[parse-data '{"key": "integer", "min": 0, "max": "unlimited"}' \ |
630 | '["set", [0]]' \ | |
ae8f13e2 | 631 | '[1]' \ |
f85f8ebb BP |
632 | '["set", [0, 1]]' \ |
633 | '["set", [0, 1, 2]]' \ | |
634 | '["set", [0, 1, 2, 3, 4, 5]]' \ | |
635 | '["set", [0, 1, 2, 3, 4, 5, 6, 7, 8]]' \ | |
636 | '["set", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]']], | |
ae8f13e2 BP |
637 | [[0 |
638 | 1 | |
f85f8ebb BP |
639 | ["set",[0,1]] |
640 | ["set",[0,1,2]] | |
641 | ["set",[0,1,2,3,4,5]] | |
642 | ["set",[0,1,2,3,4,5,6,7,8]] | |
643 | ["set",[0,1,2,3,4,5,6,7,8,9,10]]]]) | |
644 | ||
5c414a2e BP |
645 | OVSDB_CHECK_POSITIVE([string set of 0 or more integers], |
646 | [[parse-data-strings '{"key": "integer", "min": 0, "max": "unlimited"}' \ | |
647 | '0' \ | |
648 | '0,1' \ | |
649 | '0, 1, 2' \ | |
650 | '[0, 1,2, 3, 4, 5]' \ | |
651 | '0, 1,2, 3,4, 5, 6, 7, 8' \ | |
1ab39058 LR |
652 | '[0, 1, 2, 3, 4,5, 6,7, 8, 9, 10]' \ |
653 | '0-8' \ | |
654 | '[0-10']]], | |
5c414a2e BP |
655 | [[[0] |
656 | [0, 1] | |
657 | [0, 1, 2] | |
658 | [0, 1, 2, 3, 4, 5] | |
659 | [0, 1, 2, 3, 4, 5, 6, 7, 8] | |
1ab39058 LR |
660 | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] |
661 | [0, 1, 2, 3, 4, 5, 6, 7, 8] | |
5c414a2e BP |
662 | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]]]) |
663 | ||
99155935 | 664 | OVSDB_CHECK_POSITIVE_CPY([JSON set of 1 to 3 uuids], |
f85f8ebb BP |
665 | [[parse-data '{"key": "uuid", "min": 1, "max": 3}' \ |
666 | '["set", [["uuid", "550e8400-e29b-41d4-a716-446655440000"]]]' \ | |
ae8f13e2 | 667 | '["uuid", "b5078be0-7664-4299-b836-8bcc03ef941f"]' \ |
f85f8ebb BP |
668 | '["set", [["uuid", "c5051240-30ff-43ed-b4b9-93cf3f050813"], |
669 | ["uuid", "90558331-09af-4d2f-a572-509cad2e9088"], | |
670 | ["uuid", "550e8400-e29b-41d4-a716-446655440000"]]]']], | |
ae8f13e2 BP |
671 | [[["uuid","550e8400-e29b-41d4-a716-446655440000"] |
672 | ["uuid","b5078be0-7664-4299-b836-8bcc03ef941f"] | |
f85f8ebb BP |
673 | ["set",[["uuid","550e8400-e29b-41d4-a716-446655440000"],["uuid","90558331-09af-4d2f-a572-509cad2e9088"],["uuid","c5051240-30ff-43ed-b4b9-93cf3f050813"]]]]]) |
674 | ||
5c414a2e BP |
675 | OVSDB_CHECK_POSITIVE([string set of 1 to 3 uuids], |
676 | [[parse-data-strings '{"key": "uuid", "min": 1, "max": 3}' \ | |
677 | '[550e8400-e29b-41d4-a716-446655440000]' \ | |
678 | '[c5051240-30ff-43ed-b4b9-93cf3f050813, | |
679 | 90558331-09af-4d2f-a572-509cad2e9088, | |
680 | 550e8400-e29b-41d4-a716-446655440000]']], | |
681 | [[[550e8400-e29b-41d4-a716-446655440000] | |
682 | [550e8400-e29b-41d4-a716-446655440000, 90558331-09af-4d2f-a572-509cad2e9088, c5051240-30ff-43ed-b4b9-93cf3f050813]]]) | |
683 | ||
99155935 | 684 | OVSDB_CHECK_POSITIVE_CPY([JSON set of 0 to 3 strings], |
f85f8ebb BP |
685 | [[parse-data '{"key": "string", "min": 0, "max": 3}' \ |
686 | '["set", []]' \ | |
ae8f13e2 | 687 | '["a longer string"]' \ |
f85f8ebb BP |
688 | '["set", ["a relatively long string"]]' \ |
689 | '["set", ["short string", "a relatively long string"]]' \ | |
690 | '["set", ["zzz", "short string", "a relatively long string"]]']], | |
691 | [[["set",[]] | |
ae8f13e2 BP |
692 | "a longer string" |
693 | "a relatively long string" | |
f85f8ebb BP |
694 | ["set",["a relatively long string","short string"]] |
695 | ["set",["a relatively long string","short string","zzz"]]]]) | |
696 | ||
5c414a2e BP |
697 | OVSDB_CHECK_POSITIVE([string set of 0 to 3 strings], |
698 | [[parse-data-strings '{"key": "string", "min": 0, "max": 3}' \ | |
699 | '[]' \ | |
700 | '"a relatively long string"' \ | |
701 | '["short string", "a relatively long string"]' \ | |
702 | '"zzz","short string","a relatively long string"']], | |
703 | [[[] | |
704 | ["a relatively long string"] | |
705 | ["a relatively long string", "short string"] | |
706 | ["a relatively long string", "short string", zzz]]]) | |
707 | ||
99155935 | 708 | OVSDB_CHECK_NEGATIVE_CPY([duplicate boolean not allowed in JSON set], |
f85f8ebb BP |
709 | [[parse-data '{"key": "boolean", "max": 5}' '["set", [true, true]]']], |
710 | [ovsdb error: set contains duplicate]) | |
711 | ||
5c414a2e BP |
712 | OVSDB_CHECK_NEGATIVE([duplicate boolean not allowed in string set], |
713 | [[parse-data-strings '{"key": "boolean", "max": 5}' 'true, true']], | |
714 | [set contains duplicate value]) | |
715 | ||
99155935 | 716 | OVSDB_CHECK_NEGATIVE_CPY([duplicate integer not allowed in JSON set], |
f85f8ebb BP |
717 | [[parse-data '{"key": "integer", "max": 5}' '["set", [1, 2, 3, 1]]']], |
718 | [ovsdb error: set contains duplicate]) | |
719 | ||
5c414a2e BP |
720 | OVSDB_CHECK_NEGATIVE([duplicate integer not allowed in string set], |
721 | [[parse-data-strings '{"key": "integer", "max": 5}' '[1, 2, 3, 1]']], | |
722 | [set contains duplicate value]) | |
723 | ||
99155935 | 724 | OVSDB_CHECK_NEGATIVE_CPY([duplicate real not allowed in JSON set], |
f85f8ebb BP |
725 | [[parse-data '{"key": "real", "max": 5}' '["set", [0.0, -0.0]]']], |
726 | [ovsdb error: set contains duplicate]) | |
727 | ||
5c414a2e BP |
728 | OVSDB_CHECK_NEGATIVE([duplicate real not allowed in string set], |
729 | [[parse-data-strings '{"key": "real", "max": 5}' '0.0, -0.0']], | |
730 | [set contains duplicate value]) | |
731 | ||
99155935 | 732 | OVSDB_CHECK_NEGATIVE_CPY([duplicate string not allowed in JSON set], |
f85f8ebb BP |
733 | [[parse-data '{"key": "string", "max": 5}' '["set", ["asdf", "ASDF", "asdf"]]']], |
734 | [ovsdb error: set contains duplicate]) | |
735 | ||
5c414a2e BP |
736 | OVSDB_CHECK_NEGATIVE([duplicate string not allowed in string set], |
737 | [[parse-data-strings '{"key": "string", "max": 5}' 'asdf, ASDF, "asdf"']], | |
738 | [set contains duplicate value]) | |
739 | ||
99155935 | 740 | OVSDB_CHECK_NEGATIVE_CPY([duplicate uuid not allowed in JSON set], |
f85f8ebb BP |
741 | [[parse-data '{"key": "uuid", "max": 5}' \ |
742 | '["set", [["uuid", "7ef21525-0088-4a28-a418-5518413e43ea"], | |
743 | ["uuid", "355ad037-f1da-40aa-b47c-ff9c7e8c6a38"], | |
744 | ["uuid", "7ef21525-0088-4a28-a418-5518413e43ea"]]]']], | |
745 | [ovsdb error: set contains duplicate]) | |
746 | ||
5c414a2e BP |
747 | OVSDB_CHECK_NEGATIVE([duplicate uuid not allowed in string set], |
748 | [[parse-data-strings '{"key": "uuid", "max": 5}' \ | |
749 | '7ef21525-0088-4a28-a418-5518413e43ea, | |
750 | 355ad037-f1da-40aa-b47c-ff9c7e8c6a38, | |
751 | 7ef21525-0088-4a28-a418-5518413e43ea']], | |
752 | [set contains duplicate value]) | |
bd76d25d | 753 | \f |
f85f8ebb BP |
754 | AT_BANNER([OVSDB -- map data]) |
755 | ||
99155935 | 756 | OVSDB_CHECK_POSITIVE_CPY([JSON map of 1 integer to boolean], |
f85f8ebb BP |
757 | [[parse-data '{"key": "integer", "value": "boolean"}' \ |
758 | '["map", [[1, true]]]']], | |
759 | [[["map",[[1,true]]]]]) | |
760 | ||
5c414a2e BP |
761 | OVSDB_CHECK_POSITIVE([string map of 1 integer to boolean], |
762 | [[parse-data-strings '{"key": "integer", "value": "boolean"}' \ | |
763 | '1=true']], | |
764 | [[1=true]]) | |
765 | ||
99155935 | 766 | OVSDB_CHECK_POSITIVE_CPY([JSON map of at least 1 integer to boolean], |
f85f8ebb BP |
767 | [[parse-data '{"key": "integer", "value": "boolean", "max": "unlimited"}' \ |
768 | '["map", [[1, true]]]' \ | |
769 | '["map", [[0, true], [1, false], [2, true], [3, true], [4, true]]]' \ | |
770 | '["map", [[3, false], [0, true], [4, false]]]']], | |
771 | [[["map",[[1,true]]] | |
772 | ["map",[[0,true],[1,false],[2,true],[3,true],[4,true]]] | |
773 | ["map",[[0,true],[3,false],[4,false]]]]]) | |
774 | ||
5c414a2e BP |
775 | OVSDB_CHECK_POSITIVE([string map of at least 1 integer to boolean], |
776 | [[parse-data-strings '{"key": "integer", "value": "boolean", "max": "unlimited"}' \ | |
777 | '1=true' \ | |
778 | '0=true 1=false 2=true, 3=true 4=true,' \ | |
779 | '3=false,0=true ,4=false']], | |
780 | [[{1=true} | |
781 | {0=true, 1=false, 2=true, 3=true, 4=true} | |
782 | {0=true, 3=false, 4=false}]]) | |
783 | ||
99155935 | 784 | OVSDB_CHECK_POSITIVE_CPY([JSON map of 1 boolean to integer], |
f85f8ebb BP |
785 | [[parse-data '{"key": "boolean", "value": "integer"}' \ |
786 | '["map", [[true, 1]]]']], | |
787 | [[["map",[[true,1]]]]]) | |
788 | ||
5c414a2e BP |
789 | OVSDB_CHECK_POSITIVE([string map of 1 boolean to integer], |
790 | [[parse-data-strings '{"key": "boolean", "value": "integer"}' \ | |
791 | 'true=1']], | |
792 | [[true=1]]) | |
793 | ||
99155935 | 794 | OVSDB_CHECK_POSITIVE_CPY([JSON map of 1 uuid to real], |
31a763d7 | 795 | [[parse-data '{"key": "uuid", "value": "real", "min": 1, "max": 5}' \ |
f85f8ebb | 796 | '["map", [[["uuid", "cad8542b-6ee1-486b-971b-7dcbf6e14979"], 1.0], |
a711c317 AZ |
797 | [["uuid", "6b94b968-2702-4f64-9457-314a34d69b8c"], 2.0], |
798 | [["uuid", "d2c4a168-24de-47eb-a8a3-c1abfc814979"], 3.0], | |
799 | [["uuid", "25bfa475-d072-4f60-8be1-00f48643e9cb"], 4.0], | |
800 | [["uuid", "1c92b8ca-d5e4-4628-a85d-1dc2d099a99a"], 5.0]]]']], | |
f85f8ebb BP |
801 | [[["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]]]]]) |
802 | ||
5c414a2e BP |
803 | OVSDB_CHECK_POSITIVE([string map of 1 uuid to real], |
804 | [[parse-data-strings '{"key": "uuid", "value": "real", "min": 1, "max": 5}' \ | |
805 | 'cad8542b-6ee1-486b-971b-7dcbf6e14979=1.0, | |
806 | 6b94b968-2702-4f64-9457-314a34d69b8c=2.0, | |
807 | d2c4a168-24de-47eb-a8a3-c1abfc814979=3.0, | |
808 | 25bfa475-d072-4f60-8be1-00f48643e9cb=4.0, | |
809 | 1c92b8ca-d5e4-4628-a85d-1dc2d099a99a=5.0']], | |
810 | [[{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}]]) | |
811 | ||
99155935 | 812 | OVSDB_CHECK_POSITIVE_CPY([JSON map of 10 string to string], |
31a763d7 | 813 | [[parse-data '{"key": "string", "value": "string", "min": 1, "max": 10}' \ |
f85f8ebb | 814 | '["map", [["2 gills", "1 chopin"], |
a711c317 AZ |
815 | ["2 chopins", "1 pint"], |
816 | ["2 pints", "1 quart"], | |
817 | ["2 quarts", "1 pottle"], | |
818 | ["2 pottles", "1 gallon"], | |
819 | ["2 gallons", "1 peck"], | |
820 | ["2 pecks", "1 demibushel"], | |
821 | ["2 demibushel", "1 firkin"], | |
822 | ["2 firkins", "1 kilderkin"], | |
823 | ["2 kilderkins", "1 barrel"]]]']], | |
f85f8ebb BP |
824 | [[["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"]]]]]) |
825 | ||
5c414a2e BP |
826 | OVSDB_CHECK_POSITIVE([string map of 10 string to string], |
827 | [[parse-data-strings '{"key": "string", "value": "string", "min": 1, "max": 10}' \ | |
828 | '{"2 gills"="1 chopin", | |
829 | "2 chopins"= "1 pint", | |
830 | "2 pints"= "1 quart", | |
831 | "2 quarts"= "1 pottle", | |
832 | "2 pottles"= "1 gallon", | |
833 | "2 gallons"= "1 peck", | |
834 | "2 pecks"= "1 demibushel", | |
835 | "2 demibushel"= "1 firkin", | |
836 | "2 firkins"= "1 kilderkin", | |
837 | "2 kilderkins"= "1 barrel"}']], | |
838 | [[{"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"}]]) | |
839 | ||
99155935 | 840 | OVSDB_CHECK_NEGATIVE_CPY([duplicate integer key not allowed in JSON map], |
f85f8ebb BP |
841 | [[parse-data '{"key": "integer", "value": "boolean", "max": 5}' \ |
842 | '["map", [[1, true], [2, false], [1, false]]]']], | |
843 | [ovsdb error: map contains duplicate key]) | |
5c414a2e BP |
844 | |
845 | OVSDB_CHECK_NEGATIVE([duplicate integer key not allowed in string map], | |
846 | [[parse-data-strings '{"key": "integer", "value": "boolean", "max": 5}' \ | |
847 | '1=true 2=false 1=false']], | |
848 | [map contains duplicate key]) | |
1a6f1cef AZ |
849 | |
850 | OVSDB_CHECK_POSITIVE([generate and apply diff -- integer], | |
851 | [[diff-data '["integer"]' '[0]' '[2]']], | |
852 | [[diff: 2 | |
853 | apply diff: 2 | |
854 | OK]]) | |
855 | ||
856 | OVSDB_CHECK_POSITIVE([generate and apply diff -- boolean], | |
857 | [[diff-data '["boolean"]' '[true]' '[false]']], | |
858 | [[diff: false | |
859 | apply diff: false | |
860 | OK]]) | |
861 | ||
862 | OVSDB_CHECK_POSITIVE([generate and apply diff -- string], | |
863 | [[diff-data '["string"]' '["AAA"]' '["BBB"]']], | |
864 | [[diff: "BBB" | |
865 | apply diff: "BBB" | |
866 | OK]]) | |
867 | ||
868 | dnl Test set modifications. | |
869 | OVSDB_CHECK_POSITIVE([generate and apply diff -- set], | |
870 | [[diff-data '{"key": "integer", "min":0, "max": 3}' \ | |
871 | '["set", [0, 1]]' '["set", [1,2]]' \ | |
872 | '["set", [0, 1]]' '["set", [1]]' \ | |
873 | '["set", []]' '["set", [0, 1]]' \ | |
874 | '["set", [0, 1]]' '["set", []]' | |
875 | ]], | |
876 | [[diff: ["set",[0,2]] | |
877 | apply diff: ["set",[1,2]] | |
878 | OK | |
879 | diff: 0 | |
880 | apply diff: 1 | |
881 | OK | |
882 | diff: ["set",[0,1]] | |
883 | apply diff: ["set",[0,1]] | |
884 | OK | |
885 | diff: ["set",[0,1]] | |
886 | apply diff: ["set",[]] | |
887 | OK]]) | |
888 | ||
889 | dnl Test set modifications causes data to violate set size constrain. | |
890 | OVSDB_CHECK_NEGATIVE([generate and apply diff -- set -- size error], | |
891 | [[diff-data '{"key": "integer", "min":0, "max": 3}' \ | |
892 | '["set", [0, 1]]' '["set", [1, 2, 3, 4]]']], | |
893 | [[ovsdb error: Datum crated by diff has size error]]) | |
894 | ||
895 | dnl Test set modifications. | |
896 | OVSDB_CHECK_POSITIVE([generate and apply diff -- map], | |
897 | [[diff-data '{"key": "string", "value": "string", "min":0, "max": 3}' \ | |
898 | '["map", [["2 gills", "1 chopin"]]]' '["map", [["2 pints", "1 quart"]]]' \ | |
899 | '["map", [["2 gills", "1 chopin"]]]' '["map", [["2 gills", "1 chopin"]]]' \ | |
900 | '["map", [["2 gills", "1 chopin"]]]' '["map", []]' \ | |
901 | '["map", []]' '["map", [["2 pints", "1 quart"]]]' \ | |
902 | '["map", [["2 gills", "1 chopin"]]]' '["map", [["2 gills", "1 gallon"]]]' \ | |
903 | ]], | |
904 | [[diff: ["map",[["2 gills","1 chopin"],["2 pints","1 quart"]]] | |
905 | apply diff: ["map",[["2 pints","1 quart"]]] | |
906 | OK | |
907 | diff: ["map",[]] | |
908 | apply diff: ["map",[["2 gills","1 chopin"]]] | |
909 | OK | |
910 | diff: ["map",[["2 gills","1 chopin"]]] | |
911 | apply diff: ["map",[]] | |
912 | OK | |
913 | diff: ["map",[["2 pints","1 quart"]]] | |
914 | apply diff: ["map",[["2 pints","1 quart"]]] | |
915 | OK | |
916 | diff: ["map",[["2 gills","1 gallon"]]] | |
917 | apply diff: ["map",[["2 gills","1 gallon"]]] | |
918 | OK]]) | |
919 | ||
920 | OVSDB_CHECK_NEGATIVE([generate and apply diff with map -- size error], | |
921 | [[diff-data '{"key": "string", "value": "string", "min":0, "max": 3}' \ | |
922 | '["map", [["2 gills", "1 chopin"]]]' \ | |
923 | '["map", [["2 gills", "1 gallon"], | |
924 | ["2 pints", "1 quart"], | |
925 | ["2 quarts", "1 pottle"], | |
926 | ["2 gallons", "1 peck"]]]' \ | |
927 | ]], | |
928 | [[ovsdb error: Datum crated by diff has size error]]) |