Fixed concurrent tests

git-svn-id: svn://db.shs.com.ru/pip@892 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
5 changed files with 15 additions and 34 deletions

View File

@@ -1,7 +1,3 @@
//
// Created by fomenko on 26.09.2019.
//
#include "gtest/gtest.h"
#include "gmock/gmock.h"
@@ -16,27 +12,27 @@ public:
TEST_F(ConditionLock, lock_is_protect) {
m->lock();
bool isProtect = true;
bool* isProtect = new bool(true);
createThread([&](){
m->lock();
isProtect = false;
*isProtect = false;
});
ASSERT_TRUE(isProtect);
EXPECT_FALSE(thread->waitForFinish(WAIT_THREAD_TIME_MS));
ASSERT_TRUE(*isProtect);
}
TEST_F(ConditionLock, unlock_is_release) {
m->lock();
volatile bool isReleased = false;
bool* isReleased = new bool(false);
m->unlock();
createThread([&](){
m->lock();
isReleased = true;
*isReleased = true;
m->unlock();
});
EXPECT_TRUE(thread->waitForFinish(WAIT_THREAD_TIME_MS));
ASSERT_TRUE(isReleased);
ASSERT_TRUE(*isReleased);
}
TEST_F(ConditionLock, tryLock_is_false_when_locked) {