MCPcopy Create free account
hub / github.com/chen3feng/toft / TestJsonString

Function TestJsonString

encoding/proto_json_format_test.cpp:46–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46void TestJsonString(const std::string& json_file) {
47 std::string styled_str;
48 toft::File::ReadAll(json_file, &styled_str);
49 toft::Person pb;
50 ProtoJsonFormat::ParseFromString(styled_str, &pb);
51
52 toft::Person expected_pb;
53 {
54 std::string content;
55 std::string path = "debug_string.txt";
56 toft::File::ReadAll(path, &content);
57 google::protobuf::TextFormat::ParseFromString(content, &expected_pb);
58 }
59 EXPECT_EQ(pb.SerializeAsString(), expected_pb.SerializeAsString());
60}
61
62TEST(JsonFormtTest, ParseFromFastJsonString) {
63 std::string path = "json_fast_string.txt";

Callers 1

TESTFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected