+\f
+AT_BANNER([OVSDB -- atoms with constraints])
+
+OVSDB_CHECK_POSITIVE([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([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([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([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([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([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([strings matching /(a(b)?)c?/],
+ [[parse-atoms '{"type": "string", "reMatch": "(a(b)?)?c?"}' \
+ '[""]' \
+ '["a"]' \
+ '["ab"]' \
+ '["abc"]' \
+ '["ac"]' \
+ '["b"]' \
+ '["bc"]' \
+ '["c"]']],
+ [[""
+"a"
+"ab"
+"abc"
+"ac"
+constraint violation: "b" does not match regular expression /(a(b)?)?c?/
+constraint violation: "bc" does not match regular expression /(a(b)?)?c?/
+"c"]])
+
+OVSDB_CHECK_POSITIVE([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]])
+
+OVSDB_CHECK_POSITIVE([strings no more than 2 characters long],
+ [[parse-atoms '{"type": "string", "maxLength": 2}' \
+ '[""]' \
+ '["a"]' \
+ '["ab"]' \
+ '["abc"]' \
+ '["\ud834\udd1e"]']],
+ [[""
+"a"
+"ab"
+constraint violation: "abc" length 3 is greater than maximum allowed length 2
+"𝄞"]])