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); |
29 |
class DummyThread : public Thread { |
class DummyThread : public 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 |
|
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(); |
44 |
|
|
45 |
HelperThread(DummyThread* pDummyThread); |
HelperThread(DummyThread* pDummyThread); |
46 |
int Main(); |
int Main(); |
47 |
|
bool dummyThreadWasNotRunningAnymoreAfter_StopThread_call(); |
48 |
}; |
}; |
49 |
|
|
50 |
// 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) |
62 |
void tearDown() { |
void tearDown() { |
63 |
} |
} |
64 |
|
|
65 |
|
void printTestSuiteName(); |
66 |
|
|
67 |
void testThreadRunning(); |
void testThreadRunning(); |
68 |
void testSignalStopThread(); |
void testSignalStopThread(); |
69 |
void testRelaunchThread(); |
void testRelaunchThread(); |