Assertion context.
More...
#include <assertcontext.h>
Assertion context.
This is a helper class used for creation of assertion objects. The class keeps a context needed by the implementations of the assertions.
Definition at line 37 of file assertcontext.h.
◆ AssertContext() [1/2]
◆ AssertContext() [2/2]
OTest2::AssertContext::AssertContext |
( |
const Context & |
context_, |
|
|
const std::string & |
file_, |
|
|
int |
lineno_, |
|
|
std::initializer_list< const char * > |
parameters_ |
|
) |
| |
|
explicit |
Ctor.
- Parameters
-
context_ | The OTest2 context |
file_ | filename which the assertion is located in |
lineno_ | line number of the assertion |
parameters_ | Array of strings representing the parameters of the assertion. The initializer list is valid just inside one expression as well as the instance of the assertion context is. |
Definition at line 31 of file assertcontext.cpp.
◆ ~AssertContext()
OTest2::AssertContext::~AssertContext |
( |
| ) |
|
|
protecteddefault |
◆ enterAssertion()
AssertStream OTest2::AssertContext::enterAssertion |
( |
bool |
result_ | ) |
|
|
protected |
Enter an assertion.
- Parameters
-
result_ | Result of the assertion (the checked condition) |
- Returns
- An assertion stream. This object allows to print more descriptive description why the assertion has failed including some text attributes like color or style. The object correctly closes the assertion by its destruction.
Definition at line 45 of file assertcontext.cpp.
◆ operator=()
◆ otest2Context()
const Context & OTest2::AssertContext::otest2Context |
( |
| ) |
const |
|
protected |
◆ simpleAssertionImpl()
bool OTest2::AssertContext::simpleAssertionImpl |
( |
bool |
condition_, |
|
|
const std::string & |
message_, |
|
|
bool |
print_expression_ |
|
) |
| |
|
protected |
Implementation of a simple assertion.
This method implements a simple assertion which doesn't report additive messages.
- Parameters
-
condition_ | The checked condition |
message_ | The assertion message (it may be empty) |
print_expression_ | If it's true, the first assertion parameter is printed with the assertion message. |
- Returns
- the condition
Definition at line 58 of file assertcontext.cpp.
The documentation for this class was generated from the following files: