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

Function TEST

test/lazy_instance_unittest.cc:63–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61 LAZY_INSTANCE_INITIALIZER;
62
63TEST(LazyInstanceTest, Basic) {
64 {
65 butil::ShadowingAtExitManager shadow;
66
67 EXPECT_EQ(0, constructed_seq_.GetNext());
68 EXPECT_EQ(0, destructed_seq_.GetNext());
69
70 lazy_logger.Get();
71 EXPECT_EQ(2, constructed_seq_.GetNext());
72 EXPECT_EQ(1, destructed_seq_.GetNext());
73
74 lazy_logger.Pointer();
75 EXPECT_EQ(3, constructed_seq_.GetNext());
76 EXPECT_EQ(2, destructed_seq_.GetNext());
77 }
78 EXPECT_EQ(4, constructed_seq_.GetNext());
79 EXPECT_EQ(4, destructed_seq_.GetNext());
80}
81
82static butil::LazyInstance<SlowConstructor> lazy_slow =
83 LAZY_INSTANCE_INITIALIZER;

Callers

nothing calls this directly

Calls 7

PointerMethod · 0.80
AddWorkMethod · 0.80
JoinAllMethod · 0.80
SetDeletedPtrMethod · 0.80
GetNextMethod · 0.45
GetMethod · 0.45
StartMethod · 0.45

Tested by

no test coverage detected