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

Function TEST_F

test/string_util_unittest.cc:1170–1188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1168};
1169
1170TEST_F(WriteIntoTest, WriteInto) {
1171 // Validate that WriteInto reserves enough space and
1172 // sizes a string correctly.
1173 WritesCorrectly(1);
1174 WritesCorrectly(2);
1175 WritesCorrectly(5000);
1176
1177 // Validate that WriteInto doesn't modify other strings
1178 // when using a Copy-on-Write implementation.
1179 const char kLive[] = "live";
1180 const char kDead[] = "dead";
1181 const std::string live = kLive;
1182 std::string dead = live;
1183 strncpy(WriteInto(&dead, 5), kDead, 4);
1184 EXPECT_EQ(kDead, dead);
1185 EXPECT_EQ(4u, dead.size());
1186 EXPECT_EQ(kLive, live);
1187 EXPECT_EQ(4u, live.size());
1188}
1189
1190} // namespace butil

Callers

nothing calls this directly

Calls 2

WriteIntoFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected