OpenWalnut
1.4.0
|
Tests the WWorkerThread class. More...
#include <WWorkerThread_test.h>
Classes | |
class | ExceptionalFuncType |
A function that throws exceptions. More... | |
class | FuncType |
A threaded function. More... | |
Public Member Functions | |
void | testSingleThread (void) |
Test if calculation with a single thread works. | |
void | testStopThread () |
Test if the thread gets shutdown correctly. | |
void | testMultipleThreads () |
Test if multiple threads correctly compute the result. | |
void | testNoFunction () |
Providing a zero-Pointer as function should cause an exception. | |
void | testThreadId () |
An invalid thread id should cause an exception. | |
void | testExceptions () |
Test if exceptions get handled correctly. | |
Private Member Functions | |
void | stopTestDone () |
A utility function. | |
void | handleException (WException const &e) |
Another one. | |
Private Attributes | |
bool | m_stopped |
the thread was stopped? | |
bool | m_exceptionHandled |
the exception was handled? |
Tests the WWorkerThread class.
Definition at line 38 of file WWorkerThread_test.h.
void WWorkerThreadTest::handleException | ( | WException const & | e | ) | [inline, private] |
Another one.
e | An exception. |
Definition at line 253 of file WWorkerThread_test.h.
References m_exceptionHandled, and WException::what().
Referenced by testExceptions().
void WWorkerThreadTest::stopTestDone | ( | ) | [inline, private] |
A utility function.
Definition at line 243 of file WWorkerThread_test.h.
References m_stopped.
Referenced by testSingleThread(), and testStopThread().
void WWorkerThreadTest::testExceptions | ( | ) | [inline] |
Test if exceptions get handled correctly.
Definition at line 225 of file WWorkerThread_test.h.
References handleException(), m_exceptionHandled, WThreadedRunner::run(), WWorkerThread< Function_T >::subscribeExceptionSignal(), and WThreadedRunner::wait().
void WWorkerThreadTest::testMultipleThreads | ( | ) | [inline] |
Test if multiple threads correctly compute the result.
Definition at line 177 of file WWorkerThread_test.h.
References WThreadedRunner::run(), and WThreadedRunner::wait().
void WWorkerThreadTest::testNoFunction | ( | ) | [inline] |
Providing a zero-Pointer as function should cause an exception.
Definition at line 202 of file WWorkerThread_test.h.
void WWorkerThreadTest::testSingleThread | ( | void | ) | [inline] |
Test if calculation with a single thread works.
Definition at line 139 of file WWorkerThread_test.h.
References m_stopped, WThreadedRunner::run(), stopTestDone(), WWorkerThread< Function_T >::subscribeStopSignal(), and WThreadedRunner::wait().
void WWorkerThreadTest::testStopThread | ( | ) | [inline] |
Test if the thread gets shutdown correctly.
Definition at line 158 of file WWorkerThread_test.h.
References m_stopped, WThreadedRunner::requestStop(), WThreadedRunner::run(), stopTestDone(), WWorkerThread< Function_T >::subscribeStopSignal(), and WThreadedRunner::wait().
void WWorkerThreadTest::testThreadId | ( | ) | [inline] |
An invalid thread id should cause an exception.
Definition at line 211 of file WWorkerThread_test.h.
bool WWorkerThreadTest::m_exceptionHandled [private] |
the exception was handled?
Definition at line 265 of file WWorkerThread_test.h.
Referenced by handleException(), and testExceptions().
bool WWorkerThreadTest::m_stopped [private] |
the thread was stopped?
Definition at line 262 of file WWorkerThread_test.h.
Referenced by stopTestDone(), testSingleThread(), and testStopThread().