13 |
// we need an additional thread to test the Mutex class |
// we need an additional thread to test the Mutex class |
14 |
#include "../common/Thread.h" |
#include "../common/Thread.h" |
15 |
|
|
16 |
|
using namespace LinuxSampler; |
17 |
|
|
18 |
class MutexTest : public CppUnit::TestFixture { |
class MutexTest : public CppUnit::TestFixture { |
19 |
|
|
20 |
CPPUNIT_TEST_SUITE(MutexTest); |
CPPUNIT_TEST_SUITE(MutexTest); |
21 |
|
CPPUNIT_TEST(printTestSuiteName); |
22 |
CPPUNIT_TEST(testLockAndUnlockBySingleThread); |
CPPUNIT_TEST(testLockAndUnlockBySingleThread); |
23 |
CPPUNIT_TEST(testLock); |
CPPUNIT_TEST(testLock); |
24 |
CPPUNIT_TEST(testUnlock); |
CPPUNIT_TEST(testUnlock); |
35 |
|
|
36 |
ConcurrentThread(); |
ConcurrentThread(); |
37 |
int Main(); |
int Main(); |
38 |
|
using Thread::SignalStartThread; // make method public |
39 |
}; |
}; |
40 |
|
|
41 |
// dummy thread we use to check if the Mutex falsely blcoks if we do a double lock and to avoid that our unit test main thread gets blocked |
// dummy thread we use to check if the Mutex falsely blcoks if we do a double lock and to avoid that our unit test main thread gets blocked |
45 |
|
|
46 |
DummyThread(); |
DummyThread(); |
47 |
int Main(); |
int Main(); |
48 |
|
using Thread::SignalStartThread; // make method public |
49 |
private: |
private: |
50 |
Mutex mutex; |
Mutex mutex; |
51 |
}; |
}; |
55 |
void setUp(); |
void setUp(); |
56 |
void tearDown(); |
void tearDown(); |
57 |
|
|
58 |
|
void printTestSuiteName(); |
59 |
|
|
60 |
void testLockAndUnlockBySingleThread(); |
void testLockAndUnlockBySingleThread(); |
61 |
void testLock(); |
void testLock(); |
62 |
void testUnlock(); |
void testUnlock(); |