+ [[syntax ""550e8400-e29b-41d4-a716-446655440000"": syntax error: expected ["uuid", <string>]]])
+
+OVSDB_CHECK_POSITIVE_CPY([named-uuid requires symbol table],
+ [parse-atoms '[["uuid"]]' '[["named-uuid", "x"]]'],
+ [[syntax "["named-uuid","x"]": syntax error: expected ["uuid", <string>]]])
+
+OVSDB_CHECK_NEGATIVE([empty string atom must be quoted],
+ [[parse-atom-strings '["string"]' '']],
+ [An empty string is not valid as input; use "" to represent the empty string])
+
+OVSDB_CHECK_NEGATIVE([quotes must be balanced],
+ [parse-atom-strings '[["string"]]' '"asdf'],
+ ["asdf: missing quote at end of quoted string])
+
+OVSDB_CHECK_NEGATIVE([uuids must be valid],
+ [parse-atom-strings '[["uuid"]]' '1234-5678'],
+ ["1234-5678" is not a valid UUID])
+\f
+AT_BANNER([OVSDB -- atoms with enum constraints])
+
+OVSDB_CHECK_POSITIVE_CPY([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_CPY([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_CPY([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_CPY([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_CPY([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])]])
+\f
+AT_BANNER([OVSDB -- atoms with other constraints])
+
+OVSDB_CHECK_POSITIVE_CPY([integers >= 5],
+ [[parse-atoms '[{"type": "integer", "minInteger": 5}]' \
+ '[0]' \
+ '[4]' \
+ '[5]' \
+ '[6]' \
+ '[12345]']],
+ [constraint violation: 0 is less than minimum allowed value 5
+constraint violation: 4 is less than minimum allowed value 5
+5
+6
+12345])
+
+OVSDB_CHECK_POSITIVE_CPY([integers <= -1],
+ [[parse-atoms '[{"type": "integer", "maxInteger": -1}]' \
+ '[0]' \
+ '[-1]' \
+ '[-2]' \
+ '[-123]']],
+ [constraint violation: 0 is greater than maximum allowed value -1
+-1
+-2
+-123])
+
+OVSDB_CHECK_POSITIVE_CPY([integers in range -10 to 10],
+ [[parse-atoms '[{"type": "integer", "minInteger": -10, "maxInteger": 10}]' \
+ '[-20]' \
+ '[-11]' \
+ '[-10]' \
+ '[-9]' \
+ '[1]' \
+ '[9]' \
+ '[10]' \
+ '[11]' \
+ '[123576]']],
+ [constraint violation: -20 is not in the valid range -10 to 10 (inclusive)
+constraint violation: -11 is not in the valid range -10 to 10 (inclusive)
+-10
+-9
+1
+9
+10
+constraint violation: 11 is not in the valid range -10 to 10 (inclusive)
+constraint violation: 123576 is not in the valid range -10 to 10 (inclusive)])
+
+OVSDB_CHECK_POSITIVE_CPY([reals >= 5],
+ [[parse-atoms '[{"type": "real", "minReal": 5}]' \
+ '[0]' \
+ '[4]' \
+ '[5]' \
+ '[6]' \
+ '[12345]']],
+ [constraint violation: 0 is less than minimum allowed value 5
+constraint violation: 4 is less than minimum allowed value 5
+5
+6
+12345])
+
+OVSDB_CHECK_POSITIVE_CPY([reals <= -1],
+ [[parse-atoms '[{"type": "real", "maxReal": -1}]' \
+ '[0]' \
+ '[-1]' \
+ '[-2]' \
+ '[-123]']],
+ [constraint violation: 0 is greater than maximum allowed value -1
+-1
+-2
+-123])
+
+OVSDB_CHECK_POSITIVE_CPY([reals in range -10 to 10],
+ [[parse-atoms '[{"type": "real", "minReal": -10, "maxReal": 10}]' \
+ '[-20]' \
+ '[-11]' \
+ '[-10]' \
+ '[-9]' \
+ '[1]' \
+ '[9]' \
+ '[10]' \
+ '[11]' \
+ '[123576]']],
+ [constraint violation: -20 is not in the valid range -10 to 10 (inclusive)
+constraint violation: -11 is not in the valid range -10 to 10 (inclusive)
+-10
+-9
+1
+9
+10
+constraint violation: 11 is not in the valid range -10 to 10 (inclusive)
+constraint violation: 123576 is not in the valid range -10 to 10 (inclusive)])
+
+OVSDB_CHECK_POSITIVE_CPY([strings at least 2 characters long],
+ [[parse-atoms '{"type": "string", "minLength": 2}' \
+ '[""]' \
+ '["a"]' \
+ '["ab"]' \
+ '["abc"]' \
+ '["\ud834\udd1e"]']],
+ [[constraint violation: "" length 0 is less than minimum allowed length 2
+constraint violation: "a" length 1 is less than minimum allowed length 2
+"ab"
+"abc"
+constraint violation: "𝄞" length 1 is less than minimum allowed length 2]],
+ [],
+ [],
+ [dnl This test requires a wide build of Python.
+ AT_CHECK([$PYTHON -c 'unichr(0x10000)' || exit 77],
+ [0], [ignore], [ignore])])
+
+OVSDB_CHECK_POSITIVE_CPY([strings no more than 2 characters long],
+ [[parse-atoms '{"type": "string", "maxLength": 2}' \
+ '[""]' \
+ '["a"]' \
+ '["ab"]' \
+ '["abc"]' \
+ '["de"]']],
+ [[""
+"a"
+"ab"
+constraint violation: "abc" length 3 is greater than maximum allowed length 2
+"de"]])