Progress validating the API.

This commit is contained in:
Daniel Lemire
2018-12-09 20:47:02 -05:00
parent a56e92a571
commit 52c4b65f1e
4 changed files with 137 additions and 15 deletions
+9 -2
View File
@@ -14,7 +14,14 @@ void compute_dump(ParsedJson::iterator &pjh) {
return; // we are done
}
// we have either an array or an object
pjh.down();
bool goingdown = pjh.down();
if(!goingdown) {
// we have an empty scope
if(inobject) std::cout<<"{}";
else std::cout<<"[]";
return;
}
// we have a non-empty scope and we are at the beginning of it
if (inobject) {
std::cout << "{";
assert(pjh.get_type() == '"');
@@ -40,7 +47,7 @@ void compute_dump(ParsedJson::iterator &pjh) {
}
std::cout << "]";
}
pjh.up();
assert(pjh.up());
}
int main(int argc, char *argv[]) {