Skip to content
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.

Commit

Permalink
Add chunk parsing tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
canatella committed Jan 6, 2017
1 parent bbf6855 commit c67b94b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,23 @@ JSON11_TEST_CASE(json11_test) {
std::vector<Point> points = { { 1, 2 }, { 10, 20 }, { 100, 200 } };
std::string points_json = Json(points).dump();
printf("%s\n", points_json.c_str());

/* Test chunk parsing */
JsonParser parser = { JsonParse::COMMENTS };
for (auto c: simple_test) {
parser.consume(std::string(1, c));
}
my_json = parser.json();
JSON11_TEST_ASSERT(my_json == json);

parser.reset();
for (auto c: comment_test) {
parser.consume(std::string(1, c));
}

my_json = parser.json();
JSON11_TEST_ASSERT(parser.last_error().empty());
JSON11_TEST_ASSERT(my_json == json_comment);
}

#if JSON11_TEST_STANDALONE_MAIN
Expand Down

0 comments on commit c67b94b

Please sign in to comment.