Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::UnitTestServiceAdapter< T > Class Template Reference

Adapts a service that declares tests to the IUnitTest interface. More...

#include <arcane/core/UnitTestServiceAdapter.h>

Inheritance diagram for Arcane::UnitTestServiceAdapter< T >:
Collaboration diagram for Arcane::UnitTestServiceAdapter< T >:

Classes

struct  TestFuncInfo

Public Types

typedef void(T::* FuncPtr) ()
 Type of the pointer to the test methods.

Public Member Functions

 UnitTestServiceAdapter (T *service)
void setClassSetUpFunction (FuncPtr f)
void setTestSetUpFunction (FuncPtr f)
void setClassTearDownFunction (FuncPtr f)
void setTestTearDownFunction (FuncPtr f)
void addTestFunction (FuncPtr f, String name, String method_name)
void initializeTest () override
 Implementation of the IUnitTest interface.
bool executeTest (XmlNode &report) override
 Implementation of the IUnitTest interface.
void finalizeTest () override
 Implementation of the IUnitTest interface.
Public Member Functions inherited from Arcane::IXmlUnitTest
virtual void buildInitializeTest ()
Public Member Functions inherited from Arcane::Assertion
void fail (const TraceInfo &where)
void assertTrue (const TraceInfo &where, bool condition, IParallelMng *pm=nullptr)
 Throws an AssertException if condition is false.
void assertFalse (const TraceInfo &where, bool condition, IParallelMng *pm=nullptr)
 Throws an AssertException if condition is true.
void assertEqual (const TraceInfo &where, const String &expected, const String &actual, IParallelMng *pm=nullptr)
template<typename T>
void assertEqual (const TraceInfo &where, const T &expected, const T &actual, IParallelMng *pm=nullptr)
template<typename T>
void assertNearlyEqual (const TraceInfo &where, const T &expected, const T &actual, IParallelMng *pm=nullptr)
template<typename T>
void assertNearlyZero (const TraceInfo &where, const T &actual, IParallelMng *pm=nullptr)
template<typename T>
void assertNearlyEqualWithEpsilon (const TraceInfo &where, const T &expected, const T &actual, const T &epsilon, IParallelMng *pm=nullptr)
template<typename T>
void assertNearlyZeroWithEpsilon (const TraceInfo &where, const T &actual, const T &epsilon, IParallelMng *pm=nullptr)

Private Attributes

FuncPtr m_class_set_up_function = nullptr
 Pointer to the class initialization method.
FuncPtr m_set_up_function = nullptr
 Pointer to the initialization method of each test.
FuncPtr m_class_tear_down_function = nullptr
 Pointer to the class teardown method.
FuncPtr m_tear_down_function = nullptr
 Pointer to the teardown method of each test.
UniqueArray< TestFuncInfom_test_functions
 Associated service.
T * m_service

Detailed Description

template<typename T>
class Arcane::UnitTestServiceAdapter< T >

Adapts a service that declares tests to the IUnitTest interface.

Definition at line 37 of file UnitTestServiceAdapter.h.

Member Typedef Documentation

◆ FuncPtr

template<typename T>
typedef void(T::* Arcane::UnitTestServiceAdapter< T >::FuncPtr) ()

Type of the pointer to the test methods.

Definition at line 43 of file UnitTestServiceAdapter.h.

Constructor & Destructor Documentation

◆ UnitTestServiceAdapter()

template<typename T>
Arcane::UnitTestServiceAdapter< T >::UnitTestServiceAdapter ( T * service)
inlineexplicit

Definition at line 47 of file UnitTestServiceAdapter.h.

Member Function Documentation

◆ addTestFunction()

template<typename T>
void Arcane::UnitTestServiceAdapter< T >::addTestFunction ( FuncPtr f,
String name,
String method_name )
inline

Definition at line 57 of file UnitTestServiceAdapter.h.

◆ executeTest()

template<typename T>
bool Arcane::UnitTestServiceAdapter< T >::executeTest ( XmlNode & report)
inlineoverridevirtual

Implementation of the IUnitTest interface.

Implements Arcane::IXmlUnitTest.

Definition at line 73 of file UnitTestServiceAdapter.h.

References Arcane::AssertionException::file(), Arcane::AssertionException::line(), m_set_up_function, m_tear_down_function, m_test_functions, Arcane::AssertionException::message(), Arcane::XmlNode::setAttrValue(), and Arcane::AssertionException::where().

Here is the call graph for this function:

◆ finalizeTest()

template<typename T>
void Arcane::UnitTestServiceAdapter< T >::finalizeTest ( )
inlineoverridevirtual

Implementation of the IUnitTest interface.

Implements Arcane::IXmlUnitTest.

Definition at line 106 of file UnitTestServiceAdapter.h.

References m_class_tear_down_function.

◆ initializeTest()

template<typename T>
void Arcane::UnitTestServiceAdapter< T >::initializeTest ( )
inlineoverridevirtual

Implementation of the IUnitTest interface.

Implements Arcane::IXmlUnitTest.

Definition at line 66 of file UnitTestServiceAdapter.h.

References m_class_set_up_function.

◆ setClassSetUpFunction()

template<typename T>
void Arcane::UnitTestServiceAdapter< T >::setClassSetUpFunction ( FuncPtr f)
inline

Definition at line 53 of file UnitTestServiceAdapter.h.

◆ setClassTearDownFunction()

template<typename T>
void Arcane::UnitTestServiceAdapter< T >::setClassTearDownFunction ( FuncPtr f)
inline

Definition at line 55 of file UnitTestServiceAdapter.h.

◆ setTestSetUpFunction()

template<typename T>
void Arcane::UnitTestServiceAdapter< T >::setTestSetUpFunction ( FuncPtr f)
inline

Definition at line 54 of file UnitTestServiceAdapter.h.

◆ setTestTearDownFunction()

template<typename T>
void Arcane::UnitTestServiceAdapter< T >::setTestTearDownFunction ( FuncPtr f)
inline

Definition at line 56 of file UnitTestServiceAdapter.h.

Member Data Documentation

◆ m_class_set_up_function

template<typename T>
FuncPtr Arcane::UnitTestServiceAdapter< T >::m_class_set_up_function = nullptr
private

Pointer to the class initialization method.

Definition at line 130 of file UnitTestServiceAdapter.h.

Referenced by initializeTest().

◆ m_class_tear_down_function

template<typename T>
FuncPtr Arcane::UnitTestServiceAdapter< T >::m_class_tear_down_function = nullptr
private

Pointer to the class teardown method.

Definition at line 134 of file UnitTestServiceAdapter.h.

Referenced by finalizeTest().

◆ m_service

template<typename T>
T* Arcane::UnitTestServiceAdapter< T >::m_service
private

Definition at line 140 of file UnitTestServiceAdapter.h.

◆ m_set_up_function

template<typename T>
FuncPtr Arcane::UnitTestServiceAdapter< T >::m_set_up_function = nullptr
private

Pointer to the initialization method of each test.

Definition at line 132 of file UnitTestServiceAdapter.h.

Referenced by executeTest().

◆ m_tear_down_function

template<typename T>
FuncPtr Arcane::UnitTestServiceAdapter< T >::m_tear_down_function = nullptr
private

Pointer to the teardown method of each test.

Pointers to the test methods.

Definition at line 136 of file UnitTestServiceAdapter.h.

Referenced by executeTest().

◆ m_test_functions

template<typename T>
UniqueArray<TestFuncInfo> Arcane::UnitTestServiceAdapter< T >::m_test_functions
private

Associated service.

Definition at line 138 of file UnitTestServiceAdapter.h.

Referenced by executeTest().


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