Skip to content

Commit 28dc42d

Browse files
author
Steve Hanson
committed
restore coverage
1 parent a375745 commit 28dc42d

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

test/perftest/schematest.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,7 @@ TEST_F(Schema, TestSuite) {
199199
char validatorBuffer[65536];
200200
MemoryPoolAllocator<> validatorAllocator(validatorBuffer, sizeof(validatorBuffer));
201201

202-
// DCOLES - Reduce number by a factor of 100 to make it more reasonable and inline with other test counts
203-
const int trialCount = 1000;
202+
const int trialCount = 100000;
204203
int testCount = 0;
205204
clock_t start = clock();
206205
for (int i = 0; i < trialCount; i++) {

test/unittest/schematest.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,18 @@ TEST(SchemaValidator, Hasher) {
118118
EXPECT_FALSE(d.HasParseError());\
119119
EXPECT_TRUE(expected == d.Accept(validator));\
120120
EXPECT_TRUE(expected == validator.IsValid());\
121+
ValidateErrorCode code = validator.GetInvalidSchemaCode();\
122+
if (expected) {\
123+
EXPECT_TRUE(code == kValidateErrorNone);\
124+
EXPECT_TRUE(validator.GetInvalidSchemaKeyword() == 0);\
125+
}\
121126
if ((expected) && !validator.IsValid()) {\
122127
StringBuffer sb;\
123128
validator.GetInvalidSchemaPointer().StringifyUriFragment(sb);\
124129
printf("Invalid schema: %s\n", sb.GetString());\
125130
printf("Invalid keyword: %s\n", validator.GetInvalidSchemaKeyword());\
126-
printf("Invalid code: %d\n", validator.GetInvalidSchemaCode());\
127-
printf("Invalid message: %s\n", GetValidateError_En(validator.GetInvalidSchemaCode()));\
131+
printf("Invalid code: %d\n", code);\
132+
printf("Invalid message: %s\n", GetValidateError_En(code));\
128133
sb.Clear();\
129134
validator.GetInvalidDocumentPointer().StringifyUriFragment(sb);\
130135
printf("Invalid document: %s\n", sb.GetString());\
@@ -2522,6 +2527,7 @@ TEST(SchemaValidator, ContinueOnErrors_RogueObject) {
25222527
kValidateDefaultFlags | kValidateContinueOnErrorFlag, SchemaValidator, Pointer);
25232528
CrtAllocator::Free(schema);
25242529
}
2530+
25252531
// Test that when kValidateContinueOnErrorFlag is set, a string appearing for an array or object property is handled
25262532
// This tests that we don't blow up when there is a type mismatch.
25272533
TEST(SchemaValidator, ContinueOnErrors_RogueString) {
@@ -2544,6 +2550,10 @@ TEST(SchemaValidator, ContinueOnErrors_RogueString) {
25442550
CrtAllocator::Free(schema);
25452551
}
25462552

2553+
TEST(SchemaValidator, Schema_UnknownError) {
2554+
ASSERT_TRUE(SchemaValidator::SchemaType::GetValidateErrorKeyword(kValidateErrors).GetString() == std::string("null"));
2555+
}
2556+
25472557
#if defined(_MSC_VER) || defined(__clang__)
25482558
RAPIDJSON_DIAG_POP
25492559
#endif

0 commit comments

Comments
 (0)