X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Fovsdb-types.at;h=7122e9d2dbac133c612d1a500348aae4f49e17e7;hb=2736b84e2348090d4756f987db37aa7ddfcb50e0;hp=b7fddc7e2746533d417f3ed7bb7f6ae044be82d1;hpb=bd76d25d8b3b7d11c5a326e91d784ad2cdeecd45;p=openvswitch diff --git a/tests/ovsdb-types.at b/tests/ovsdb-types.at index b7fddc7e..7122e9d2 100644 --- a/tests/ovsdb-types.at +++ b/tests/ovsdb-types.at @@ -15,6 +15,9 @@ OVSDB_CHECK_NEGATIVE([void is not a valid atomic-type], AT_BANNER([OVSDB -- base types]) +OVSDB_CHECK_POSITIVE([integer enum], + [[parse-base-type '{"type": "integer", "enum": ["set", [-1, 4, 5]]}' ]], + [[{"enum":["set",[-1,4,5]],"type":"integer"}]]) OVSDB_CHECK_POSITIVE([integer >= 5], [[parse-base-type '{"type": "integer", "minInteger": 5}' ]], [{"minInteger":5,"type":"integer"}]) @@ -28,6 +31,9 @@ OVSDB_CHECK_NEGATIVE([integer max may not be less than min], [[parse-base-type '{"type": "integer", "minInteger": 5, "maxInteger": 3}']], [minInteger exceeds maxInteger]) +OVSDB_CHECK_POSITIVE([real enum], + [[parse-base-type '{"type": "real", "enum": ["set", [1.5, 0, 2.75]]}' ]], + [[{"enum":["set",[0,1.5,2.75]],"type":"real"}]]) OVSDB_CHECK_POSITIVE([real >= -1.5], [[parse-base-type '{"type": "real", "minReal": -1.5}']], [{"minReal":-1.5,"type":"real"}]) @@ -43,17 +49,13 @@ OVSDB_CHECK_NEGATIVE([real max may not be less than min], OVSDB_CHECK_POSITIVE([boolean], [[parse-base-type '[{"type": "boolean"}]' ]], ["boolean"]) +OVSDB_CHECK_POSITIVE([boolean enum], + [[parse-base-type '{"type": "boolean", "enum": true}' ]], + [[{"enum":true,"type":"boolean"}]]) -OVSDB_CHECK_POSITIVE([string reMatch], - [[parse-base-type '{"type": "string", "reMatch": "\\d{3}-\\d{3}-\\d{4}"}']], - [{"reMatch":"\\d{3}-\\d{3}-\\d{4}","type":"string"}]) -OVSDB_CHECK_POSITIVE([string reMatch + reComment], - [[parse-base-type '{"type": "string", "reMatch": "\\d{3}-\\d{3}-\\d{4}", "reComment": "US-style telephone number"}']], - [{"reComment":"US-style telephone number","reMatch":"\\d{3}-\\d{3}-\\d{4}","type":"string"}]) -OVSDB_CHECK_NEGATIVE([reMatch must be a valid JavaScript regexp], - [[parse-base-type '{"type": "string", "reMatch": "ab@:>@cd"}']], - [[test-ovsdb: invalid regular expression: "ab@:>@cd" is not a valid regular expression: @:>@ is an invalid data character in JavaScript compatibility mode]]) - +OVSDB_CHECK_POSITIVE([string enum], + [[parse-base-type '{"type": "string", "enum": ["set", ["def", "abc"]]}']], + [[{"enum":["set",["abc","def"]],"type":"string"}]]) OVSDB_CHECK_POSITIVE([string minLength], [[parse-base-type '{"type": "string", "minLength": 1}']], [{"minLength":1,"type":"string"}]) @@ -70,6 +72,16 @@ OVSDB_CHECK_NEGATIVE([maxLength must not be negative], [[parse-base-type '{"type": "string", "maxLength": -1}']], [maxLength out of valid range 0 to 4294967295]) +OVSDB_CHECK_POSITIVE([uuid enum], + [[parse-base-type '{"type": "uuid", "enum": ["uuid", "36bf19c0-ad9d-4232-bb85-b3d73dfe2123"]}' ]], + [[{"enum":["uuid","36bf19c0-ad9d-4232-bb85-b3d73dfe2123"],"type":"uuid"}]]) +OVSDB_CHECK_POSITIVE([uuid refTable], + [[parse-base-type '{"type": "uuid", "refTable": "myTable"}' ]], + [{"refTable":"myTable","type":"uuid"}]) +OVSDB_CHECK_NEGATIVE([uuid refTable must be valid id], + [[parse-base-type '{"type": "uuid", "refTable": "a-b-c"}' ]], + [Type mismatch for member 'refTable']) + OVSDB_CHECK_NEGATIVE([void is not a valid base-type], [[parse-base-type '["void"]' ]], ["void" is not an atomic-type]) OVSDB_CHECK_NEGATIVE(["type" member must be present],