]>
Commit | Line | Data |
---|---|---|
e9f8f936 BP |
1 | AT_BANNER([OVSDB -- mutations]) |
2 | ||
3 | OVSDB_CHECK_POSITIVE([null mutation], | |
4 | [[parse-mutations \ | |
5 | '{"columns": {"name": {"type": "string"}}}' \ | |
6 | '[]']], | |
7 | [[[]]]) | |
8 | ||
9 | OVSDB_CHECK_POSITIVE([mutations on scalars], | |
10 | [[parse-mutations \ | |
11 | '{"columns": | |
12 | {"i": {"type": "integer"}, | |
13 | "r": {"type": "real"}, | |
14 | "b": {"type": "boolean"}, | |
15 | "s": {"type": "string"}, | |
16 | "u": {"type": "uuid"}}}' \ | |
17 | '[["i", "+=", 0]]' \ | |
18 | '[["i", "-=", 1]]' \ | |
19 | '[["i", "*=", 2]]' \ | |
20 | '[["i", "/=", 3]]' \ | |
21 | '[["i", "%=", 4]]' \ | |
22 | '[["r", "+=", 0.5]]' \ | |
23 | '[["r", "-=", 1.5]]' \ | |
24 | '[["r", "*=", 2.5]]' \ | |
25 | '[["r", "/=", 3.5]]']], | |
26 | [[[["i","+=",0]] | |
27 | [["i","-=",1]] | |
28 | [["i","*=",2]] | |
29 | [["i","/=",3]] | |
30 | [["i","%=",4]] | |
31 | [["r","+=",0.5]] | |
32 | [["r","-=",1.5]] | |
33 | [["r","*=",2.5]] | |
34 | [["r","/=",3.5]]]], | |
35 | [mutation]) | |
36 | ||
37 | AT_SETUP([disallowed mutations on scalars]) | |
38 | AT_KEYWORDS([ovsdb negative mutation]) | |
7c126fbb | 39 | AT_CHECK([[test-ovsdb parse-mutations \ |
e9f8f936 BP |
40 | '{"columns": |
41 | {"i": {"type": "integer"}, | |
42 | "r": {"type": "real"}, | |
43 | "b": {"type": "boolean"}, | |
44 | "s": {"type": "string"}, | |
45 | "u": {"type": "uuid"}}}' \ | |
46 | '[["i", "xxx", 1]]' \ | |
47 | '[["i", "insert", 1]]' \ | |
48 | '[["i", "delete", 2]]' \ | |
49 | '[["r", "%=", 0.5]]' \ | |
50 | '[["r", "insert", 1.5]]' \ | |
51 | '[["r", "delete", 2.5]]' \ | |
52 | '[["b", "+=", true]]' \ | |
53 | '[["b", "-=", false]]' \ | |
54 | '[["b", "*=", true]]' \ | |
55 | '[["b", "/=", false]]' \ | |
56 | '[["b", "%=", true]]' \ | |
57 | '[["b", "insert", false]]' \ | |
58 | '[["b", "delete", true]]' \ | |
59 | '[["s", "+=", "a"]]' \ | |
60 | '[["s", "-=", "b"]]' \ | |
61 | '[["s", "*=", "c"]]' \ | |
62 | '[["s", "/=", "d"]]' \ | |
63 | '[["s", "%=", "e"]]' \ | |
64 | '[["s", "insert", "f"]]' \ | |
65 | '[["s", "delete", "g"]]' \ | |
66 | '[["u", "+=", ["uuid", "9179ca6d-6d65-400a-b455-3ad92783a099"]]]' \ | |
67 | '[["u", "-=", ["uuid", "9179ca6d-6d65-400a-b455-3ad92783a099"]]]' \ | |
68 | '[["u", "*=", ["uuid", "9179ca6d-6d65-400a-b455-3ad92783a099"]]]' \ | |
69 | '[["u", "/=", ["uuid", "9179ca6d-6d65-400a-b455-3ad92783a099"]]]' \ | |
70 | '[["u", "insert", ["uuid", "9179ca6d-6d65-400a-b455-3ad92783a099"]]]' \ | |
71 | '[["u", "delete", ["uuid", "9179ca6d-6d65-400a-b455-3ad92783a099"]]]']], | |
72 | [1], [], | |
73 | [[test-ovsdb: unknown mutator: No mutator named xxx. | |
74 | test-ovsdb: syntax "["i","insert",1]": syntax error: Type mismatch: "insert" operator may not be applied to column i of type integer. | |
75 | test-ovsdb: syntax "["i","delete",2]": syntax error: Type mismatch: "delete" operator may not be applied to column i of type integer. | |
76 | test-ovsdb: syntax "["r","%=",0.5]": syntax error: Type mismatch: "%=" operator may not be applied to column r of type real. | |
77 | test-ovsdb: syntax "["r","insert",1.5]": syntax error: Type mismatch: "insert" operator may not be applied to column r of type real. | |
78 | test-ovsdb: syntax "["r","delete",2.5]": syntax error: Type mismatch: "delete" operator may not be applied to column r of type real. | |
79 | test-ovsdb: syntax "["b","+=",true]": syntax error: Type mismatch: "+=" operator may not be applied to column b of type boolean. | |
80 | test-ovsdb: syntax "["b","-=",false]": syntax error: Type mismatch: "-=" operator may not be applied to column b of type boolean. | |
81 | test-ovsdb: syntax "["b","*=",true]": syntax error: Type mismatch: "*=" operator may not be applied to column b of type boolean. | |
82 | test-ovsdb: syntax "["b","/=",false]": syntax error: Type mismatch: "/=" operator may not be applied to column b of type boolean. | |
83 | test-ovsdb: syntax "["b","%=",true]": syntax error: Type mismatch: "%=" operator may not be applied to column b of type boolean. | |
84 | test-ovsdb: syntax "["b","insert",false]": syntax error: Type mismatch: "insert" operator may not be applied to column b of type boolean. | |
85 | test-ovsdb: syntax "["b","delete",true]": syntax error: Type mismatch: "delete" operator may not be applied to column b of type boolean. | |
86 | test-ovsdb: syntax "["s","+=","a"]": syntax error: Type mismatch: "+=" operator may not be applied to column s of type string. | |
87 | test-ovsdb: syntax "["s","-=","b"]": syntax error: Type mismatch: "-=" operator may not be applied to column s of type string. | |
88 | test-ovsdb: syntax "["s","*=","c"]": syntax error: Type mismatch: "*=" operator may not be applied to column s of type string. | |
89 | test-ovsdb: syntax "["s","/=","d"]": syntax error: Type mismatch: "/=" operator may not be applied to column s of type string. | |
90 | test-ovsdb: syntax "["s","%=","e"]": syntax error: Type mismatch: "%=" operator may not be applied to column s of type string. | |
91 | test-ovsdb: syntax "["s","insert","f"]": syntax error: Type mismatch: "insert" operator may not be applied to column s of type string. | |
92 | test-ovsdb: syntax "["s","delete","g"]": syntax error: Type mismatch: "delete" operator may not be applied to column s of type string. | |
93 | test-ovsdb: syntax "["u","+=",["uuid","9179ca6d-6d65-400a-b455-3ad92783a099"]]": syntax error: Type mismatch: "+=" operator may not be applied to column u of type uuid. | |
94 | test-ovsdb: syntax "["u","-=",["uuid","9179ca6d-6d65-400a-b455-3ad92783a099"]]": syntax error: Type mismatch: "-=" operator may not be applied to column u of type uuid. | |
95 | test-ovsdb: syntax "["u","*=",["uuid","9179ca6d-6d65-400a-b455-3ad92783a099"]]": syntax error: Type mismatch: "*=" operator may not be applied to column u of type uuid. | |
96 | test-ovsdb: syntax "["u","/=",["uuid","9179ca6d-6d65-400a-b455-3ad92783a099"]]": syntax error: Type mismatch: "/=" operator may not be applied to column u of type uuid. | |
97 | test-ovsdb: syntax "["u","insert",["uuid","9179ca6d-6d65-400a-b455-3ad92783a099"]]": syntax error: Type mismatch: "insert" operator may not be applied to column u of type uuid. | |
98 | test-ovsdb: syntax "["u","delete",["uuid","9179ca6d-6d65-400a-b455-3ad92783a099"]]": syntax error: Type mismatch: "delete" operator may not be applied to column u of type uuid. | |
99 | ]]) | |
100 | AT_CLEANUP | |
101 | ||
341c4e59 BP |
102 | AT_SETUP([disallowed mutations on immutable columns]) |
103 | AT_KEYWORDS([ovsdb negative mutation]) | |
104 | AT_CHECK([[test-ovsdb parse-mutations \ | |
105 | '{"columns": | |
106 | {"i": {"type": "integer", "mutable": false}}}' \ | |
107 | '[["i", "+=", 1]]' | |
108 | ]], | |
109 | [1], [], | |
110 | [[test-ovsdb: syntax "["i","+=",1]": constraint violation: Cannot mutate immutable column i in table mytable. | |
111 | ]]) | |
112 | AT_CLEANUP | |
113 | ||
e9f8f936 BP |
114 | OVSDB_CHECK_POSITIVE([mutations on sets], |
115 | [[parse-mutations \ | |
116 | '{"columns": | |
117 | {"i": {"type": {"key": "integer", "min": 0, "max": "unlimited"}}, | |
118 | "r": {"type": {"key": "real", "min": 0, "max": "unlimited"}}, | |
119 | "b": {"type": {"key": "boolean", "min": 0, "max": "unlimited"}}, | |
120 | "s": {"type": {"key": "string", "min": 0, "max": "unlimited"}}, | |
121 | "u": {"type": {"key": "uuid", "min": 0, "max": "unlimited"}}}}' \ | |
122 | '[["i", "+=", 1]]' \ | |
123 | '[["i", "-=", 2]]' \ | |
124 | '[["i", "*=", 3]]' \ | |
125 | '[["i", "/=", 4]]' \ | |
126 | '[["i", "%=", 5]]' \ | |
127 | '[["i", "insert", ["set", [1, 2]]]]' \ | |
128 | '[["i", "delete", ["set", [1, 2, 3]]]]' \ | |
129 | '[["r", "+=", 1]]' \ | |
130 | '[["r", "-=", 2]]' \ | |
131 | '[["r", "*=", 3]]' \ | |
132 | '[["r", "/=", 4]]' \ | |
133 | '[["r", "insert", ["set", [1, 2]]]]' \ | |
134 | '[["r", "delete", ["set", [1, 2, 3]]]]' \ | |
135 | '[["b", "insert", ["set", [true]]]]' \ | |
136 | '[["b", "delete", ["set", [false]]]]' \ | |
137 | '[["s", "insert", ["set", ["a"]]]]' \ | |
138 | '[["s", "delete", ["set", ["a", "b"]]]]' \ | |
139 | '[["u", "insert", | |
140 | ["set", [["uuid", "b10d28f7-af18-4a67-9e78-2a6394516c59"]]]]]' \ | |
141 | '[["u", "delete", | |
142 | ["set", [["uuid", "b10d28f7-af18-4a67-9e78-2a6394516c59"], | |
143 | ["uuid", "9179ca6d-6d65-400a-b455-3ad92783a099"]]]]]' \ | |
144 | ]], | |
145 | [[[["i","+=",1]] | |
146 | [["i","-=",2]] | |
147 | [["i","*=",3]] | |
148 | [["i","/=",4]] | |
149 | [["i","%=",5]] | |
150 | [["i","insert",["set",[1,2]]]] | |
151 | [["i","delete",["set",[1,2,3]]]] | |
152 | [["r","+=",1]] | |
153 | [["r","-=",2]] | |
154 | [["r","*=",3]] | |
155 | [["r","/=",4]] | |
156 | [["r","insert",["set",[1,2]]]] | |
157 | [["r","delete",["set",[1,2,3]]]] | |
ae8f13e2 BP |
158 | [["b","insert",true]] |
159 | [["b","delete",false]] | |
160 | [["s","insert","a"]] | |
e9f8f936 | 161 | [["s","delete",["set",["a","b"]]]] |
ae8f13e2 | 162 | [["u","insert",["uuid","b10d28f7-af18-4a67-9e78-2a6394516c59"]]] |
e9f8f936 BP |
163 | [["u","delete",["set",[["uuid","9179ca6d-6d65-400a-b455-3ad92783a099"],["uuid","b10d28f7-af18-4a67-9e78-2a6394516c59"]]]]]]], |
164 | [mutation]) | |
165 | ||
166 | OVSDB_CHECK_POSITIVE([executing null mutation], | |
167 | [[execute-mutations \ | |
168 | '{"columns": {"i": {"type": "integer"}}}' \ | |
169 | '[[]]' \ | |
170 | '[{"i": 0}, | |
171 | {"i": 1}, | |
172 | {"i": 2}']]], | |
173 | [mutation 0: | |
174 | row 0: no change | |
175 | row 1: no change | |
176 | row 2: no change | |
177 | ]) | |
178 | ||
179 | OVSDB_CHECK_POSITIVE([executing mutations on integers], | |
180 | [[execute-mutations \ | |
181 | '{"columns": {"i": {"type": "integer"}}}' \ | |
182 | '[[["i", "+=", 1]], | |
183 | [["i", "-=", 2]], | |
184 | [["i", "*=", 3]], | |
185 | [["i", "/=", 4]], | |
186 | [["i", "%=", 2]]]' \ | |
187 | '[{"i": 0}, | |
188 | {"i": 1}, | |
189 | {"i": 2}']]], | |
190 | [mutation 0: | |
191 | row 0: {"i":1} | |
192 | row 1: {"i":2} | |
193 | row 2: {"i":3} | |
194 | ||
195 | mutation 1: | |
196 | row 0: {"i":-2} | |
197 | row 1: {"i":-1} | |
198 | row 2: {"i":0} | |
199 | ||
200 | mutation 2: | |
201 | row 0: no change | |
202 | row 1: {"i":3} | |
203 | row 2: {"i":6} | |
204 | ||
205 | mutation 3: | |
206 | row 0: no change | |
207 | row 1: {"i":0} | |
208 | row 2: {"i":0} | |
209 | ||
210 | mutation 4: | |
211 | row 0: no change | |
212 | row 1: no change | |
213 | row 2: {"i":0} | |
214 | ], [mutation]) | |
215 | ||
216 | OVSDB_CHECK_POSITIVE([integer overflow detection], | |
217 | [[execute-mutations \ | |
218 | '{"columns": {"i": {"type": "integer"}}}' \ | |
219 | '[[["i", "+=", 9223372036854775807]], | |
220 | [["i", "+=", -9223372036854775808]], | |
221 | [["i", "-=", -9223372036854775808]], | |
222 | [["i", "-=", 9223372036854775807]], | |
223 | [["i", "*=", 3037000500]], | |
224 | [["i", "/=", -1]], | |
225 | [["i", "/=", 0]]]' \ | |
226 | '[{"i": 0}, | |
227 | {"i": 1}, | |
228 | {"i": -1}, | |
229 | {"i": 9223372036854775807}, | |
230 | {"i": -9223372036854775808}, | |
231 | {"i": 3037000500}, | |
232 | {"i": -3037000500}']]], | |
233 | [mutation 0: | |
234 | row 0: {"i":9223372036854775807} | |
235 | row 1: range error: Result of "+=" operation is out of range. | |
236 | row 2: {"i":9223372036854775806} | |
237 | row 3: range error: Result of "+=" operation is out of range. | |
238 | row 4: {"i":-1} | |
239 | row 5: range error: Result of "+=" operation is out of range. | |
240 | row 6: {"i":9223372033817775307} | |
241 | ||
242 | mutation 1: | |
243 | row 0: {"i":-9223372036854775808} | |
244 | row 1: {"i":-9223372036854775807} | |
245 | row 2: range error: Result of "+=" operation is out of range. | |
246 | row 3: {"i":-1} | |
247 | row 4: range error: Result of "+=" operation is out of range. | |
248 | row 5: {"i":-9223372033817775308} | |
249 | row 6: range error: Result of "+=" operation is out of range. | |
250 | ||
251 | mutation 2: | |
252 | row 0: range error: Result of "-=" operation is out of range. | |
253 | row 1: range error: Result of "-=" operation is out of range. | |
254 | row 2: {"i":9223372036854775807} | |
255 | row 3: range error: Result of "-=" operation is out of range. | |
256 | row 4: {"i":0} | |
257 | row 5: range error: Result of "-=" operation is out of range. | |
258 | row 6: {"i":9223372033817775308} | |
259 | ||
260 | mutation 3: | |
261 | row 0: {"i":-9223372036854775807} | |
262 | row 1: {"i":-9223372036854775806} | |
263 | row 2: {"i":-9223372036854775808} | |
264 | row 3: {"i":0} | |
265 | row 4: range error: Result of "-=" operation is out of range. | |
266 | row 5: {"i":-9223372033817775307} | |
267 | row 6: range error: Result of "-=" operation is out of range. | |
268 | ||
269 | mutation 4: | |
270 | row 0: no change | |
271 | row 1: {"i":3037000500} | |
272 | row 2: {"i":-3037000500} | |
273 | row 3: range error: Result of "*=" operation is out of range. | |
274 | row 4: range error: Result of "*=" operation is out of range. | |
275 | row 5: range error: Result of "*=" operation is out of range. | |
276 | row 6: range error: Result of "*=" operation is out of range. | |
277 | ||
278 | mutation 5: | |
279 | row 0: no change | |
280 | row 1: {"i":-1} | |
281 | row 2: {"i":1} | |
282 | row 3: {"i":-9223372036854775807} | |
283 | row 4: range error: Result of "/=" operation is out of range. | |
284 | row 5: {"i":-3037000500} | |
285 | row 6: {"i":3037000500} | |
286 | ||
287 | mutation 6: | |
288 | row 0: domain error: Division by zero. | |
289 | row 1: domain error: Division by zero. | |
290 | row 2: domain error: Division by zero. | |
291 | row 3: domain error: Division by zero. | |
292 | row 4: domain error: Division by zero. | |
293 | row 5: domain error: Division by zero. | |
294 | row 6: domain error: Division by zero. | |
295 | ], [mutation]) | |
296 | ||
bd76d25d BP |
297 | OVSDB_CHECK_POSITIVE([executing mutations on integers with constraints], |
298 | [[execute-mutations \ | |
299 | '{"columns": {"i": {"type": {"key": {"type": "integer", | |
300 | "minInteger": 0, | |
301 | "maxInteger": 2}}}}}' \ | |
302 | '[[["i", "+=", 1]], | |
303 | [["i", "-=", 2]], | |
304 | [["i", "*=", 3]], | |
305 | [["i", "/=", 4]], | |
306 | [["i", "%=", 2]]]' \ | |
307 | '[{"i": 0}, | |
308 | {"i": 1}, | |
309 | {"i": 2}']]], | |
310 | [mutation 0: | |
311 | row 0: {"i":1} | |
312 | row 1: {"i":2} | |
313 | row 2: constraint violation: 3 is not in the valid range 0 to 2 (inclusive) | |
314 | ||
315 | mutation 1: | |
316 | row 0: constraint violation: -2 is not in the valid range 0 to 2 (inclusive) | |
317 | row 1: constraint violation: -1 is not in the valid range 0 to 2 (inclusive) | |
318 | row 2: {"i":0} | |
319 | ||
320 | mutation 2: | |
321 | row 0: no change | |
322 | row 1: constraint violation: 3 is not in the valid range 0 to 2 (inclusive) | |
323 | row 2: constraint violation: 6 is not in the valid range 0 to 2 (inclusive) | |
324 | ||
325 | mutation 3: | |
326 | row 0: no change | |
327 | row 1: {"i":0} | |
328 | row 2: {"i":0} | |
329 | ||
330 | mutation 4: | |
331 | row 0: no change | |
332 | row 1: no change | |
333 | row 2: {"i":0} | |
334 | ], [mutation]) | |
335 | ||
e9f8f936 BP |
336 | OVSDB_CHECK_POSITIVE([executing mutations on reals], |
337 | [[execute-mutations \ | |
338 | '{"columns": {"r": {"type": "real"}}}' \ | |
339 | '[[["r", "+=", 0.5]], | |
340 | [["r", "-=", 1.5]], | |
341 | [["r", "*=", 2.5]], | |
342 | [["r", "/=", 4]]]' \ | |
343 | '[{"r": 0}, | |
344 | {"r": -2.5}, | |
345 | {"r": 1.25}']]], | |
346 | [mutation 0: | |
347 | row 0: {"r":0.5} | |
348 | row 1: {"r":-2} | |
349 | row 2: {"r":1.75} | |
350 | ||
351 | mutation 1: | |
352 | row 0: {"r":-1.5} | |
353 | row 1: {"r":-4} | |
354 | row 2: {"r":-0.25} | |
355 | ||
356 | mutation 2: | |
357 | row 0: no change | |
358 | row 1: {"r":-6.25} | |
359 | row 2: {"r":3.125} | |
360 | ||
361 | mutation 3: | |
362 | row 0: no change | |
363 | row 1: {"r":-0.625} | |
364 | row 2: {"r":0.3125} | |
365 | ], [mutation]) | |
366 | ||
367 | OVSDB_CHECK_POSITIVE([real overflow detection], | |
368 | [[execute-mutations \ | |
369 | '{"columns": {"r": {"type": "real"}}}' \ | |
370 | '[[["r", "+=", 1.7976931348623157e+308]], | |
371 | [["r", "-=", 1.7976931348623157e+308]], | |
372 | [["r", "*=", 2]], | |
373 | [["r", "/=", 4]], | |
374 | [["r", "/=", 0.5]], | |
375 | [["r", "/=", 0]]]' \ | |
376 | '[{"r": 0}, | |
377 | {"r": 1.7976931348623157e+308}, | |
378 | {"r": -1.7976931348623157e+308}']]], | |
379 | [mutation 0: | |
380 | row 0: {"r":1.79769313486232e+308} | |
381 | row 1: range error: Result of "+=" operation is out of range. | |
382 | row 2: {"r":0} | |
383 | ||
384 | mutation 1: | |
385 | row 0: {"r":-1.79769313486232e+308} | |
386 | row 1: {"r":0} | |
387 | row 2: range error: Result of "-=" operation is out of range. | |
388 | ||
389 | mutation 2: | |
390 | row 0: no change | |
391 | row 1: range error: Result of "*=" operation is out of range. | |
392 | row 2: range error: Result of "*=" operation is out of range. | |
393 | ||
394 | mutation 3: | |
395 | row 0: no change | |
396 | row 1: {"r":4.49423283715579e+307} | |
397 | row 2: {"r":-4.49423283715579e+307} | |
398 | ||
399 | mutation 4: | |
400 | row 0: no change | |
401 | row 1: range error: Result of "/=" operation is out of range. | |
402 | row 2: range error: Result of "/=" operation is out of range. | |
403 | ||
404 | mutation 5: | |
405 | row 0: domain error: Division by zero. | |
406 | row 1: domain error: Division by zero. | |
407 | row 2: domain error: Division by zero. | |
408 | ], [mutation]) | |
409 | ||
bd76d25d BP |
410 | OVSDB_CHECK_POSITIVE([executing mutations on reals with constraints], |
411 | [[execute-mutations \ | |
412 | '{"columns": {"r": {"type": {"key": {"type": "real", | |
413 | "minReal": -2.5, | |
414 | "maxReal": 1.75}}}}}' \ | |
415 | '[[["r", "+=", 0.5]], | |
416 | [["r", "-=", 1.5]], | |
417 | [["r", "*=", 2.5]], | |
418 | [["r", "/=", 4]]]' \ | |
419 | '[{"r": 0}, | |
420 | {"r": -2.5}, | |
421 | {"r": 1.25}']]], | |
422 | [mutation 0: | |
423 | row 0: {"r":0.5} | |
424 | row 1: {"r":-2} | |
425 | row 2: {"r":1.75} | |
426 | ||
427 | mutation 1: | |
428 | row 0: {"r":-1.5} | |
429 | row 1: constraint violation: -4 is not in the valid range -2.5 to 1.75 (inclusive) | |
430 | row 2: {"r":-0.25} | |
431 | ||
432 | mutation 2: | |
433 | row 0: no change | |
434 | row 1: constraint violation: -6.25 is not in the valid range -2.5 to 1.75 (inclusive) | |
435 | row 2: constraint violation: 3.125 is not in the valid range -2.5 to 1.75 (inclusive) | |
436 | ||
437 | mutation 3: | |
438 | row 0: no change | |
439 | row 1: {"r":-0.625} | |
440 | row 2: {"r":0.3125} | |
441 | ], [mutation]) | |
442 | ||
e9f8f936 BP |
443 | OVSDB_CHECK_POSITIVE([executing mutations on integer sets], |
444 | [[execute-mutations \ | |
bd76d25d BP |
445 | '{"columns": {"i": {"type": {"key": {"type": "integer", |
446 | "maxInteger": 5}, | |
447 | "min": 0, | |
448 | "max": "unlimited"}}}}' \ | |
e9f8f936 BP |
449 | '[[["i", "+=", 1]], |
450 | [["i", "-=", 2]], | |
451 | [["i", "*=", 3]], | |
452 | [["i", "/=", 4]], | |
453 | [["i", "%=", 2]], | |
454 | [["i", "insert", ["set", [1]]]], | |
455 | [["i", "insert", ["set", [2, 3]]]], | |
456 | [["i", "delete", ["set", [1]]]], | |
457 | [["i", "delete", ["set", [2, 3]]]]]' \ | |
458 | '[{"i": ["set", []]}, | |
459 | {"i": ["set", [0]]}, | |
460 | {"i": ["set", [0, 1]]}, | |
461 | {"i": ["set", [0, 1, 2]]}']]], | |
462 | [[mutation 0: | |
463 | row 0: no change | |
ae8f13e2 | 464 | row 1: {"i":1} |
e9f8f936 BP |
465 | row 2: {"i":["set",[1,2]]} |
466 | row 3: {"i":["set",[1,2,3]]} | |
467 | ||
468 | mutation 1: | |
469 | row 0: no change | |
ae8f13e2 | 470 | row 1: {"i":-2} |
e9f8f936 BP |
471 | row 2: {"i":["set",[-2,-1]]} |
472 | row 3: {"i":["set",[-2,-1,0]]} | |
473 | ||
474 | mutation 2: | |
475 | row 0: no change | |
476 | row 1: no change | |
477 | row 2: {"i":["set",[0,3]]} | |
bd76d25d | 478 | row 3: constraint violation: 6 is greater than maximum allowed value 5 |
e9f8f936 BP |
479 | |
480 | mutation 3: | |
481 | row 0: no change | |
482 | row 1: no change | |
483 | row 2: constraint violation: Result of "/=" operation contains duplicates. | |
484 | row 3: constraint violation: Result of "/=" operation contains duplicates. | |
485 | ||
486 | mutation 4: | |
487 | row 0: no change | |
488 | row 1: no change | |
489 | row 2: no change | |
490 | row 3: constraint violation: Result of "%=" operation contains duplicates. | |
491 | ||
492 | mutation 5: | |
ae8f13e2 | 493 | row 0: {"i":1} |
e9f8f936 BP |
494 | row 1: {"i":["set",[0,1]]} |
495 | row 2: no change | |
496 | row 3: no change | |
497 | ||
498 | mutation 6: | |
499 | row 0: {"i":["set",[2,3]]} | |
500 | row 1: {"i":["set",[0,2,3]]} | |
501 | row 2: {"i":["set",[0,1,2,3]]} | |
502 | row 3: {"i":["set",[0,1,2,3]]} | |
503 | ||
504 | mutation 7: | |
505 | row 0: no change | |
506 | row 1: no change | |
ae8f13e2 | 507 | row 2: {"i":0} |
e9f8f936 BP |
508 | row 3: {"i":["set",[0,2]]} |
509 | ||
510 | mutation 8: | |
511 | row 0: no change | |
512 | row 1: no change | |
513 | row 2: no change | |
514 | row 3: {"i":["set",[0,1]]} | |
515 | ]], [mutation]) | |
516 | ||
dd089894 BP |
517 | OVSDB_CHECK_POSITIVE([executing mutations on integer sets with constraints], |
518 | [[execute-mutations \ | |
519 | '{"columns": {"i": {"type": {"key": "integer", | |
520 | "min": 1, | |
521 | "max": 2}}}}' \ | |
522 | '[[["i", "insert", ["set", [1]]]], | |
523 | [["i", "insert", ["set", [2]]]], | |
524 | [["i", "delete", ["set", [1]]]], | |
525 | [["i", "delete", ["set", [2]]]], | |
526 | [["i", "delete", ["set", [0, 1]]]]]' \ | |
527 | '[{"i": ["set", [0]]}, | |
528 | {"i": ["set", [2]]}, | |
529 | {"i": ["set", [0, 1]]}']]], | |
530 | [[mutation 0: | |
531 | row 0: {"i":["set",[0,1]]} | |
532 | row 1: {"i":["set",[1,2]]} | |
533 | row 2: no change | |
534 | ||
535 | mutation 1: | |
536 | row 0: {"i":["set",[0,2]]} | |
537 | row 1: no change | |
538 | row 2: constraint violation: Attempted to store 3 elements in set of 1 to 2 integers. | |
539 | ||
540 | mutation 2: | |
541 | row 0: no change | |
542 | row 1: no change | |
543 | row 2: {"i":0} | |
544 | ||
545 | mutation 3: | |
546 | row 0: no change | |
547 | row 1: constraint violation: Attempted to store 0 elements in set of 1 to 2 integers. | |
548 | row 2: no change | |
549 | ||
550 | mutation 4: | |
551 | row 0: constraint violation: Attempted to store 0 elements in set of 1 to 2 integers. | |
552 | row 1: no change | |
553 | row 2: constraint violation: Attempted to store 0 elements in set of 1 to 2 integers. | |
554 | ]], [mutation]) | |
555 | ||
e9f8f936 BP |
556 | OVSDB_CHECK_POSITIVE([executing mutations on real sets], |
557 | [[execute-mutations \ | |
bd76d25d BP |
558 | '{"columns": {"r": {"type": {"key": {"type": "real", |
559 | "maxReal": 6}, | |
560 | "min": 0, "max": "unlimited"}}}}' \ | |
e9f8f936 BP |
561 | '[[["r", "+=", 0.5]], |
562 | [["r", "-=", 1.5]], | |
563 | [["r", "*=", 2.5]], | |
564 | [["r", "/=", 4]], | |
565 | [["r", "*=", 0]], | |
ae8f13e2 BP |
566 | [["r", "insert", 1.5]], |
567 | [["r", "insert", 3]], | |
e9f8f936 BP |
568 | [["r", "delete", ["set", [1.5, 3.5]]]], |
569 | [["r", "delete", ["set", [0.5, 1.5, 2.5]]]]]' \ | |
570 | '[{"r": ["set", []]}, | |
ae8f13e2 | 571 | {"r": 0.5}, |
e9f8f936 BP |
572 | {"r": ["set", [0.5, 1.5]]}, |
573 | {"r": ["set", [0.5, 1.5, 2.5]]}']]], | |
574 | [[mutation 0: | |
575 | row 0: no change | |
ae8f13e2 | 576 | row 1: {"r":1} |
e9f8f936 BP |
577 | row 2: {"r":["set",[1,2]]} |
578 | row 3: {"r":["set",[1,2,3]]} | |
579 | ||
580 | mutation 1: | |
581 | row 0: no change | |
ae8f13e2 | 582 | row 1: {"r":-1} |
e9f8f936 BP |
583 | row 2: {"r":["set",[-1,0]]} |
584 | row 3: {"r":["set",[-1,0,1]]} | |
585 | ||
586 | mutation 2: | |
587 | row 0: no change | |
ae8f13e2 | 588 | row 1: {"r":1.25} |
e9f8f936 | 589 | row 2: {"r":["set",[1.25,3.75]]} |
bd76d25d | 590 | row 3: constraint violation: 6.25 is greater than maximum allowed value 6 |
e9f8f936 BP |
591 | |
592 | mutation 3: | |
593 | row 0: no change | |
ae8f13e2 | 594 | row 1: {"r":0.125} |
e9f8f936 BP |
595 | row 2: {"r":["set",[0.125,0.375]]} |
596 | row 3: {"r":["set",[0.125,0.375,0.625]]} | |
597 | ||
598 | mutation 4: | |
599 | row 0: no change | |
ae8f13e2 | 600 | row 1: {"r":0} |
e9f8f936 BP |
601 | row 2: constraint violation: Result of "*=" operation contains duplicates. |
602 | row 3: constraint violation: Result of "*=" operation contains duplicates. | |
603 | ||
604 | mutation 5: | |
ae8f13e2 | 605 | row 0: {"r":1.5} |
e9f8f936 BP |
606 | row 1: {"r":["set",[0.5,1.5]]} |
607 | row 2: no change | |
608 | row 3: no change | |
609 | ||
610 | mutation 6: | |
ae8f13e2 | 611 | row 0: {"r":3} |
e9f8f936 BP |
612 | row 1: {"r":["set",[0.5,3]]} |
613 | row 2: {"r":["set",[0.5,1.5,3]]} | |
614 | row 3: {"r":["set",[0.5,1.5,2.5,3]]} | |
615 | ||
616 | mutation 7: | |
617 | row 0: no change | |
618 | row 1: no change | |
ae8f13e2 | 619 | row 2: {"r":0.5} |
e9f8f936 BP |
620 | row 3: {"r":["set",[0.5,2.5]]} |
621 | ||
622 | mutation 8: | |
623 | row 0: no change | |
624 | row 1: {"r":["set",[]]} | |
625 | row 2: {"r":["set",[]]} | |
626 | row 3: {"r":["set",[]]} | |
627 | ]], [mutation]) | |
628 | ||
629 | OVSDB_CHECK_POSITIVE([executing mutations on boolean sets], | |
630 | [[execute-mutations \ | |
631 | '{"columns": {"b": {"type": {"key": "boolean", "min": 0, "max": "unlimited"}}}}' \ | |
632 | '[[["b", "insert", ["set", [false]]]], | |
633 | [["b", "insert", ["set", [true]]]], | |
634 | [["b", "insert", ["set", [false, true]]]], | |
635 | [["b", "delete", ["set", [false]]]], | |
636 | [["b", "delete", ["set", [true]]]], | |
637 | [["b", "delete", ["set", [true, false]]]]]' \ | |
638 | '[{"b": ["set", []]}, | |
639 | {"b": ["set", [false]]}, | |
640 | {"b": ["set", [true]]}, | |
641 | {"b": ["set", [false, true]]}']]], | |
642 | [[mutation 0: | |
ae8f13e2 | 643 | row 0: {"b":false} |
e9f8f936 BP |
644 | row 1: no change |
645 | row 2: {"b":["set",[false,true]]} | |
646 | row 3: no change | |
647 | ||
648 | mutation 1: | |
ae8f13e2 | 649 | row 0: {"b":true} |
e9f8f936 BP |
650 | row 1: {"b":["set",[false,true]]} |
651 | row 2: no change | |
652 | row 3: no change | |
653 | ||
654 | mutation 2: | |
655 | row 0: {"b":["set",[false,true]]} | |
656 | row 1: {"b":["set",[false,true]]} | |
657 | row 2: {"b":["set",[false,true]]} | |
658 | row 3: no change | |
659 | ||
660 | mutation 3: | |
661 | row 0: no change | |
662 | row 1: {"b":["set",[]]} | |
663 | row 2: no change | |
ae8f13e2 | 664 | row 3: {"b":true} |
e9f8f936 BP |
665 | |
666 | mutation 4: | |
667 | row 0: no change | |
668 | row 1: no change | |
669 | row 2: {"b":["set",[]]} | |
ae8f13e2 | 670 | row 3: {"b":false} |
e9f8f936 BP |
671 | |
672 | mutation 5: | |
673 | row 0: no change | |
674 | row 1: {"b":["set",[]]} | |
675 | row 2: {"b":["set",[]]} | |
676 | row 3: {"b":["set",[]]} | |
677 | ]], [mutation]) | |
678 | ||
679 | OVSDB_CHECK_POSITIVE([executing mutations on string sets], | |
680 | [[execute-mutations \ | |
681 | '{"columns": {"s": {"type": {"key": "string", "min": 0, "max": "unlimited"}}}}' \ | |
682 | '[[["s", "insert", ["set", ["a"]]]], | |
683 | [["s", "insert", ["set", ["b"]]]], | |
684 | [["s", "insert", ["set", ["c", "d"]]]], | |
685 | [["s", "delete", ["set", ["a"]]]], | |
686 | [["s", "delete", ["set", ["b"]]]], | |
687 | [["s", "delete", ["set", ["c", "d"]]]]]' \ | |
688 | '[{"s": ["set", []]}, | |
689 | {"s": ["set", ["a"]]}, | |
690 | {"s": ["set", ["a", "b"]]}, | |
691 | {"s": ["set", ["a", "b", "c", "d"]]}']]], | |
692 | [[mutation 0: | |
ae8f13e2 | 693 | row 0: {"s":"a"} |
e9f8f936 BP |
694 | row 1: no change |
695 | row 2: no change | |
696 | row 3: no change | |
697 | ||
698 | mutation 1: | |
ae8f13e2 | 699 | row 0: {"s":"b"} |
e9f8f936 BP |
700 | row 1: {"s":["set",["a","b"]]} |
701 | row 2: no change | |
702 | row 3: no change | |
703 | ||
704 | mutation 2: | |
705 | row 0: {"s":["set",["c","d"]]} | |
706 | row 1: {"s":["set",["a","c","d"]]} | |
707 | row 2: {"s":["set",["a","b","c","d"]]} | |
708 | row 3: no change | |
709 | ||
710 | mutation 3: | |
711 | row 0: no change | |
712 | row 1: {"s":["set",[]]} | |
ae8f13e2 | 713 | row 2: {"s":"b"} |
e9f8f936 BP |
714 | row 3: {"s":["set",["b","c","d"]]} |
715 | ||
716 | mutation 4: | |
717 | row 0: no change | |
718 | row 1: no change | |
ae8f13e2 | 719 | row 2: {"s":"a"} |
e9f8f936 BP |
720 | row 3: {"s":["set",["a","c","d"]]} |
721 | ||
722 | mutation 5: | |
723 | row 0: no change | |
724 | row 1: no change | |
725 | row 2: no change | |
726 | row 3: {"s":["set",["a","b"]]} | |
727 | ]], [mutation]) | |
728 | ||
729 | OVSDB_CHECK_POSITIVE([executing mutations on uuid sets], | |
730 | [[execute-mutations \ | |
731 | '{"columns": {"u": {"type": {"key": "uuid", "min": 0, "max": "unlimited"}}}}' \ | |
732 | '[[["u", "insert", ["set", [["uuid", "ddd9e79d-7782-414c-8b22-1046c60b6ec2"]]]]], | |
733 | [["u", "insert", ["set", [["uuid", "a60fe7ff-317b-4568-9106-892b37445313"]]]]], | |
734 | [["u", "insert", ["set", [["uuid", "2607d30e-e652-4927-9fec-8bbf1b60c7e9"]]]]], | |
735 | [["u", "delete", ["set", [["uuid", "ddd9e79d-7782-414c-8b22-1046c60b6ec2"]]]]], | |
736 | [["u", "delete", ["set", [["uuid", "a60fe7ff-317b-4568-9106-892b37445313"]]]]], | |
737 | [["u", "delete", ["set", [["uuid", "2607d30e-e652-4927-9fec-8bbf1b60c7e9"]]]]]]' \ | |
738 | '[{"u": ["set", []]}, | |
739 | {"u": ["set", [["uuid", "ddd9e79d-7782-414c-8b22-1046c60b6ec2"]]]}, | |
740 | {"u": ["set", [["uuid", "a60fe7ff-317b-4568-9106-892b37445313"]]]}, | |
741 | {"u": ["set", [["uuid", "2607d30e-e652-4927-9fec-8bbf1b60c7e9"]]]}']]], | |
742 | [[mutation 0: | |
ae8f13e2 | 743 | row 0: {"u":["uuid","ddd9e79d-7782-414c-8b22-1046c60b6ec2"]} |
e9f8f936 BP |
744 | row 1: no change |
745 | row 2: {"u":["set",[["uuid","a60fe7ff-317b-4568-9106-892b37445313"],["uuid","ddd9e79d-7782-414c-8b22-1046c60b6ec2"]]]} | |
746 | row 3: {"u":["set",[["uuid","2607d30e-e652-4927-9fec-8bbf1b60c7e9"],["uuid","ddd9e79d-7782-414c-8b22-1046c60b6ec2"]]]} | |
747 | ||
748 | mutation 1: | |
ae8f13e2 | 749 | row 0: {"u":["uuid","a60fe7ff-317b-4568-9106-892b37445313"]} |
e9f8f936 BP |
750 | row 1: {"u":["set",[["uuid","a60fe7ff-317b-4568-9106-892b37445313"],["uuid","ddd9e79d-7782-414c-8b22-1046c60b6ec2"]]]} |
751 | row 2: no change | |
752 | row 3: {"u":["set",[["uuid","2607d30e-e652-4927-9fec-8bbf1b60c7e9"],["uuid","a60fe7ff-317b-4568-9106-892b37445313"]]]} | |
753 | ||
754 | mutation 2: | |
ae8f13e2 | 755 | row 0: {"u":["uuid","2607d30e-e652-4927-9fec-8bbf1b60c7e9"]} |
e9f8f936 BP |
756 | row 1: {"u":["set",[["uuid","2607d30e-e652-4927-9fec-8bbf1b60c7e9"],["uuid","ddd9e79d-7782-414c-8b22-1046c60b6ec2"]]]} |
757 | row 2: {"u":["set",[["uuid","2607d30e-e652-4927-9fec-8bbf1b60c7e9"],["uuid","a60fe7ff-317b-4568-9106-892b37445313"]]]} | |
758 | row 3: no change | |
759 | ||
760 | mutation 3: | |
761 | row 0: no change | |
762 | row 1: {"u":["set",[]]} | |
763 | row 2: no change | |
764 | row 3: no change | |
765 | ||
766 | mutation 4: | |
767 | row 0: no change | |
768 | row 1: no change | |
769 | row 2: {"u":["set",[]]} | |
770 | row 3: no change | |
771 | ||
772 | mutation 5: | |
773 | row 0: no change | |
774 | row 1: no change | |
775 | row 2: no change | |
776 | row 3: {"u":["set",[]]} | |
777 | ]], [mutation]) | |
778 | ||
e9f8f936 BP |
779 | OVSDB_CHECK_POSITIVE([executing mutations on integer maps], |
780 | [[execute-mutations \ | |
781 | '{"columns": {"i": {"type": {"key": "integer", "value": "integer", "min": 0, "max": "unlimited"}}}}' \ | |
782 | '[[["i", "insert", ["map", [[1, 2]]]]], | |
783 | [["i", "insert", ["map", [[2, 4], [3, 5]]]]], | |
784 | [["i", "delete", ["map", [[1, 2]]]]], | |
785 | [["i", "delete", ["map", [[2, 3]]]]], | |
786 | [["i", "delete", ["set", [1]]]], | |
787 | [["i", "delete", ["set", [2, 3]]]]]' \ | |
788 | '[{"i": ["map", []]}, | |
789 | {"i": ["map", [[1, 2]]]}, | |
790 | {"i": ["map", [[1, 3], [2, 3]]]}, | |
791 | {"i": ["map", [[3, 5]]]}']]], | |
792 | [[mutation 0: | |
793 | row 0: {"i":["map",[[1,2]]]} | |
794 | row 1: no change | |
795 | row 2: no change | |
796 | row 3: {"i":["map",[[1,2],[3,5]]]} | |
797 | ||
798 | mutation 1: | |
799 | row 0: {"i":["map",[[2,4],[3,5]]]} | |
800 | row 1: {"i":["map",[[1,2],[2,4],[3,5]]]} | |
801 | row 2: {"i":["map",[[1,3],[2,3],[3,5]]]} | |
802 | row 3: {"i":["map",[[2,4],[3,5]]]} | |
803 | ||
804 | mutation 2: | |
805 | row 0: no change | |
806 | row 1: {"i":["map",[]]} | |
807 | row 2: no change | |
808 | row 3: no change | |
809 | ||
810 | mutation 3: | |
811 | row 0: no change | |
812 | row 1: no change | |
813 | row 2: {"i":["map",[[1,3]]]} | |
814 | row 3: no change | |
815 | ||
816 | mutation 4: | |
817 | row 0: no change | |
818 | row 1: {"i":["map",[]]} | |
819 | row 2: {"i":["map",[[2,3]]]} | |
820 | row 3: no change | |
821 | ||
822 | mutation 5: | |
823 | row 0: no change | |
824 | row 1: no change | |
825 | row 2: {"i":["map",[[1,3]]]} | |
826 | row 3: {"i":["map",[]]} | |
827 | ]], [mutation]) |