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

Function TEST_F

test/flat_map_unittest.cpp:56–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54};
55
56TEST_F(FlatMapTest, initialization_of_values) {
57 // Construct non-POD values w/o copy-construction.
58 butil::FlatMap<int, Foo> map;
59 ASSERT_EQ(0, map.init(32));
60 ASSERT_EQ(0, g_foo_ctor);
61 ASSERT_EQ(0, g_foo_copy_ctor);
62 ASSERT_EQ(0, g_foo_assign);
63 map[1];
64 ASSERT_EQ(1, g_foo_ctor);
65 ASSERT_EQ(0, g_foo_copy_ctor);
66 ASSERT_EQ(0, g_foo_assign);
67
68 // Zeroize POD values.
69 butil::FlatMap<int, Bar> map2;
70 ASSERT_EQ(0, map2.init(32));
71 Bar& g = map2[1];
72 ASSERT_EQ(0, g.x);
73 g.x = 123;
74 ASSERT_EQ(1u, map2.erase(1));
75 ASSERT_EQ(123, g.x); // g is still accessible in this case.
76 Bar& g2 = map2[1];
77 ASSERT_EQ(&g, &g2);
78 ASSERT_EQ(0, g2.x);
79}
80
81TEST_F(FlatMapTest, swap_pooled_allocator) {
82 butil::details::PooledAllocator<int, 128> a1;

Callers

nothing calls this directly

Calls 15

flatmap_roundFunction · 0.85
tolowerFunction · 0.85
ascii_tolowerFunction · 0.85
strcasecmpFunction · 0.85
strncasecmpFunction · 0.85
string_printfFunction · 0.85
fill_position_hint_mapFunction · 0.85
list_flat_mapFunction · 0.85
Dummy1Class · 0.85
Dummy2Class · 0.85
flatmap_modFunction · 0.85
n_elapsedMethod · 0.80

Tested by

no test coverage detected