MT Core (C++)
Core library for replacing C++ standard in project usage
Loading...
Searching...
No Matches
Test

Unit testing framework. More...

Namespaces

namespace  mttest
 MT Unit testing framework.
 

Macros

#define TEST_CASE(SUITE, NAME)
 Defines a new test case.
 
#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.
 

Detailed Description

Unit testing framework.

See also
mttest

Macro Definition Documentation

◆ CHECK_EQ

#define CHECK_EQ ( ...)
Value:
MTTEST_CHECK_CMP(eq, __VA_ARGS__);
#define MTTEST_CHECK_CMP(COMP,...)
Definition mttest.hpp:515

Checks if two values are equal.

Definition at line 560 of file mttest.hpp.

◆ CHECK_GE

#define CHECK_GE ( ...)
Value:
MTTEST_CHECK_CMP(ge, __VA_ARGS__);

Checks if the left value is greater than or equal to the right value.

Definition at line 585 of file mttest.hpp.

◆ CHECK_GT

#define CHECK_GT ( ...)
Value:
MTTEST_CHECK_CMP(gt, __VA_ARGS__);

Checks if the left value is greater than the right value.

Definition at line 580 of file mttest.hpp.

◆ CHECK_LE

#define CHECK_LE ( ...)
Value:
MTTEST_CHECK_CMP(le, __VA_ARGS__);

Checks if the left value is less than or equal to the right value.

Definition at line 575 of file mttest.hpp.

◆ CHECK_LT

#define CHECK_LT ( ...)
Value:
MTTEST_CHECK_CMP(lt, __VA_ARGS__);

Checks if the left value is less than the right value.

Definition at line 570 of file mttest.hpp.

◆ CHECK_NE

#define CHECK_NE ( ...)
Value:
MTTEST_CHECK_CMP(ne, __VA_ARGS__);

Checks if two values are not equal.

Definition at line 565 of file mttest.hpp.

◆ TEST_CASE

#define TEST_CASE ( SUITE,
NAME )
Value:
static void TEST_IMPL_NAME(tc_impl, __LINE__, SUITE, NAME)( \
mttest::TestContext & mttest__context_ctx); \
static const auto TEST_IMPL_NAME(tc_decl, __LINE__, SUITE, NAME) = \
mttest::TestCase{TEST_IMPL_NAME(tc_impl, __LINE__, SUITE, NAME), \
TEST_STRINGIFY(SUITE), TEST_STRINGIFY(NAME)}; \
static void TEST_IMPL_NAME(tc_impl, __LINE__, SUITE, \
NAME)(mttest::TestContext & mttest__context_ctx)
mttest::TestSuites test_suites
#define TEST_IMPL_NAME(X, Y, S, N)
Definition mttest.hpp:334
#define TEST_STRINGIFY(...)
Definition mttest.hpp:337
Test case metadata.
Definition mttest.hpp:157
Context for unit tests.
Definition mttest.hpp:108

Defines a new test case.

Parameters
SUITETest suite name (must be valid C++ variable name)
NAMETest case name (must be valid C++ variable name)

Definition at line 345 of file mttest.hpp.

345#define TEST_CASE(SUITE, NAME) \
346 static void TEST_IMPL_NAME(tc_impl, __LINE__, SUITE, NAME)( \
347 mttest::TestContext & mttest__context_ctx); \
348 static const auto TEST_IMPL_NAME(tc_decl, __LINE__, SUITE, NAME) = \
349 test_suites += \
350 mttest::TestCase{TEST_IMPL_NAME(tc_impl, __LINE__, SUITE, NAME), \
351 TEST_STRINGIFY(SUITE), TEST_STRINGIFY(NAME)}; \
352 static void TEST_IMPL_NAME(tc_impl, __LINE__, SUITE, \
353 NAME)(mttest::TestContext & mttest__context_ctx)