OpenWalnut
1.4.0
|
Tests the WThreadedFunction class. More...
#include <WThreadedFunction_test.h>
Classes | |
class | ExceptionalFuncType |
A function that throws exceptions. More... | |
class | FuncType |
A threaded function. More... | |
Public Member Functions | |
void | testMultipleThreads () |
A function computed by multiple threads should correctly set its status and compute the correct results. | |
void | testStopThreads () |
Status should be set correctly when threads are ordered to stop. | |
void | testStopCondition () |
The stop condition should be notified correctly. | |
void | testExceptionHandling () |
Exceptions should lead to the status beeing changed to W_THREADS_ABORTED. | |
Private Member Functions | |
void | handleException (WException const &) |
Exception callback. | |
Private Attributes | |
WSharedObject< int > | m_exceptionCounter |
a counter |
Tests the WThreadedFunction class.
Definition at line 40 of file WThreadedFunction_test.h.
void WThreadedFunctionTest::handleException | ( | WException const & | ) | [inline, private] |
Exception callback.
Definition at line 261 of file WThreadedFunction_test.h.
References WSharedObject< T >::getWriteTicket(), and m_exceptionCounter.
Referenced by testExceptionHandling().
void WThreadedFunctionTest::testExceptionHandling | ( | ) | [inline] |
Exceptions should lead to the status beeing changed to W_THREADS_ABORTED.
Also, exceptions should be forwarded to the exception handler.
Definition at line 242 of file WThreadedFunction_test.h.
References WSharedObject< T >::getReadTicket(), WSharedObject< T >::getWriteTicket(), handleException(), m_exceptionCounter, WThreadedFunction< Function_T >::run(), WThreadedFunctionBase::status(), WThreadedFunctionBase::subscribeExceptionSignal(), and WThreadedFunction< Function_T >::wait().
void WThreadedFunctionTest::testMultipleThreads | ( | ) | [inline] |
A function computed by multiple threads should correctly set its status and compute the correct results.
Definition at line 143 of file WThreadedFunction_test.h.
References WThreadedFunction< Function_T >::run(), WThreadedFunctionBase::status(), and WThreadedFunction< Function_T >::wait().
void WThreadedFunctionTest::testStopCondition | ( | ) | [inline] |
The stop condition should be notified correctly.
Definition at line 223 of file WThreadedFunction_test.h.
References WThreadedFunctionBase::getThreadsDoneCondition(), WThreadedFunction< Function_T >::run(), and WThreadedFunctionBase::status().
void WThreadedFunctionTest::testStopThreads | ( | ) | [inline] |
Status should be set correctly when threads are ordered to stop.
Definition at line 203 of file WThreadedFunction_test.h.
References WThreadedFunction< Function_T >::run(), WThreadedFunctionBase::status(), WThreadedFunction< Function_T >::stop(), and WThreadedFunction< Function_T >::wait().
WSharedObject< int > WThreadedFunctionTest::m_exceptionCounter [private] |
a counter
Definition at line 267 of file WThreadedFunction_test.h.
Referenced by handleException(), and testExceptionHandling().