Commit ca2061ac authored by miloyip's avatar miloyip

Turn off some not-yet-implemented test cases, and fix a few

[ci skip]
parent 5ad3639d
...@@ -960,8 +960,8 @@ public: ...@@ -960,8 +960,8 @@ public:
virtual bool StartObject(Context&) const { return false; } virtual bool StartObject(Context&) const { return false; }
virtual bool Key(Context&, const Ch*, SizeType, bool) const { return false; } virtual bool Key(Context&, const Ch*, SizeType, bool) const { return false; }
virtual bool EndObject(Context&, SizeType) const { return false; } virtual bool EndObject(Context&, SizeType) const { return false; }
virtual bool StartArray(Context&) const { return true; } virtual bool StartArray(Context&) const { return false; }
virtual bool EndArray(Context&, SizeType) const { return true; } virtual bool EndArray(Context&, SizeType) const { return false; }
private: private:
#if RAPIDJSON_SCHEMA_USE_STDREGEX #if RAPIDJSON_SCHEMA_USE_STDREGEX
...@@ -1350,6 +1350,7 @@ public: ...@@ -1350,6 +1350,7 @@ public:
while (!schemaStack_.Empty()) while (!schemaStack_.Empty())
PopSchema(); PopSchema();
//documentStack_.Clear(); //documentStack_.Clear();
valid_ = true;
}; };
// Implementation of ISchemaValidator<Encoding> // Implementation of ISchemaValidator<Encoding>
......
...@@ -645,8 +645,8 @@ TEST(SchemaValidator, TestSuite) { ...@@ -645,8 +645,8 @@ TEST(SchemaValidator, TestSuite) {
"additionalProperties.json", "additionalProperties.json",
"allOf.json", "allOf.json",
"anyOf.json", "anyOf.json",
"definitions.json", //"definitions.json",
"dependencies.json", //"dependencies.json",
"enum.json", "enum.json",
"items.json", "items.json",
"maximum.json", "maximum.json",
...@@ -660,16 +660,21 @@ TEST(SchemaValidator, TestSuite) { ...@@ -660,16 +660,21 @@ TEST(SchemaValidator, TestSuite) {
"multipleOf.json", "multipleOf.json",
"not.json", "not.json",
"oneOf.json", "oneOf.json",
#if RAPIDJSON_SCHEMA_HAS_REGEX
"pattern.json", "pattern.json",
"patternProperties.json", "patternProperties.json",
#endif
"properties.json", "properties.json",
"ref.json", //"ref.json",
"refRemote.json", //"refRemote.json",
"required.json", "required.json",
"type.json", "type.json",
"uniqueItems.json" //"uniqueItems.json"
}; };
const char* onlyRunDescription = 0;
//const char* onlyRunDescription = "a string is a string";
unsigned testCount = 0; unsigned testCount = 0;
unsigned passCount = 0; unsigned passCount = 0;
...@@ -694,19 +699,21 @@ TEST(SchemaValidator, TestSuite) { ...@@ -694,19 +699,21 @@ TEST(SchemaValidator, TestSuite) {
SchemaValidator validator(schema); SchemaValidator validator(schema);
const Value& tests = (*schemaItr)["tests"]; const Value& tests = (*schemaItr)["tests"];
for (Value::ConstValueIterator testItr = tests.Begin(); testItr != tests.End(); ++testItr) { for (Value::ConstValueIterator testItr = tests.Begin(); testItr != tests.End(); ++testItr) {
testCount++;
const Value& data = (*testItr)["data"];
bool expected = (*testItr)["valid"].GetBool();
const char* description = (*testItr)["description"].GetString(); const char* description = (*testItr)["description"].GetString();
validator.Reset(); if (!onlyRunDescription || strcmp(description, onlyRunDescription) == 0) {
bool actual = data.Accept(validator); const Value& data = (*testItr)["data"];
if (expected != actual) { bool expected = (*testItr)["valid"].GetBool();
char buffer[256]; testCount++;
sprintf(buffer, "%s \"%s\"", filename, description); validator.Reset();
GTEST_NONFATAL_FAILURE_(buffer); bool actual = data.Accept(validator);
if (expected != actual) {
char buffer[256];
sprintf(buffer, "%s \"%s\"", filename, description);
GTEST_NONFATAL_FAILURE_(buffer);
}
else
passCount++;
} }
else
passCount++;
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment