| 19 | }; |
| 20 | |
| 21 | TEST_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 | |
| 43 | TEST_F(ExecutorTest, can_execute_member_function) { |
| 44 | struct S { |
nothing calls this directly
no test coverage detected