OTest2
A C++ testing framework
Public Member Functions | List of all members
OTest2::ReporterTee Class Reference

A tee reporter - a composition of several reporters. More...

#include <reportertee.h>

Inheritance diagram for OTest2::ReporterTee:
Inheritance graph
[legend]
Collaboration diagram for OTest2::ReporterTee:
Collaboration graph
[legend]

Public Member Functions

 ReporterTee ()
 Ctor. More...
 
virtual ~ReporterTee ()
 Dtor. More...
 
 ReporterTee (const ReporterTee &)=delete
 
ReporterTeeoperator= (const ReporterTee &)=delete
 
void appendReporter (Reporter *reporter_)
 Append a reporter. More...
 
virtual void enterTest (const Context &context_, const std::string &name_, const Parameters &params_) override
 Enter entire test. More...
 
virtual void enterSuite (const Context &context_, const std::string &name_, const Parameters &params_) override
 Enter a suite. More...
 
virtual void enterCase (const Context &context_, const std::string &name_, const Parameters &params_) override
 Enter a case. More...
 
virtual void enterState (const Context &context_, const std::string &name_) override
 Enter a state. More...
 
virtual AssertBufferPtr enterAssert (const Context &context_, bool condition_, const std::string &file_, int lineno_) override
 Enter an assertion. More...
 
virtual AssertBufferPtr enterError (const Context &context_) override
 Enter an error report. More...
 
virtual void leaveState (const Context &context_, const std::string &name_, bool result_) override
 Leave a state. More...
 
virtual void leaveCase (const Context &context_, const std::string &name_, const Parameters &params_, bool result_) override
 Leave a case. More...
 
virtual void leaveSuite (const Context &context_, const std::string &name_, const Parameters &params_, bool result_) override
 Leave a suite. More...
 
virtual void leaveTest (const Context &context_, const std::string &name_, const Parameters &params_, bool result_) override
 Leave entire test. More...
 
- Public Member Functions inherited from OTest2::Reporter
 Reporter (const Reporter &)=delete
 
Reporteroperator= (const Reporter &)=delete
 
 Reporter ()
 Ctor. More...
 
virtual ~Reporter ()
 Dtor. More...
 

Detailed Description

A tee reporter - a composition of several reporters.

Definition at line 32 of file reportertee.h.

Constructor & Destructor Documentation

◆ ReporterTee() [1/2]

OTest2::ReporterTee::ReporterTee ( )

Ctor.

Definition at line 141 of file reportertee.cpp.

◆ ~ReporterTee()

OTest2::ReporterTee::~ReporterTee ( )
virtual

Dtor.

Definition at line 145 of file reportertee.cpp.

◆ ReporterTee() [2/2]

OTest2::ReporterTee::ReporterTee ( const ReporterTee )
delete

Member Function Documentation

◆ appendReporter()

void OTest2::ReporterTee::appendReporter ( Reporter reporter_)

Append a reporter.

Parameters
reporter_The reporter. The ownership is not taken.

Definition at line 149 of file reportertee.cpp.

◆ enterAssert()

AssertBufferPtr OTest2::ReporterTee::enterAssert ( const Context context_,
bool  condition_,
const std::string &  file_,
int  lineno_ 
)
overridevirtual

Enter an assertion.

The assertion is opened similarly to states, cases and suites until the AsssertBuffer::commitAssertion() method of the returned assertion buffer is invoked.

Warning
Just one assertion at time may be opened!
Parameters
context_the OTest2 context
condition_result of the assertion (false means failed assertion)
file_name of the source file
lineno_line number in the source file
Returns
An assertion buffer object which is used for formatting the assertion report.

Implements OTest2::Reporter.

Definition at line 214 of file reportertee.cpp.

◆ enterCase()

void OTest2::ReporterTee::enterCase ( const Context context_,
const std::string &  name_,
const Parameters params_ 
)
overridevirtual

Enter a case.

Parameters
context_the OTest2 context
name_Name of the case
params_Parameters of the testing object

Implements OTest2::Reporter.

Definition at line 186 of file reportertee.cpp.

◆ enterError()

AssertBufferPtr OTest2::ReporterTee::enterError ( const Context context_)
overridevirtual

Enter an error report.

This method is used to report errors happened in the testing framework. Errors mean failure of the test. However, they cannot be located in the user code (no filename, no line number). A good example is a not handled exception caught by the framework outside test cases.

The method works as well as the enterAssert() method with failed condition and with no location info. The opened error state is closed by the AssertBuffer::commitAssertion() method of the returned assertion buffer.

Warning
Just one assertion at time may be opened!
Parameters
context_the context
Returns
An assertion buffer object which is used for formatting the assertion report.

Implements OTest2::Reporter.

Definition at line 231 of file reportertee.cpp.

◆ enterState()

void OTest2::ReporterTee::enterState ( const Context context_,
const std::string &  name_ 
)
overridevirtual

Enter a state.

Parameters
context_the OTest2 context
name_Name of the state

Implements OTest2::Reporter.

Definition at line 201 of file reportertee.cpp.

◆ enterSuite()

void OTest2::ReporterTee::enterSuite ( const Context context_,
const std::string &  name_,
const Parameters params_ 
)
overridevirtual

Enter a suite.

Parameters
context_the OTest2 context
name_Name of the suite
params_Parameters of the testing object

Implements OTest2::Reporter.

Definition at line 171 of file reportertee.cpp.

◆ enterTest()

void OTest2::ReporterTee::enterTest ( const Context context_,
const std::string &  name_,
const Parameters params_ 
)
overridevirtual

Enter entire test.

Parameters
context_The OTest2 context
name_Name of the test
params_Parameters of the testing object

Implements OTest2::Reporter.

Definition at line 156 of file reportertee.cpp.

◆ leaveCase()

void OTest2::ReporterTee::leaveCase ( const Context context_,
const std::string &  name_,
const Parameters params_,
bool  result_ 
)
overridevirtual

Leave a case.

Parameters
context_the OTest2 context
name_Name of the case
params_Parameters of the testing object
result_Result of the case

Implements OTest2::Reporter.

Definition at line 260 of file reportertee.cpp.

◆ leaveState()

void OTest2::ReporterTee::leaveState ( const Context context_,
const std::string &  name_,
bool  result_ 
)
overridevirtual

Leave a state.

Parameters
context_the OTest2 context
name_Name of the state
result_Result of the state

Implements OTest2::Reporter.

Definition at line 245 of file reportertee.cpp.

◆ leaveSuite()

void OTest2::ReporterTee::leaveSuite ( const Context context_,
const std::string &  name_,
const Parameters params_,
bool  result_ 
)
overridevirtual

Leave a suite.

Parameters
context_the OTest2 context
name_Name of the suite
params_Parameters of the testing object
result_Result of the suite

Implements OTest2::Reporter.

Definition at line 277 of file reportertee.cpp.

◆ leaveTest()

void OTest2::ReporterTee::leaveTest ( const Context context_,
const std::string &  name_,
const Parameters params_,
bool  result_ 
)
overridevirtual

Leave entire test.

Parameters
context_the OTest2 context
name_Name of the leaving test
params_Parameters of the testing object
result_Result of the test

Implements OTest2::Reporter.

Definition at line 294 of file reportertee.cpp.

◆ operator=()

ReporterTee& OTest2::ReporterTee::operator= ( const ReporterTee )
delete

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