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]])
+
+AT_SETUP([reMatch must be a valid regexp])
+AT_KEYWORDS([ovsdb negative])
+if test "$HAVE_PCRE" = yes; then
+ AT_CHECK(
+ [[test-ovsdb parse-base-type \
+ '{"type": "string", "reMatch": "x{2,1}"}']],
+ [1], [],
+ [[test-ovsdb: invalid regular expression: "x{2,1}" is not a valid regular expression: numbers out of order in {} quantifier
+]])
+else
+ AT_CHECK(
+ [[test-ovsdb parse-base-type \
+ '{"type": "string", "reMatch": "x{2,1}"}']],
+ [0], [[{"reMatch":"x{2,1}","type":"string"}
+]], [])
+fi
+AT_CLEANUP
OVSDB_CHECK_POSITIVE([string minLength],
[[parse-base-type '{"type": "string", "minLength": 1}']],
[[parse-base-type '{"type": "string", "maxLength": -1}']],
[maxLength out of valid range 0 to 4294967295])
+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],