X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Fovsdb-data.at;h=ac0f0b7be0b6fa2651d337263d601313f6d89a80;hb=27b6cec086eebdd34bc8526901ea6b2a52119f17;hp=031eee04006bbc651d37fdcffb962a0f41d1e773;hpb=89521e3f79d53523fda9f284e74f0f7aa21332b4;p=openvswitch diff --git a/tests/ovsdb-data.at b/tests/ovsdb-data.at index 031eee04..ac0f0b7b 100644 --- a/tests/ovsdb-data.at +++ b/tests/ovsdb-data.at @@ -1,3 +1,76 @@ +AT_BANNER([OVSDB -- default values]) + +OVSDB_CHECK_POSITIVE([default atoms], + [default-atoms], + [[integer: OK +real: OK +boolean: OK +string: OK +uuid: OK]]) + +OVSDB_CHECK_POSITIVE([default data], + [default-data], + [[key integer, value void, n_min 0: OK +key integer, value integer, n_min 0: OK +key integer, value real, n_min 0: OK +key integer, value boolean, n_min 0: OK +key integer, value string, n_min 0: OK +key integer, value uuid, n_min 0: OK +key real, value void, n_min 0: OK +key real, value integer, n_min 0: OK +key real, value real, n_min 0: OK +key real, value boolean, n_min 0: OK +key real, value string, n_min 0: OK +key real, value uuid, n_min 0: OK +key boolean, value void, n_min 0: OK +key boolean, value integer, n_min 0: OK +key boolean, value real, n_min 0: OK +key boolean, value boolean, n_min 0: OK +key boolean, value string, n_min 0: OK +key boolean, value uuid, n_min 0: OK +key string, value void, n_min 0: OK +key string, value integer, n_min 0: OK +key string, value real, n_min 0: OK +key string, value boolean, n_min 0: OK +key string, value string, n_min 0: OK +key string, value uuid, n_min 0: OK +key uuid, value void, n_min 0: OK +key uuid, value integer, n_min 0: OK +key uuid, value real, n_min 0: OK +key uuid, value boolean, n_min 0: OK +key uuid, value string, n_min 0: OK +key uuid, value uuid, n_min 0: OK +key integer, value void, n_min 1: OK +key integer, value integer, n_min 1: OK +key integer, value real, n_min 1: OK +key integer, value boolean, n_min 1: OK +key integer, value string, n_min 1: OK +key integer, value uuid, n_min 1: OK +key real, value void, n_min 1: OK +key real, value integer, n_min 1: OK +key real, value real, n_min 1: OK +key real, value boolean, n_min 1: OK +key real, value string, n_min 1: OK +key real, value uuid, n_min 1: OK +key boolean, value void, n_min 1: OK +key boolean, value integer, n_min 1: OK +key boolean, value real, n_min 1: OK +key boolean, value boolean, n_min 1: OK +key boolean, value string, n_min 1: OK +key boolean, value uuid, n_min 1: OK +key string, value void, n_min 1: OK +key string, value integer, n_min 1: OK +key string, value real, n_min 1: OK +key string, value boolean, n_min 1: OK +key string, value string, n_min 1: OK +key string, value uuid, n_min 1: OK +key uuid, value void, n_min 1: OK +key uuid, value integer, n_min 1: OK +key uuid, value real, n_min 1: OK +key uuid, value boolean, n_min 1: OK +key uuid, value string, n_min 1: OK +key uuid, value uuid, n_min 1: OK]]) + AT_BANNER([OVSDB -- atoms without constraints]) OVSDB_CHECK_POSITIVE([integer atom from JSON], @@ -160,11 +233,11 @@ dnl is not allowed anywhere in a UTF-8 string. dnl is a surrogate and not allowed in UTF-8. OVSDB_CHECK_POSITIVE([no invalid UTF-8 sequences in strings], [parse-atoms '[["string"]]' \ - '@<:@"m4_esyscmd([printf "\xc0"])"@:>@' \ - '@<:@"m4_esyscmd([printf "\xed\xa0\x80"])"@:>@' \ + '@<:@"m4_esyscmd([printf "\300"])"@:>@' \ + '@<:@"m4_esyscmd([printf "\355\240\200"])"@:>@' \ ], - [constraint violation: "m4_esyscmd([printf "\xc0"])" is not a valid UTF-8 string: invalid UTF-8 sequence 0xc0 -constraint violation: "m4_esyscmd([printf "\xed\xa0\x80"])" is not a valid UTF-8 string: invalid UTF-8 sequence 0xed 0xa0]) + [constraint violation: "m4_esyscmd([printf "\300"])" is not a valid UTF-8 string: invalid UTF-8 sequence 0xc0 +constraint violation: "m4_esyscmd([printf "\355\240\200"])" is not a valid UTF-8 string: invalid UTF-8 sequence 0xed 0xa0]) OVSDB_CHECK_NEGATIVE([real not acceptable integer string atom], [[parse-atom-strings '["integer"]' '0.5' ]], @@ -198,7 +271,80 @@ OVSDB_CHECK_NEGATIVE([uuids must be valid], [parse-atom-strings '[["uuid"]]' '1234-5678'], ["1234-5678" is not a valid UUID]) -AT_BANNER([OVSDB -- atoms with constraints]) +AT_BANNER([OVSDB -- atoms with enum constraints]) + +OVSDB_CHECK_POSITIVE([integer atom enum], + [[parse-atoms '[{"type": "integer", "enum": ["set", [1, 6, 8, 10]]}]' \ + '[0]' \ + '[1]' \ + '[2]' \ + '[3]' \ + '[6]' \ + '[7]' \ + '[8]' \ + '[9]' \ + '[10]' \ + '[11]']], + [[constraint violation: 0 is not one of the allowed values ([1, 6, 8, 10]) +1 +constraint violation: 2 is not one of the allowed values ([1, 6, 8, 10]) +constraint violation: 3 is not one of the allowed values ([1, 6, 8, 10]) +6 +constraint violation: 7 is not one of the allowed values ([1, 6, 8, 10]) +8 +constraint violation: 9 is not one of the allowed values ([1, 6, 8, 10]) +10 +constraint violation: 11 is not one of the allowed values ([1, 6, 8, 10])]]) + +OVSDB_CHECK_POSITIVE([real atom enum], + [[parse-atoms '[{"type": "real", "enum": ["set", [-1.5, 1.5]]}]' \ + '[-2]' \ + '[-1]' \ + '[-1.5]' \ + '[0]' \ + '[1]' \ + '[1.5]' \ + '[2]']], + [[constraint violation: -2 is not one of the allowed values ([-1.5, 1.5]) +constraint violation: -1 is not one of the allowed values ([-1.5, 1.5]) +-1.5 +constraint violation: 0 is not one of the allowed values ([-1.5, 1.5]) +constraint violation: 1 is not one of the allowed values ([-1.5, 1.5]) +1.5 +constraint violation: 2 is not one of the allowed values ([-1.5, 1.5])]]) + +OVSDB_CHECK_POSITIVE([boolean atom enum], + [[parse-atoms '[{"type": "boolean", "enum": false}]' \ + '[false]' \ + '[true]']], + [[false +constraint violation: true is not one of the allowed values ([false])]]) + +OVSDB_CHECK_POSITIVE([string atom enum], + [[parse-atoms '[{"type": "string", "enum": ["set", ["abc", "def"]]}]' \ + '[""]' \ + '["ab"]' \ + '["abc"]' \ + '["def"]' \ + '["defg"]' \ + '["DEF"]']], + [[constraint violation: "" is not one of the allowed values ([abc, def]) +constraint violation: ab is not one of the allowed values ([abc, def]) +"abc" +"def" +constraint violation: defg is not one of the allowed values ([abc, def]) +constraint violation: DEF is not one of the allowed values ([abc, def])]]) + +OVSDB_CHECK_POSITIVE([uuid atom enum], + [[parse-atoms '[{"type": "uuid", "enum": ["set", [["uuid", "6d53a6dd-2da7-4924-9927-97f613812382"], ["uuid", "52cbc842-137a-4db5-804f-9f34106a0ba3"]]]}]' \ + '["uuid", "6d53a6dd-2da7-4924-9927-97f613812382"]' \ + '["uuid", "52cbc842-137a-4db5-804f-9f34106a0ba3"]' \ + '["uuid", "dab2a6b2-6094-4f43-a7ef-4c0f0608f176"]']], + [[["uuid","6d53a6dd-2da7-4924-9927-97f613812382"] +["uuid","52cbc842-137a-4db5-804f-9f34106a0ba3"] +constraint violation: dab2a6b2-6094-4f43-a7ef-4c0f0608f176 is not one of the allowed values ([52cbc842-137a-4db5-804f-9f34106a0ba3, 6d53a6dd-2da7-4924-9927-97f613812382])]]) + +AT_BANNER([OVSDB -- atoms with other constraints]) OVSDB_CHECK_POSITIVE([integers >= 5], [[parse-atoms '[{"type": "integer", "minInteger": 5}]' \