Removed hard unit tests for executor && fixed another tests
git-svn-id: svn://db.shs.com.ru/pip@890 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -23,21 +23,8 @@ protected:
|
||||
m.unlock();
|
||||
};
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
if (adapter != nullptr) delete adapter;
|
||||
}
|
||||
};
|
||||
|
||||
TEST(ThreadFuncAdapter, registerToInvoke_is_stdFun_invoke) {
|
||||
bool isInvoke = false;
|
||||
StdFunctionThreadFuncAdapter adapter([&](){
|
||||
isInvoke = true;
|
||||
});
|
||||
adapter.threadFunc()(adapter.data());
|
||||
ASSERT_TRUE(isInvoke);
|
||||
}
|
||||
|
||||
TEST_F(ConditionVariable, wait_is_block) {
|
||||
createThread();
|
||||
ASSERT_FALSE(thread->waitForFinish(WAIT_THREAD_TIME_MS));
|
||||
@@ -62,12 +49,10 @@ TEST_F(ConditionVariable, wait_is_unblock_when_notifyOne_after_wait) {
|
||||
}
|
||||
|
||||
TEST_F(ConditionVariable, wait_is_unblock_when_notifyAll_after_wait) {
|
||||
PIVector<StdFunctionThreadFuncAdapter*> adapters;
|
||||
PIVector<PIThread*> threads;
|
||||
|
||||
for (int i = 0; i < THREAD_COUNT; ++i) {
|
||||
adapters.push_back(new StdFunctionThreadFuncAdapter(adapterFunctionDefault));
|
||||
threads.push_back(new PIThread(adapters.back()->data(), adapters.back()->threadFunc()));
|
||||
threads.push_back(new PIThread([=](){ adapterFunctionDefault(); }));
|
||||
}
|
||||
|
||||
piForeach(PIThread* thread, threads) thread->startOnce();
|
||||
@@ -80,16 +65,13 @@ TEST_F(ConditionVariable, wait_is_unblock_when_notifyAll_after_wait) {
|
||||
}
|
||||
for (size_t i = 0; i < threads.size(); ++i) EXPECT_FALSE(threads[i]->isRunning()) << "Thread " << i << " still running";
|
||||
piForeach(PIThread* thread, threads) delete thread;
|
||||
piForeach(StdFunctionThreadFuncAdapter* adapter, adapters) delete adapter;
|
||||
}
|
||||
|
||||
TEST_F(ConditionVariable, wait_is_one_unblock_when_notifyOne) {
|
||||
PIVector<StdFunctionThreadFuncAdapter*> adapters;
|
||||
PIVector<PIThread*> threads;
|
||||
|
||||
for (int i = 0; i < THREAD_COUNT; ++i) {
|
||||
adapters.push_back(new StdFunctionThreadFuncAdapter(adapterFunctionDefault));
|
||||
threads.push_back(new PIThread(adapters.back()->data(), adapters.back()->threadFunc()));
|
||||
threads.push_back(new PIThread(adapterFunctionDefault));
|
||||
}
|
||||
|
||||
piForeach(PIThread* thread, threads) thread->startOnce();
|
||||
|
||||
Reference in New Issue
Block a user