Class to simplify generation of begin/end messages for a test group. More...

#include <TestGroup.h>

Inheritance diagram for TestGroup:
Collaboration diagram for TestGroup:

Public Types

enum  State { State::running, State::pending, State::complete, State::failed }
 

Public Member Functions

 TestGroup (const String &name)
 
void commenceTest ()
 
virtual void execute ()=0
 Implement this method to define the test. More...
 
void startItem (const String &tag, const String &description=nullptr)
 Note the start of a test item within a group. More...
 
void fail (const char *func) override
 Called when test fails to identify location. More...
 
const StringgetName ()
 
NanoTime::Time< uint32_t > elapsedTime () const
 
State getState () const
 
void initialiseAndExecute ()
 Called by test runner. More...
 
- Public Member Functions inherited from TestBase
virtual ~TestBase ()
 
virtual bool testVerify (bool res, const TestParam &param)
 Print result of a test. More...
 
bool test_verify (bool res, const char *expr, const String &value1, const String &value2, bool verbose)
 
template<typename V >
std::enable_if< std::is_arithmetic< V >::value, bool >::type test_verify (bool res, const char *expr, const V &value1, const V &value2, bool verbose)
 
template<typename V >
std::enable_if<!std::is_same< V, String >::value &&!std::is_arithmetic< V >::value, bool >::type test_verify (bool res, const char *expr, const V &value1, const V &value2, bool verbose)
 

Protected Member Functions

void pending ()
 Call to mark test as pending so it will be executed asynchronously Call complete() when test is finished. More...
 
void complete ()
 Call to complete pending (asynchronous) test. More...
 

Detailed Description

Class to simplify generation of begin/end messages for a test group.

Member Enumeration Documentation

◆ State

enum TestGroup::State
strong
Enumerator
running 
pending 
complete 
failed 

Constructor & Destructor Documentation

◆ TestGroup()

TestGroup::TestGroup ( const String name)
inline

Member Function Documentation

◆ commenceTest()

void TestGroup::commenceTest ( )

◆ complete()

void TestGroup::complete ( )
protected

Call to complete pending (asynchronous) test.

◆ elapsedTime()

NanoTime::Time<uint32_t> TestGroup::elapsedTime ( ) const
inline

◆ execute()

virtual void TestGroup::execute ( )
pure virtual

Implement this method to define the test.

Note
If tests are asynchronous, call pending() before returning and call complete() when the group has completed execution (e.g. via timer callback, etc.)

◆ fail()

void TestGroup::fail ( const char *  func)
overridevirtual

Called when test fails to identify location.

Reimplemented from TestBase.

◆ getName()

const String& TestGroup::getName ( )
inline

◆ getState()

State TestGroup::getState ( ) const
inline

◆ initialiseAndExecute()

void TestGroup::initialiseAndExecute ( )

Called by test runner.

◆ pending()

void TestGroup::pending ( )
inlineprotected

Call to mark test as pending so it will be executed asynchronously Call complete() when test is finished.

◆ startItem()

void TestGroup::startItem ( const String tag,
const String description = nullptr 
)

Note the start of a test item within a group.


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