/[svn]/linuxsampler/trunk/src/testcases/MutexTest.h
ViewVC logotype

Contents of /linuxsampler/trunk/src/testcases/MutexTest.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 57 - (show annotations) (download) (as text)
Sun May 2 17:45:43 2004 UTC (19 years, 11 months ago) by schoenebeck
File MIME type: text/x-c++hdr
File size: 1047 byte(s)
* src/common/Thread.cpp: method StartThread() now blocks until thread
  actually runs, mlockall() will only be applied for realtime threads
* libtoolized liblinuxsampler
* initiated automatic unit tests against the LinuxSampler codebase
  (see src/testcases): already added a couple of tests for the Thread and
  Mutex classes, you have to explicitly compile the unit tests by running
  'make testcases' (you need to have cppunit installed though) and then you
  can run the console version of the test runner by calling
  'src/testcases/linuxsamplertest'
* src/Sampler.h: added API documentation

1 #ifndef __LS_MUTEXTEST_H__
2 #define __LS_MUTEXTEST_H__
3
4 #include <cppunit/TestFixture.h>
5 #include <cppunit/extensions/HelperMacros.h>
6
7 // needed for sleep() and usleep() calls
8 #include <unistd.h>
9
10 // the Mutex class we want to test
11 #include "../common/Mutex.h"
12
13 // we need an additional thread to test the Mutex class
14 #include "../common/Thread.h"
15
16 class MutexTest : public CppUnit::TestFixture {
17
18 CPPUNIT_TEST_SUITE(MutexTest);
19 CPPUNIT_TEST(testLockAndUnlockBySingleThread);
20 CPPUNIT_TEST(testLock);
21 CPPUNIT_TEST(testUnlock);
22 CPPUNIT_TEST(testDoubleLock);
23 CPPUNIT_TEST_SUITE_END();
24
25 private:
26 class ConcurrentThread : public Thread {
27 public:
28 int resource;
29 Mutex mutex;
30
31 ConcurrentThread();
32 int Main();
33 };
34 public:
35 void setUp();
36 void tearDown();
37
38 void testLockAndUnlockBySingleThread();
39 void testLock();
40 void testUnlock();
41 void testDoubleLock();
42 };
43
44 #endif // __LS_MUTEXTEST_H__

  ViewVC Help
Powered by ViewVC