get basic tests running

This commit is contained in:
Tim Aitken 2023-09-16 12:14:56 -07:00
parent b69334ba82
commit 18dc444caf
2 changed files with 8 additions and 3 deletions

View File

@ -1083,6 +1083,9 @@ bool OurReader::readValue() {
case tokenNumber: case tokenNumber:
successful = decodeNumber(token); successful = decodeNumber(token);
break; break;
case tokenHexadecimal:
successful = decodeHexadecimal(token);
break;
case tokenString: case tokenString:
successful = decodeString(token); successful = decodeString(token);
break; break;
@ -1969,7 +1972,7 @@ CharReader* CharReaderBuilder::newCharReader() const {
features.failIfExtra_ = settings_["failIfExtra"].asBool(); features.failIfExtra_ = settings_["failIfExtra"].asBool();
features.rejectDupKeys_ = settings_["rejectDupKeys"].asBool(); features.rejectDupKeys_ = settings_["rejectDupKeys"].asBool();
features.allowSpecialFloats_ = settings_["allowSpecialFloats"].asBool(); features.allowSpecialFloats_ = settings_["allowSpecialFloats"].asBool();
features.allowHexadecimal_ = settings_["allowHexacecimal"].asBool(); features.allowHexadecimal_ = settings_["allowHexadecimal"].asBool();
features.skipBom_ = settings_["skipBom"].asBool(); features.skipBom_ = settings_["skipBom"].asBool();
return new OurCharReader(collectComments, features); return new OurCharReader(collectComments, features);
} }
@ -1987,7 +1990,7 @@ bool CharReaderBuilder::validate(Json::Value* invalid) const {
"failIfExtra", "failIfExtra",
"rejectDupKeys", "rejectDupKeys",
"allowSpecialFloats", "allowSpecialFloats",
"allowHexacecimal", "allowHexadecimal",
"skipBom", "skipBom",
}; };
for (auto si = settings_.begin(); si != settings_.end(); ++si) { for (auto si = settings_.begin(); si != settings_.end(); ++si) {

View File

@ -3577,6 +3577,8 @@ JSONTEST_FIXTURE_LOCAL(CharReaderAllowHexadecimal, disallowHex) {
JSONTEST_FIXTURE_LOCAL(CharReaderAllowHexadecimal, hexObject) { JSONTEST_FIXTURE_LOCAL(CharReaderAllowHexadecimal, hexObject) {
Json::CharReaderBuilder b; Json::CharReaderBuilder b;
b.settings_["allowHexadecimal"] = true; b.settings_["allowHexadecimal"] = true;
Json::Value invalid;
JSONTEST_ASSERT(b.validate(&invalid)) << invalid;
CharReaderPtr reader(b.newCharReader()); CharReaderPtr reader(b.newCharReader());
{ {
Json::Value root; Json::Value root;
@ -3622,7 +3624,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderAllowHexadecimal, hexNumbers) {
const char* c0 = td.in.c_str(); const char* c0 = td.in.c_str();
const char* c1 = c0 + td.in.size(); const char* c1 = c0 + td.in.size();
bool ok = reader->parse(c0, c1, &root, &errs); bool ok = reader->parse(c0, c1, &root, &errs);
JSONTEST_ASSERT_EQUAL(td.ok, ok); JSONTEST_ASSERT(td.ok == ok) << "in: " << td.in;
if (td.ok) if (td.ok)
{ {
JSONTEST_ASSERT_EQUAL(0u, errs.size()); JSONTEST_ASSERT_EQUAL(0u, errs.size());