OpenWalnut  1.5.0dev
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
WThreadedFunctionTest Class Reference

Tests the WThreadedFunction class. More...

#include <WThreadedFunction_test.h>

+ Inheritance diagram for WThreadedFunctionTest:
+ Collaboration diagram for WThreadedFunctionTest:

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. More...
 
void testStopThreads ()
 Status should be set correctly when threads are ordered to stop. More...
 
void testStopCondition ()
 The stop condition should be notified correctly. More...
 
void testExceptionHandling ()
 Exceptions should lead to the status beeing changed to W_THREADS_ABORTED. More...
 

Private Member Functions

void handleException (WException const &)
 Exception callback. More...
 

Private Attributes

WSharedObject< int > m_exceptionCounter
 a counter More...
 

Detailed Description

Tests the WThreadedFunction class.

Definition at line 41 of file WThreadedFunction_test.h.

Member Function Documentation

◆ handleException()

void WThreadedFunctionTest::handleException ( WException const &  )
inlineprivate

Exception callback.

Definition at line 262 of file WThreadedFunction_test.h.

References WSharedObject< T >::getWriteTicket(), and m_exceptionCounter.

Referenced by testExceptionHandling().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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 243 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().

+ Here is the call graph for this function:

◆ testMultipleThreads()

void WThreadedFunctionTest::testMultipleThreads ( )
inline

A function computed by multiple threads should correctly set its status and compute the correct results.

Definition at line 144 of file WThreadedFunction_test.h.

References WThreadedFunction< Function_T >::run(), WThreadedFunctionBase::status(), and WThreadedFunction< Function_T >::wait().

+ Here is the call graph for this function:

◆ testStopCondition()

void WThreadedFunctionTest::testStopCondition ( )
inline

The stop condition should be notified correctly.

Definition at line 224 of file WThreadedFunction_test.h.

References WThreadedFunctionBase::getThreadsDoneCondition(), WThreadedFunction< Function_T >::run(), and WThreadedFunctionBase::status().

+ Here is the call graph for this function:

◆ testStopThreads()

void WThreadedFunctionTest::testStopThreads ( )
inline

Status should be set correctly when threads are ordered to stop.

Definition at line 204 of file WThreadedFunction_test.h.

References WThreadedFunction< Function_T >::run(), WThreadedFunctionBase::status(), WThreadedFunction< Function_T >::stop(), and WThreadedFunction< Function_T >::wait().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_exceptionCounter

WSharedObject< int > WThreadedFunctionTest::m_exceptionCounter
private

a counter

Definition at line 268 of file WThreadedFunction_test.h.

Referenced by handleException(), and testExceptionHandling().


The documentation for this class was generated from the following file: