Context for unit tests.
More...
#include <mttest.hpp>
|
void | add_error (const std::string &cond, const std::runtime_error &err, const std::string &file, size_t line) |
|
void | add_error (const std::string &cond, int err, const std::string &file, size_t line) |
|
void | add_error (const std::string &cond, const std::string &file, size_t line) |
|
void | add_failure (const std::string &cond, const std::string &file, size_t line) |
|
void | add_failure (const std::string &cond, const std::string &msg, const std::string &file, size_t line) |
|
template<typename L, typename R> |
void | add_failure (const std::string &comp, const std::string &raw, const L &left, const R &right, const std::string &file, size_t line) |
|
Context for unit tests.
Definition at line 108 of file mttest.hpp.
◆ add_error() [1/3]
void mttest::TestContext::add_error |
( |
const std::string & | cond, |
|
|
const std::runtime_error & | err, |
|
|
const std::string & | file, |
|
|
size_t | line ) |
|
inline |
Definition at line 126 of file mttest.hpp.
126 {
127 errors.push_back({cond, err.what(), file, line});
128 }
std::vector< test_err > errors
◆ add_error() [2/3]
void mttest::TestContext::add_error |
( |
const std::string & | cond, |
|
|
const std::string & | file, |
|
|
size_t | line ) |
|
inline |
Definition at line 134 of file mttest.hpp.
134 {
135 errors.push_back({cond,
"UNKNOWN", file, line});
136 }
◆ add_error() [3/3]
void mttest::TestContext::add_error |
( |
const std::string & | cond, |
|
|
int | err, |
|
|
const std::string & | file, |
|
|
size_t | line ) |
|
inline |
Definition at line 130 of file mttest.hpp.
130 {
131 errors.push_back({cond, std::to_string(err), file, line});
132 }
◆ add_failure() [1/3]
template<typename L, typename R>
void mttest::TestContext::add_failure |
( |
const std::string & | comp, |
|
|
const std::string & | raw, |
|
|
const L & | left, |
|
|
const R & | right, |
|
|
const std::string & | file, |
|
|
size_t | line ) |
|
inline |
Definition at line 147 of file mttest.hpp.
149 {
150 failures.push_back({
"CHECK_EQ(" + raw +
")", file, line,
153 }
std::string as_string(const T &val)
Gets a value as a string (for debug printing)
std::string op_name(const std::string &op)
Gets an operation name's output symbol.
std::vector< test_fail > failures
◆ add_failure() [2/3]
void mttest::TestContext::add_failure |
( |
const std::string & | cond, |
|
|
const std::string & | file, |
|
|
size_t | line ) |
|
inline |
◆ add_failure() [3/3]
void mttest::TestContext::add_failure |
( |
const std::string & | cond, |
|
|
const std::string & | msg, |
|
|
const std::string & | file, |
|
|
size_t | line ) |
|
inline |
◆ errors
std::vector<test_err> mttest::TestContext::errors = {} |
◆ failures
std::vector<test_fail> mttest::TestContext::failures = {} |
The documentation for this struct was generated from the following file: