Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
sabudilovskiy committed Oct 8, 2024
1 parent 6662b0a commit a7307a3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion gtest/parsers/fixtures.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ struct GeneratorBoost : testing::Test {
TEST_F(DomBoost, Name) __VA_ARGS__ \
TEST_F(HandlerRapid, Name) __VA_ARGS__ \
TEST_F(HandlerBoost, Name) __VA_ARGS__ \
TEST_F(GeneratorBoost, Name) __VA_ARGS__
TEST_F(GeneratorBoost, Name) __VA_ARGS__

// clang-format on
14 changes: 7 additions & 7 deletions gtest/parsers/test_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ TEST(StreamParsing, Int) {
parser parser(got);
parser.parse(STR(R"(
{"int_field": 1
)"));
)"), false);
parser.parse(STR(R"(
23}
)"),
Expand All @@ -54,7 +54,7 @@ TEST(StreamParsing, DoublePointLeft) {
parser parser(got);
parser.parse(STR(R"(
{"double_field": 21.
)"));
)"), false);
parser.parse(STR(R"(
12}
)"),
Expand All @@ -69,7 +69,7 @@ TEST(StreamParsing, DoublePointRight) {
parser parser(got);
parser.parse(STR(R"(
{"double_field": 21
)"));
)"), false);
parser.parse(STR(R"(
.12}
)"),
Expand All @@ -88,7 +88,7 @@ TEST(StreamParsing, Bool) {
std::string_view second = full_json.substr(full_json.size() - i, i);
TestObject got;
parser parser(got);
parser.parse(first);
parser.parse(first, false);
parser.parse(second, true);

EXPECT_EQ(expected, got);
Expand All @@ -105,7 +105,7 @@ TEST(StreamParsing, Null) {
std::string_view second = full_json.substr(full_json.size() - i, i);
TestObject got;
parser parser(got);
parser.parse(first);
parser.parse(first, false);
parser.parse(second, true);

EXPECT_EQ(expected, got);
Expand All @@ -125,7 +125,7 @@ field": "test"}

TestObject got;
parser parser(got);
parser.parse(first);
parser.parse(first, false);
parser.parse(second, true);
EXPECT_EQ(expected, got);
}
Expand Down Expand Up @@ -175,7 +175,7 @@ TEST(StreamParser, NestedObjectsInArray) {
std::string_view first = json.substr(0, i);
std::string_view second = json.substr(i);

parser.parse(first);
parser.parse(first, false);
parser.parse(second, true);
EXPECT_EQ(expected, got) << "failed on : " << i;
}
Expand Down
2 changes: 1 addition & 1 deletion include/tgbm/tools/json_tools/boost_parse_generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ struct stream_parser {
stream_parser(T& t) : p(::boost::json::parse_options{}, t) {
}

void parse(std::string_view data, bool end = false) {
void parse(std::string_view data, bool end) {
p.write_some(!end, data.data(), data.size(), ec);
if (ec || (end && !p.handler().ended)) {
LOG_ERR("ec: {}, ended: {}", ec.message(), p.handler().ended);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ struct ignore_parser {
break;
case event_holder::key_part:
case event_holder::string_part:
co_yield {};
break;
unreachable();
case event_holder::array_end:
case event_holder::object_end:
depth--;
Expand Down

0 comments on commit a7307a3

Please sign in to comment.