17#ifndef MICRO_TEST_PLUS_INLINES_H_
18#define MICRO_TEST_PLUS_INLINES_H_
27#pragma GCC diagnostic push
28#pragma GCC diagnostic ignored "-Waggregate-return"
29#pragma GCC diagnostic ignored "-Wpadded"
31#pragma clang diagnostic ignored "-Wc++98-compat"
32#pragma clang diagnostic ignored "-Wc++98-c++11-c++14-c++17-compat-pedantic"
40 template <
typename Callable_T,
typename... Args_T>
42 Args_T&&... arguments)
44 callable_{ std::bind (callable, arguments...) }
46#if defined(MICRO_TEST_PLUS_TRACE)
47 printf (
"%s\n", __PRETTY_FUNCTION__);
85 template <
typename Callable_T,
typename... Args_T>
87 test_case (
const char* name, Callable_T&& callable, Args_T&&... arguments)
90 printf (
"%s\n", __PRETTY_FUNCTION__);
94 std::invoke (std::forward<Callable_T> (callable),
95 std::forward<Args_T> (arguments)...);
108 if constexpr (std::is_arithmetic_v<T>)
110 message_.append (std::to_string (msg));
121 template <
class Expr_T>
123 const Expr_T& expr,
bool abort,
129 printf (
"%s\n", __PRETTY_FUNCTION__);
134 template <
class Expr_T>
167 template <
class T = std::
string_view,
class Delim_T>
169 split (T input, Delim_T delim) -> std::vector<T>
171 std::vector<T> output{};
173 while (first < std::size (input))
175 const auto second = input.find_first_of (delim, first);
178 output.emplace_back (input.substr (first, second - first));
180 if (second == T::npos)
193#pragma GCC diagnostic pop
Base class for a deferred reporter, that collects the messages into a string.
std::string message_
String to collect the expectation message passed via operator<<().
auto & operator<<(const T &msg)
constexpr deferred_reporter(const Expr_T &expr, bool abort, const reflection::source_location &location)
Local implementation of the std::source_location.
void pass(Expr_T &expr, std::string &message)
Report a passed condition.
void fail(Expr_T &expr, bool abort, std::string &message, const reflection::source_location &location)
Report a failed condition.
void register_test_suite(test_suite_base *suite)
Called by test suite constructors to register them to the runner.
Base class for all test suites.
void begin_test_case(const char *name)
Mark the beginning of a named test case.
void end_test_case(void)
Mark the end of a test case.
test_suite(const char *name, Callable_T &&callable, Args_T &&... arguments)
Construct a test suite.
void test_case(const char *name, Callable_T &&callable, Args_T &&... arguments)
Define and execute a test case.
auto split(T input, Delim_T delim) -> std::vector< T >
Split a string into a vector of sub-strings.
test_suite_base * current_test_suite