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

Diff of /linuxsampler/trunk/src/testcases/ThreadTest.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 63 by schoenebeck, Tue May 4 18:52:24 2004 UTC revision 1221 by schoenebeck, Wed Jun 6 18:50:03 2007 UTC
# Line 16  Line 16 
16  class ThreadTest : public CppUnit::TestFixture {  class ThreadTest : public CppUnit::TestFixture {
17    
18      CPPUNIT_TEST_SUITE(ThreadTest);      CPPUNIT_TEST_SUITE(ThreadTest);
19        CPPUNIT_TEST(printTestSuiteName);
20      CPPUNIT_TEST(testThreadRunning);      CPPUNIT_TEST(testThreadRunning);
21      CPPUNIT_TEST(testSignalStopThread);      CPPUNIT_TEST(testSignalStopThread);
22      CPPUNIT_TEST(testRelaunchThread);      CPPUNIT_TEST(testRelaunchThread);
# Line 23  class ThreadTest : public CppUnit::TestF Line 24  class ThreadTest : public CppUnit::TestF
24      CPPUNIT_TEST(testThreadKillableWhenWaiting);      CPPUNIT_TEST(testThreadKillableWhenWaiting);
25      CPPUNIT_TEST_SUITE_END();      CPPUNIT_TEST_SUITE_END();
26    
27      private:      public:
28          // this is our test implementation of the abstract base class Thread which we will use to test class Thread          // this is our test implementation of the abstract base class Thread which we will use to test class Thread
29          class DummyThread : public Thread {          class DummyThread : public LinuxSampler::Thread {
30              public:              public:
31                  bool wasRunning; // this variable is false on startup and will be switched to true by the thread, so we can check if the thread actually runs                  bool wasRunning; // this variable is false on startup and will be switched to true by the thread, so we can check if the thread actually runs
32                    volatile int someVariable; // we constantly set this variable to -1 in the DummyThread Main() loop, so we can check in our main test thread if the DummyThread is still running by changing that value to something else than -1
33    
34                  DummyThread();                  DummyThread();
35                  int Main();                  int Main();
36          } dummythread;          };
37    
38        private:
39          // this is only a helper thread to avoid that the entire test case run hangs when we try to stop the dummy thread          // this is only a helper thread to avoid that the entire test case run hangs when we try to stop the dummy thread
40          class HelperThread : public Thread {          class HelperThread : public LinuxSampler::Thread {
41              private:              private:
42                  DummyThread* pDummyThread;                  DummyThread* pDummyThread;
43              public:              public:
# Line 42  class ThreadTest : public CppUnit::TestF Line 45  class ThreadTest : public CppUnit::TestF
45    
46                  HelperThread(DummyThread* pDummyThread);                  HelperThread(DummyThread* pDummyThread);
47                  int Main();                  int Main();
48                    bool dummyThreadWasNotRunningAnymoreAfter_StopThread_call();
49          };          };
50    
51          // this simulates a thread that is waiting for a condition (thus sleeping til then)          // this simulates a thread that is waiting for a condition (thus sleeping til then)
52          class WaitingThread : public Thread {          class WaitingThread : public LinuxSampler::Thread {
53              public:              public:
54                  WaitingThread();                  WaitingThread();
55                  int Main();                  int Main();
56              private:              private:
57                  Condition condition;                  LinuxSampler::Condition condition;
58          };          };
59      public:      public:
60          void setUp() {          void setUp() {
# Line 59  class ThreadTest : public CppUnit::TestF Line 63  class ThreadTest : public CppUnit::TestF
63          void tearDown() {          void tearDown() {
64          }          }
65    
66            void printTestSuiteName();
67    
68          void testThreadRunning();          void testThreadRunning();
69          void testSignalStopThread();          void testSignalStopThread();
70          void testRelaunchThread();          void testRelaunchThread();

Legend:
Removed from v.63  
changed lines
  Added in v.1221

  ViewVC Help
Powered by ViewVC