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

Tests the WWorkerThread class. More...

#include <WWorkerThread_test.h>

+ Inheritance diagram for WWorkerThreadTest:
+ Collaboration diagram for WWorkerThreadTest:

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. More...
 
void testStopThread ()
 Test if the thread gets shutdown correctly. More...
 
void testMultipleThreads ()
 Test if multiple threads correctly compute the result. More...
 
void testNoFunction ()
 Providing a zero-Pointer as function should cause an exception. More...
 
void testThreadId ()
 An invalid thread id should cause an exception. More...
 
void testExceptions ()
 Test if exceptions get handled correctly. More...
 

Private Member Functions

void stopTestDone ()
 A utility function. More...
 
void handleException (WException const &e)
 Another one. More...
 

Private Attributes

bool m_stopped
 the thread was stopped? More...
 
bool m_exceptionHandled
 the exception was handled? More...
 

Detailed Description

Tests the WWorkerThread class.

Definition at line 39 of file WWorkerThread_test.h.

Member Function Documentation

◆ handleException()

void WWorkerThreadTest::handleException ( WException const &  e)
inlineprivate

Another one.

Parameters
eAn exception.

Definition at line 254 of file WWorkerThread_test.h.

References m_exceptionHandled, and WException::what().

Referenced by testExceptions().

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

◆ stopTestDone()

void WWorkerThreadTest::stopTestDone ( )
inlineprivate

A utility function.

Definition at line 244 of file WWorkerThread_test.h.

References m_stopped.

Referenced by testSingleThread(), and testStopThread().

+ Here is the caller graph for this function:

◆ testExceptions()

void WWorkerThreadTest::testExceptions ( )
inline

Test if exceptions get handled correctly.

Definition at line 226 of file WWorkerThread_test.h.

References handleException(), m_exceptionHandled, WThreadedRunner::run(), WWorkerThread< Function_T >::subscribeExceptionSignal(), and WThreadedRunner::wait().

+ Here is the call graph for this function:

◆ testMultipleThreads()

void WWorkerThreadTest::testMultipleThreads ( )
inline

Test if multiple threads correctly compute the result.

Definition at line 178 of file WWorkerThread_test.h.

References WThreadedRunner::run(), and WThreadedRunner::wait().

+ Here is the call graph for this function:

◆ testNoFunction()

void WWorkerThreadTest::testNoFunction ( )
inline

Providing a zero-Pointer as function should cause an exception.

Definition at line 203 of file WWorkerThread_test.h.

◆ testSingleThread()

void WWorkerThreadTest::testSingleThread ( void  )
inline

Test if calculation with a single thread works.

Definition at line 140 of file WWorkerThread_test.h.

References m_stopped, WThreadedRunner::run(), stopTestDone(), WWorkerThread< Function_T >::subscribeStopSignal(), and WThreadedRunner::wait().

+ Here is the call graph for this function:

◆ testStopThread()

void WWorkerThreadTest::testStopThread ( )
inline

Test if the thread gets shutdown correctly.

Definition at line 159 of file WWorkerThread_test.h.

References m_stopped, WThreadedRunner::requestStop(), WThreadedRunner::run(), stopTestDone(), WWorkerThread< Function_T >::subscribeStopSignal(), and WThreadedRunner::wait().

+ Here is the call graph for this function:

◆ testThreadId()

void WWorkerThreadTest::testThreadId ( )
inline

An invalid thread id should cause an exception.

Definition at line 212 of file WWorkerThread_test.h.

Member Data Documentation

◆ m_exceptionHandled

bool WWorkerThreadTest::m_exceptionHandled
private

the exception was handled?

Definition at line 266 of file WWorkerThread_test.h.

Referenced by handleException(), and testExceptions().

◆ m_stopped

bool WWorkerThreadTest::m_stopped
private

the thread was stopped?

Definition at line 263 of file WWorkerThread_test.h.

Referenced by stopTestDone(), testSingleThread(), and testStopThread().


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