OTest2
A C++ testing framework
|
A reporter writing into a console or file. More...
#include <reporterconsole.h>
Classes | |
struct | Impl |
Public Member Functions | |
ReporterConsole (const ReporterConsole &)=delete | |
ReporterConsole & | operator= (const ReporterConsole &)=delete |
ReporterConsole (std::ostream *out_, bool verbose_, bool hide_location_) | |
Ctor. More... | |
virtual | ~ReporterConsole () |
Dtor. More... | |
virtual void | enterTest (const Context &context_, const std::string &name_, const Parameters ¶ms_) override |
Enter entire test. More... | |
virtual void | enterSuite (const Context &context_, const std::string &name_, const Parameters ¶ms_) override |
Enter a suite. More... | |
virtual void | enterCase (const Context &context_, const std::string &name_, const Parameters ¶ms_) 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 ¶ms_, bool result_) override |
Leave a case. More... | |
virtual void | leaveSuite (const Context &context_, const std::string &name_, const Parameters ¶ms_, bool result_) override |
Leave a suite. More... | |
virtual void | leaveTest (const Context &context_, const std::string &name_, const Parameters ¶ms_, bool result_) override |
Leave entire test. More... | |
![]() | |
Reporter (const Reporter &)=delete | |
Reporter & | operator= (const Reporter &)=delete |
Reporter () | |
Ctor. More... | |
virtual | ~Reporter () |
Dtor. More... | |
A reporter writing into a console or file.
This reporter writes the test results into a console.
Definition at line 34 of file reporterconsole.h.
|
delete |
|
explicit |
Ctor.
out_ | An output stream. The ownership is not taken. |
verbose_ | If it's true all assertions are printed. If it's false just the failed assertions are printed out. |
hide_location_ | If the flag is true, the assertion locations are hidden (replaced by '...'). |
Definition at line 401 of file reporterconsole.cpp.
|
virtual |
Dtor.
Definition at line 409 of file reporterconsole.cpp.
|
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.
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 |
Implements OTest2::Reporter.
Definition at line 452 of file reporterconsole.cpp.
|
overridevirtual |
Enter a case.
context_ | the OTest2 context |
name_ | Name of the case |
params_ | Parameters of the testing object |
Implements OTest2::Reporter.
Definition at line 433 of file reporterconsole.cpp.
|
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.
context_ | the context |
Implements OTest2::Reporter.
Definition at line 465 of file reporterconsole.cpp.
|
overridevirtual |
Enter a state.
context_ | the OTest2 context |
name_ | Name of the state |
Implements OTest2::Reporter.
Definition at line 446 of file reporterconsole.cpp.
|
overridevirtual |
Enter a suite.
context_ | the OTest2 context |
name_ | Name of the suite |
params_ | Parameters of the testing object |
Implements OTest2::Reporter.
Definition at line 420 of file reporterconsole.cpp.
|
overridevirtual |
Enter entire test.
context_ | The OTest2 context |
name_ | Name of the test |
params_ | Parameters of the testing object |
Implements OTest2::Reporter.
Definition at line 413 of file reporterconsole.cpp.
|
overridevirtual |
Leave a case.
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 482 of file reporterconsole.cpp.
|
overridevirtual |
Leave a state.
context_ | the OTest2 context |
name_ | Name of the state |
result_ | Result of the state |
Implements OTest2::Reporter.
Definition at line 475 of file reporterconsole.cpp.
|
overridevirtual |
Leave a suite.
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 499 of file reporterconsole.cpp.
|
overridevirtual |
Leave entire test.
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 519 of file reporterconsole.cpp.
|
delete |