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

Function TEST_F

test/test_executor.cpp:21–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19};
20
21TEST_F(ExecutorTest, can_execute_normal_function) {
22 struct S {
23 static int function(int i) {
24 return value() += i;
25 }
26 static int& value() {
27 static int v = 1;
28 return v;
29 }
30 };
31 auto future = inplace_executor.execute(S::function, 10086);
32 ASSERT_TRUE(future.valid());
33 ASSERT_TRUE(future.ready());
34 ASSERT_EQ(10087, future.get());
35 future = async(inplace_executor, S::function, 1);
36 ASSERT_TRUE(future.valid());
37 ASSERT_TRUE(future.ready());
38 ASSERT_EQ(10088, future.get());
39 inplace_executor.submit(S::function, 1);
40 ASSERT_EQ(10089, S::value());
41}
42
43TEST_F(ExecutorTest, can_execute_member_function) {
44 struct S {

Callers

nothing calls this directly

Calls 15

asyncFunction · 0.85
valueFunction · 0.85
submitMethod · 0.80
get_futureMethod · 0.80
set_valueMethod · 0.80
is_running_inMethod · 0.80
set_worker_numberMethod · 0.80
wait_forMethod · 0.80
set_local_capacityMethod · 0.80
wakeup_one_workerMethod · 0.80
set_balance_intervalMethod · 0.80

Tested by

no test coverage detected