MCPcopy Create free account
hub / github.com/baidu/babylon / TEST_F

Function TEST_F

test/reusable/test_traits.cpp:261–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259
260#if BABYLON_USE_PROTOBUF
261TEST_F(ReusableTraitsTest, message_reusable) {
262 ASSERT_TRUE(ReusableTraits<TestMessage>::REUSABLE);
263 ASSERT_LT(0, sizeof(ReusableTraits<TestMessage>::AllocationMetadata));
264 Reuse::AllocationMetadata<TestMessage> meta;
265 auto& m = *allocator.create_object<TestMessage>();
266 ::std::cerr << "arena " << m.GetArena() << ::std::endl;
267 m.mutable_s()->reserve(10086);
268 ::std::cerr << "after arena " << m.GetArena() << ::std::endl;
269 Reuse::reconstruct(m, allocator);
270 ASSERT_TRUE(m.s().empty());
271 ASSERT_LE(10086, m.s().capacity());
272 Reuse::update_allocation_metadata(m, meta);
273 {
274 auto& mm =
275 *Reuse::create_with_allocation_metadata<TestMessage>(allocator, meta);
276 ASSERT_LE(10086, mm.s().capacity());
277 ASSERT_TRUE(mm.s().empty());
278 }
279}
280
281/*
282TEST_F(ReusableTraitsTest, message_repeated_reusable) {

Callers

nothing calls this directly

Calls 3

reserveMethod · 0.45
emptyMethod · 0.45
capacityMethod · 0.45

Tested by

no test coverage detected