17 #include <gtest/gtest.h> 18 #include <gmock/gmock.h> 37 std::unique_lock <std::mutex> lck(this->
test_mtx);
46 std::unique_lock <std::mutex> lck(this->
test_mtx);
66 hard_worker = std::make_shared<HardWorker>();
68 EXPECT_FALSE(hard_worker->isRunning());
73 hard_worker->shutdown();
76 EXPECT_FALSE(hard_worker->isRunning());
92 EXPECT_EQ(
false, hard_worker->getHasWorked());
93 EXPECT_EQ(
false, hard_worker->isRunning());
96 EXPECT_EQ(
true, hard_worker->start());
99 EXPECT_EQ(
false, hard_worker->start());
102 std::this_thread::sleep_for(std::chrono::milliseconds(200));
104 EXPECT_EQ(
true, hard_worker->isRunning());
107 EXPECT_EQ(
true, hard_worker->shutdown());
108 EXPECT_EQ(
false, hard_worker->shutdown());
110 hard_worker->waitForShutdown(std::chrono::milliseconds(1000));
113 EXPECT_EQ(
true, hard_worker->getHasWorked());
std::condition_variable test_cv
~HardWorker() override=default
std::shared_ptr< HardWorker > hard_worker
TEST_F(RunnableServiceTest, Sanity)