| 60 | |
| 61 | #if __cplusplus >= 201103L |
| 62 | TEST_F(LockTimerTest, MutexWithRecorder) { |
| 63 | IntRecorder recorder; |
| 64 | MutexWithRecorder<std::mutex> mutex(recorder); |
| 65 | { |
| 66 | BAIDU_SCOPED_LOCK(mutex); |
| 67 | } |
| 68 | ASSERT_EQ(1u, recorder.get_value().num); |
| 69 | LOG(INFO) << recorder; |
| 70 | { |
| 71 | std::unique_lock<decltype(mutex) > lck(mutex); |
| 72 | lck.unlock(); |
| 73 | lck.lock(); |
| 74 | ASSERT_EQ(2u, recorder.get_value().num); |
| 75 | LOG(INFO) << recorder; |
| 76 | std::condition_variable cond; |
| 77 | cond.wait_for(lck, std::chrono::milliseconds(10)); |
| 78 | } |
| 79 | ASSERT_EQ(3u, recorder.get_value().num); |
| 80 | } |
| 81 | |
| 82 | TEST_F(LockTimerTest, MutexWithLatencyRecorder) { |
| 83 | LatencyRecorder recorder(10); |
nothing calls this directly
no test coverage detected