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

Function TEST

test/simple_thread_unittest.cc:79–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77} // namespace
78
79TEST(SimpleThreadTest, CreateAndJoin) {
80 int stack_int = 0;
81
82 SetIntRunner runner(&stack_int, 7);
83 EXPECT_EQ(0, stack_int);
84
85 DelegateSimpleThread thread(&runner, "int_setter");
86 EXPECT_FALSE(thread.HasBeenStarted());
87 EXPECT_FALSE(thread.HasBeenJoined());
88 EXPECT_EQ(0, stack_int);
89
90 thread.Start();
91 EXPECT_TRUE(thread.HasBeenStarted());
92 EXPECT_FALSE(thread.HasBeenJoined());
93
94 thread.Join();
95 EXPECT_TRUE(thread.HasBeenStarted());
96 EXPECT_TRUE(thread.HasBeenJoined());
97 EXPECT_EQ(7, stack_int);
98}
99
100TEST(SimpleThreadTest, WaitForEvent) {
101 // Create a thread, and wait for it to signal us.

Callers

nothing calls this directly

Calls 11

IntToStringFunction · 0.85
HasBeenStartedMethod · 0.80
IsSignaledMethod · 0.80
tidMethod · 0.80
AddWorkMethod · 0.80
JoinAllMethod · 0.80
StartMethod · 0.45
JoinMethod · 0.45
WaitMethod · 0.45
nameMethod · 0.45
GetNextMethod · 0.45

Tested by

no test coverage detected