+AT_BANNER([OVSDB -- base types])
+
+OVSDB_CHECK_POSITIVE_CPY([integer enum],
+ [[parse-base-type '{"type": "integer", "enum": ["set", [-1, 4, 5]]}' ]],
+ [[{"enum":["set",[-1,4,5]],"type":"integer"}]])
+OVSDB_CHECK_POSITIVE_CPY([integer >= 5],
+ [[parse-base-type '{"type": "integer", "minInteger": 5}' ]],
+ [{"minInteger":5,"type":"integer"}])
+OVSDB_CHECK_POSITIVE_CPY([integer <= 7],
+ [[parse-base-type '{"type": "integer", "maxInteger": 7}' ]],
+ [{"maxInteger":7,"type":"integer"}])
+OVSDB_CHECK_POSITIVE_CPY([integer between -5 and 10],
+ [[parse-base-type '{"type": "integer", "minInteger": -5, "maxInteger": 10}']],
+ [{"maxInteger":10,"minInteger":-5,"type":"integer"}])
+OVSDB_CHECK_NEGATIVE_CPY([integer max may not be less than min],
+ [[parse-base-type '{"type": "integer", "minInteger": 5, "maxInteger": 3}']],
+ [minInteger exceeds maxInteger])
+
+OVSDB_CHECK_POSITIVE_CPY([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_CPY([real >= -1.5],
+ [[parse-base-type '{"type": "real", "minReal": -1.5}']],
+ [{"minReal":-1.5,"type":"real"}])
+OVSDB_CHECK_POSITIVE_CPY([real <= 1e5],
+ [[parse-base-type '{"type": "real", "maxReal": 1e5}']],
+ [{"maxReal":100000,"type":"real"}])
+OVSDB_CHECK_POSITIVE_CPY([real between -2.5 and 3.75],
+ [[parse-base-type '{"type": "real", "minReal": -2.5, "maxReal": 3.75}']],
+ [{"maxReal":3.75,"minReal":-2.5,"type":"real"}])
+OVSDB_CHECK_NEGATIVE_CPY([real max may not be less than min],
+ [[parse-base-type '{"type": "real", "minReal": 555, "maxReal": 444}']],
+ [minReal exceeds maxReal])
+
+OVSDB_CHECK_POSITIVE_CPY([boolean],
+ [[parse-base-type '[{"type": "boolean"}]' ]], ["boolean"])
+OVSDB_CHECK_POSITIVE_CPY([boolean enum],
+ [[parse-base-type '{"type": "boolean", "enum": true}' ]],
+ [[{"enum":true,"type":"boolean"}]])
+
+OVSDB_CHECK_POSITIVE_CPY([string enum],
+ [[parse-base-type '{"type": "string", "enum": ["set", ["def", "abc"]]}']],
+ [[{"enum":["set",["abc","def"]],"type":"string"}]])
+OVSDB_CHECK_POSITIVE_CPY([string minLength],
+ [[parse-base-type '{"type": "string", "minLength": 1}']],
+ [{"minLength":1,"type":"string"}])
+OVSDB_CHECK_POSITIVE_CPY([string maxLength],
+ [[parse-base-type '{"type": "string", "maxLength": 5}']],
+ [{"maxLength":5,"type":"string"}])
+OVSDB_CHECK_POSITIVE_CPY([string minLength and maxLength],
+ [[parse-base-type '{"type": "string", "minLength": 1, "maxLength": 5}']],
+ [{"maxLength":5,"minLength":1,"type":"string"}])
+OVSDB_CHECK_NEGATIVE_CPY([maxLength must not be less than minLength],
+ [[parse-base-type '{"type": "string", "minLength": 5, "maxLength": 3}']],
+ [minLength exceeds maxLength])
+OVSDB_CHECK_NEGATIVE_CPY([maxLength must not be negative],
+ [[parse-base-type '{"type": "string", "maxLength": -1}']],
+ [maxLength out of valid range 0 to 4294967295])
+
+OVSDB_CHECK_POSITIVE_CPY([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_CPY([uuid refTable],
+ [[parse-base-type '{"type": "uuid", "refTable": "myTable"}' ]],
+ [{"refTable":"myTable","type":"uuid"}])
+OVSDB_CHECK_NEGATIVE_CPY([uuid refTable must be valid id],
+ [[parse-base-type '{"type": "uuid", "refTable": "a-b-c"}' ]],
+ [Type mismatch for member 'refTable'])
+
+OVSDB_CHECK_NEGATIVE_CPY([void is not a valid base-type],
+ [[parse-base-type '["void"]' ]], ["void" is not an atomic-type])
+OVSDB_CHECK_NEGATIVE_CPY(["type" member must be present],
+ [[parse-base-type '{}']], [Parsing ovsdb type failed: Required 'type' member is missing.])
+