MCPcopy Create free account
hub / github.com/apache/brpc / CheckFieldInContent

Function CheckFieldInContent

test/brpc_builtin_service_unittest.cpp:134–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132}
133
134void CheckFieldInContent(const brpc::Controller& cntl,
135 const char* name, int32_t expect) {
136 const std::string& content = cntl.response_attachment().to_string();
137 std::size_t pos = content.find(name);
138 ASSERT_TRUE(pos != std::string::npos);
139
140 int32_t val = 0;
141 ASSERT_EQ(1, sscanf(content.c_str() + pos + strlen(name), "%d", &val));
142 ASSERT_EQ(expect, val) << "name=" << name;
143}
144
145void CheckAnnotation(const brpc::Controller& cntl, int64_t expect) {
146 const std::string& content = cntl.response_attachment().to_string();

Callers 2

TestConnectionsMethod · 0.85
TEST_FFunction · 0.85

Calls 3

to_stringMethod · 0.45
findMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected