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:
4 changed files with 17 additions and 172 deletions

View File

@@ -10,56 +10,48 @@
#include "testutil.h"
class ConditionLock : public ::testing::Test, public TestUtil {
protected:
void TearDown() override {
if (adapter != nullptr) delete adapter;
}
public:
PIConditionLock* m = new PIConditionLock();
};
TEST_F(ConditionLock, lock_is_protect) {
PIConditionLock m;
m.lock();
m->lock();
bool isProtect = true;
createThread([&](){
m.lock();
m->lock();
isProtect = false;
});
ASSERT_TRUE(isProtect);
}
TEST_F(ConditionLock, unlock_is_release) {
PIConditionLock m;
m.lock();
m->lock();
volatile bool isReleased = false;
m.unlock();
m->unlock();
createThread([&](){
m.lock();
m->lock();
isReleased = true;
m.unlock();
m->unlock();
});
EXPECT_TRUE(thread->waitForFinish(WAIT_THREAD_TIME_MS));
ASSERT_TRUE(isReleased);
}
TEST_F(ConditionLock, tryLock_is_false_when_locked) {
PIConditionLock m;
createThread([&](){
m.lock();
m->lock();
piMSleep(WAIT_THREAD_TIME_MS);
});
ASSERT_FALSE(m.tryLock());
ASSERT_FALSE(m->tryLock());
}
TEST_F(ConditionLock, tryLock_is_true_when_unlocked) {
PIConditionLock m;
ASSERT_TRUE(m.tryLock());
ASSERT_TRUE(m->tryLock());
}
TEST_F(ConditionLock, tryLock_is_recursive_lock_enable) {
PIConditionLock m;
m.lock();
ASSERT_TRUE(m.tryLock());
m->lock();
ASSERT_TRUE(m->tryLock());
}