MT Core (C++)
Core library for replacing C++ standard in project usage
|
#include <chrono>
#include <functional>
#include <iostream>
#include <map>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
#include "mtcore.hpp"
Go to the source code of this file.
Classes | |
class | mttest::IsStreamable< T > |
Checks if a class can be streamd to ostream. More... | |
struct | mttest::CmpRes< L, R > |
Result of comparing left and right (retains value references for debug printing) More... | |
struct | mttest::TestContext |
Context for unit tests. More... | |
struct | mttest::TestContext::test_err |
struct | mttest::TestContext::test_fail |
struct | mttest::TestCase |
Test case metadata. More... | |
struct | mttest::TestSuites |
Test suite metadata and runner. More... | |
Namespaces | |
namespace | mttest |
MT Unit testing framework. | |
Macros | |
#define | TEST_IMPL_NAME1(X, Y, S, N, SEP) |
#define | TEST_IMPL_NAME(X, Y, S, N) |
#define | TEST_SHORT_NAME(X, Y) |
#define | TEST_STRINGIFY(...) |
#define | TEST_CASE(SUITE, NAME) |
Defines a new test case. | |
#define | MT_TEST_NARGS(...) |
#define | MT_TEST_NARGS_(_11, _10, _9, _8, _7, _6, _5, _4, _3, _2, _1, N, ...) |
#define | MT_TEST_CONC(A, B) |
#define | MT_TEST_CONC_(A, B) |
#define | MT_TEST_GET_ELEMS(N, ...) |
#define | MT_TEST_GET_ELEMS_0(_0) |
#define | MT_TEST_GET_ELEMS_1(_0, _1) |
#define | MT_TEST_GET_ELEMS_2(_0, _1, _2) |
#define | MT_TEST_GET_ELEMS_3(_0, _1, _2, _3) |
#define | MT_TEST_GET_ELEMS_4(_0, _1, _2, _3, _4) |
#define | MT_TEST_GET_ELEMS_5(_0, _1, _2, _3, _4, _5) |
#define | MT_TEST_GET_ELEMS_6(_0, _1, _2, _3, _4, _5, _6) |
#define | MT_TEST_GET_ELEMS_7(_0, _1, _2, _3, _4, _5, _6, _7) |
#define | MT_TEST_GET_ELEMS_8(_0, _1, _2, _3, _4, _5, _6, _7, _8) |
#define | MT_TEST_GET_ELEMS_9(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) |
#define | MT_TEST_GET_ELEMS_10(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) |
#define | MT_TEST_GET_ELEMS_11(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) |
#define | MT_TEST_GET_NOT_LAST(...) |
#define | MT_TEST_COND(...) |
#define | CHECK_MESSAGE(...) |
Does a check with a specific error message on failure. | |
#define | CHECK(...) |
Does a check. | |
#define | MTTEST_CHECK_CMP(COMP, ...) |
#define | CHECK_EQ_APPROX(LEFT, RIGHT, EPSILON) |
Does a check if two values are approximately equal based on an epsilon. | |
#define | CHECK_EQ(...) |
Checks if two values are equal. | |
#define | CHECK_NE(...) |
Checks if two values are not equal. | |
#define | CHECK_LT(...) |
Checks if the left value is less than the right value. | |
#define | CHECK_LE(...) |
Checks if the left value is less than or equal to the right value. | |
#define | CHECK_GT(...) |
Checks if the left value is greater than the right value. | |
#define | CHECK_GE(...) |
Checks if the left value is greater than or equal to the right value. | |
Enumerations | |
enum | mttest::SuiteStatus { mttest::OK , mttest::FAIL , mttest::ERROR } |
Test suite status. More... | |
Functions | |
template<mtcore::DefaultFormattable T> | |
std::ostream & | operator<< (std::ostream &os, const T &v) |
template<typename T> | |
std::string | mttest::as_string (const T &val) |
Gets a value as a string (for debug printing) | |
std::string | mttest::op_name (const std::string &op) |
Gets an operation name's output symbol. | |
bool | mttest::check (bool l) |
Does a check (used by macros) | |
bool | mttest::check (bool l, const std::string &) |
Does a check with a message (drops the message, used by macros) | |
std::string | mttest::check_msg (bool, std::string message="") |
Gets the message from a check (used by macros) | |
template<typename L, typename R> | |
auto | mttest::eq (const L &left, const R &right) |
Equality comparison (used by macros) | |
template<typename L, typename R> | |
auto | mttest::ne (const L &left, const R &right) |
Inequality comparison (used by macros) | |
template<typename L, typename R> | |
auto | mttest::lt (const L &left, const R &right) |
Less than comparison (used by macros) | |
template<typename L, typename R> | |
auto | mttest::le (const L &left, const R &right) |
Less than or equal to comparison (used by macros) | |
template<typename L, typename R> | |
auto | mttest::gt (const L &left, const R &right) |
Greater than comparison (used by macros) | |
template<typename L, typename R> | |
auto | mttest::ge (const L &left, const R &right) |
Greater than or equal to comparison (used by macros) | |
Variables | |
mttest::TestSuites | test_suites |
#define CHECK | ( | ... | ) |
Does a check.
Definition at line 506 of file mttest.hpp.
#define CHECK_EQ_APPROX | ( | LEFT, | |
RIGHT, | |||
EPSILON ) |
Does a check if two values are approximately equal based on an epsilon.
Definition at line 528 of file mttest.hpp.
#define CHECK_MESSAGE | ( | ... | ) |
Does a check with a specific error message on failure.
Definition at line 493 of file mttest.hpp.
#define MT_TEST_CONC | ( | A, | |
B ) |
Definition at line 359 of file mttest.hpp.
#define MT_TEST_CONC_ | ( | A, | |
B ) |
Definition at line 360 of file mttest.hpp.
#define MT_TEST_COND | ( | ... | ) |
Definition at line 387 of file mttest.hpp.
#define MT_TEST_GET_ELEMS | ( | N, | |
... ) |
Definition at line 362 of file mttest.hpp.
#define MT_TEST_GET_ELEMS_0 | ( | _0 | ) |
Definition at line 364 of file mttest.hpp.
#define MT_TEST_GET_ELEMS_1 | ( | _0, | |
_1 ) |
Definition at line 365 of file mttest.hpp.
#define MT_TEST_GET_ELEMS_10 | ( | _0, | |
_1, | |||
_2, | |||
_3, | |||
_4, | |||
_5, | |||
_6, | |||
_7, | |||
_8, | |||
_9, | |||
_10 ) |
Definition at line 377 of file mttest.hpp.
#define MT_TEST_GET_ELEMS_11 | ( | _0, | |
_1, | |||
_2, | |||
_3, | |||
_4, | |||
_5, | |||
_6, | |||
_7, | |||
_8, | |||
_9, | |||
_10, | |||
_11 ) |
Definition at line 379 of file mttest.hpp.
#define MT_TEST_GET_ELEMS_2 | ( | _0, | |
_1, | |||
_2 ) |
Definition at line 366 of file mttest.hpp.
#define MT_TEST_GET_ELEMS_3 | ( | _0, | |
_1, | |||
_2, | |||
_3 ) |
Definition at line 367 of file mttest.hpp.
#define MT_TEST_GET_ELEMS_4 | ( | _0, | |
_1, | |||
_2, | |||
_3, | |||
_4 ) |
Definition at line 368 of file mttest.hpp.
#define MT_TEST_GET_ELEMS_5 | ( | _0, | |
_1, | |||
_2, | |||
_3, | |||
_4, | |||
_5 ) |
Definition at line 369 of file mttest.hpp.
#define MT_TEST_GET_ELEMS_6 | ( | _0, | |
_1, | |||
_2, | |||
_3, | |||
_4, | |||
_5, | |||
_6 ) |
Definition at line 370 of file mttest.hpp.
#define MT_TEST_GET_ELEMS_7 | ( | _0, | |
_1, | |||
_2, | |||
_3, | |||
_4, | |||
_5, | |||
_6, | |||
_7 ) |
Definition at line 371 of file mttest.hpp.
#define MT_TEST_GET_ELEMS_8 | ( | _0, | |
_1, | |||
_2, | |||
_3, | |||
_4, | |||
_5, | |||
_6, | |||
_7, | |||
_8 ) |
Definition at line 373 of file mttest.hpp.
#define MT_TEST_GET_ELEMS_9 | ( | _0, | |
_1, | |||
_2, | |||
_3, | |||
_4, | |||
_5, | |||
_6, | |||
_7, | |||
_8, | |||
_9 ) |
Definition at line 375 of file mttest.hpp.
#define MT_TEST_GET_NOT_LAST | ( | ... | ) |
Definition at line 384 of file mttest.hpp.
#define MT_TEST_NARGS | ( | ... | ) |
Definition at line 355 of file mttest.hpp.
#define MT_TEST_NARGS_ | ( | _11, | |
_10, | |||
_9, | |||
_8, | |||
_7, | |||
_6, | |||
_5, | |||
_4, | |||
_3, | |||
_2, | |||
_1, | |||
N, | |||
... ) |
Definition at line 357 of file mttest.hpp.
#define MTTEST_CHECK_CMP | ( | COMP, | |
... ) |
Definition at line 515 of file mttest.hpp.
#define TEST_IMPL_NAME | ( | X, | |
Y, | |||
S, | |||
N ) |
Definition at line 334 of file mttest.hpp.
#define TEST_IMPL_NAME1 | ( | X, | |
Y, | |||
S, | |||
N, | |||
SEP ) |
Definition at line 333 of file mttest.hpp.
#define TEST_SHORT_NAME | ( | X, | |
Y ) |
Definition at line 335 of file mttest.hpp.
#define TEST_STRINGIFY | ( | ... | ) |
Definition at line 337 of file mttest.hpp.
std::ostream & operator<< | ( | std::ostream & | os, |
const T & | v ) |
Definition at line 33 of file mttest.hpp.
|
extern |