restore coverage
This commit is contained in:
parent
a3757456fe
commit
28dc42d8d3
@ -199,8 +199,7 @@ TEST_F(Schema, TestSuite) {
|
|||||||
char validatorBuffer[65536];
|
char validatorBuffer[65536];
|
||||||
MemoryPoolAllocator<> validatorAllocator(validatorBuffer, sizeof(validatorBuffer));
|
MemoryPoolAllocator<> validatorAllocator(validatorBuffer, sizeof(validatorBuffer));
|
||||||
|
|
||||||
// DCOLES - Reduce number by a factor of 100 to make it more reasonable and inline with other test counts
|
const int trialCount = 100000;
|
||||||
const int trialCount = 1000;
|
|
||||||
int testCount = 0;
|
int testCount = 0;
|
||||||
clock_t start = clock();
|
clock_t start = clock();
|
||||||
for (int i = 0; i < trialCount; i++) {
|
for (int i = 0; i < trialCount; i++) {
|
||||||
|
@ -118,13 +118,18 @@ TEST(SchemaValidator, Hasher) {
|
|||||||
EXPECT_FALSE(d.HasParseError());\
|
EXPECT_FALSE(d.HasParseError());\
|
||||||
EXPECT_TRUE(expected == d.Accept(validator));\
|
EXPECT_TRUE(expected == d.Accept(validator));\
|
||||||
EXPECT_TRUE(expected == validator.IsValid());\
|
EXPECT_TRUE(expected == validator.IsValid());\
|
||||||
|
ValidateErrorCode code = validator.GetInvalidSchemaCode();\
|
||||||
|
if (expected) {\
|
||||||
|
EXPECT_TRUE(code == kValidateErrorNone);\
|
||||||
|
EXPECT_TRUE(validator.GetInvalidSchemaKeyword() == 0);\
|
||||||
|
}\
|
||||||
if ((expected) && !validator.IsValid()) {\
|
if ((expected) && !validator.IsValid()) {\
|
||||||
StringBuffer sb;\
|
StringBuffer sb;\
|
||||||
validator.GetInvalidSchemaPointer().StringifyUriFragment(sb);\
|
validator.GetInvalidSchemaPointer().StringifyUriFragment(sb);\
|
||||||
printf("Invalid schema: %s\n", sb.GetString());\
|
printf("Invalid schema: %s\n", sb.GetString());\
|
||||||
printf("Invalid keyword: %s\n", validator.GetInvalidSchemaKeyword());\
|
printf("Invalid keyword: %s\n", validator.GetInvalidSchemaKeyword());\
|
||||||
printf("Invalid code: %d\n", validator.GetInvalidSchemaCode());\
|
printf("Invalid code: %d\n", code);\
|
||||||
printf("Invalid message: %s\n", GetValidateError_En(validator.GetInvalidSchemaCode()));\
|
printf("Invalid message: %s\n", GetValidateError_En(code));\
|
||||||
sb.Clear();\
|
sb.Clear();\
|
||||||
validator.GetInvalidDocumentPointer().StringifyUriFragment(sb);\
|
validator.GetInvalidDocumentPointer().StringifyUriFragment(sb);\
|
||||||
printf("Invalid document: %s\n", sb.GetString());\
|
printf("Invalid document: %s\n", sb.GetString());\
|
||||||
@ -2522,6 +2527,7 @@ TEST(SchemaValidator, ContinueOnErrors_RogueObject) {
|
|||||||
kValidateDefaultFlags | kValidateContinueOnErrorFlag, SchemaValidator, Pointer);
|
kValidateDefaultFlags | kValidateContinueOnErrorFlag, SchemaValidator, Pointer);
|
||||||
CrtAllocator::Free(schema);
|
CrtAllocator::Free(schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that when kValidateContinueOnErrorFlag is set, a string appearing for an array or object property is handled
|
// Test that when kValidateContinueOnErrorFlag is set, a string appearing for an array or object property is handled
|
||||||
// This tests that we don't blow up when there is a type mismatch.
|
// This tests that we don't blow up when there is a type mismatch.
|
||||||
TEST(SchemaValidator, ContinueOnErrors_RogueString) {
|
TEST(SchemaValidator, ContinueOnErrors_RogueString) {
|
||||||
@ -2544,6 +2550,10 @@ TEST(SchemaValidator, ContinueOnErrors_RogueString) {
|
|||||||
CrtAllocator::Free(schema);
|
CrtAllocator::Free(schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(SchemaValidator, Schema_UnknownError) {
|
||||||
|
ASSERT_TRUE(SchemaValidator::SchemaType::GetValidateErrorKeyword(kValidateErrors).GetString() == std::string("null"));
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__clang__)
|
#if defined(_MSC_VER) || defined(__clang__)
|
||||||
RAPIDJSON_DIAG_POP
|
RAPIDJSON_DIAG_POP
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user