16#ifndef MICRO_TEST_PLUS_INLINES_H_
17#define MICRO_TEST_PLUS_INLINES_H_
26#pragma GCC diagnostic push
27#pragma GCC diagnostic ignored "-Waggregate-return"
28#pragma GCC diagnostic ignored "-Wpadded"
30#pragma clang diagnostic ignored "-Wc++98-compat"
31#pragma clang diagnostic ignored "-Wc++98-c++11-c++14-c++17-compat-pedantic"
39 template <
typename Callable_T,
typename... Args_T>
41 Args_T&&... arguments)
43 callable_{ std::bind (callable, arguments...) }
45#if defined(MICRO_OS_PLUS_TRACE_MICRO_TEST_PLUS)
46 printf (
"%s\n", __PRETTY_FUNCTION__);
49 runner.register_test_suite (
this);
55#pragma clang diagnostic push
56#pragma clang diagnostic ignored "-Wdocumentation"
88#pragma clang diagnostic pop
90 template <
typename Callable_T,
typename... Args_T>
92 test_case (
const char* name, Callable_T&& callable, Args_T&&... arguments)
95 printf (
"%s\n", __PRETTY_FUNCTION__);
99 std::invoke (std::forward<Callable_T> (callable),
100 std::forward<Args_T> (arguments)...);
113 if constexpr (std::is_arithmetic_v<T>)
115 message_.append (std::to_string (msg));
126 template <
class Expr_T>
128 const Expr_T& expr,
bool abort,
134 printf (
"%s\n", __PRETTY_FUNCTION__);
139 template <
class Expr_T>
172 template <
class T = std::
string_view,
class Delim_T>
174 split (T input, Delim_T delim) -> std::vector<T>
176 std::vector<T> output{};
178 while (first < std::size (input))
180 const auto second = input.find_first_of (delim, first);
183 output.emplace_back (input.substr (first, second - first));
185 if (second == T::npos)
198#pragma GCC diagnostic pop
const reflection::source_location location_
std::string message_
String to collect the expectation message passed via operator<<().
deferred_reporter_base(bool value, const reflection::source_location location)
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.
test_suite_base(const char *name)
Construct a test suite.
constexpr const char * name()
Get the suite name.
std::function< void(void)> callable_
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