34#ifndef MICRO_OS_PLUS_MICRO_TEST_PLUS_INLINES_CHECK_RESULT_INLINES_H_
35#define MICRO_OS_PLUS_MICRO_TEST_PLUS_INLINES_CHECK_RESULT_INLINES_H_
39#if defined(__cplusplus)
43#if __has_include("micro-os-plus/diag/trace.h")
44#include "micro-os-plus/diag/trace.h"
55#pragma GCC diagnostic push
57#pragma GCC diagnostic ignored "-Waggregate-return"
59#pragma clang diagnostic ignored "-Wc++98-compat"
60#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
100 template <
class Expr_T>
110#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_TRACE_CONSTRUCTORS_ENABLED)
111 trace::printf (
"%s\n", __PRETTY_FUNCTION__);
121 or std::convertible_to<Expr_T, bool>)
127 expression << static_cast<bool> (expr);
184 return std::move (*
this);
191 return std::move (*
this);
198 formatter << std::invoke (msg);
205 return std::move (*
this);
208#if !defined(__DOXYGEN__)
217 check_result::operator<< ([[maybe_unused]]
const T& msg) &&
219 if constexpr (std::is_class_v<T> and std::invocable<const T&>)
222 not std::is_same_v<T, T>,
223 "a message that is a callable object must be callable "
224 "without arguments and return a value that can be "
225 "written, not void");
229 static_assert (not std::is_same_v<T, T>,
230 "a message argument must be a value that can be "
231 "written: define an operator<< (mt::"
232 "expression_formatter&, const T&) in the namespace "
233 "of the type, or pass a callable object that returns "
236 return std::move (*
this);
247#pragma GCC diagnostic pop
The result of one check, reported when destroyed.
bool value(void) const &&noexcept
Retrieves the result value.
void start(bool value, check_kind kind, bool has_expression, const reflection::source_location &location, test_case &test_case, bool writes_passed)
Starts the result of a check from its parts.
check_result(void)
Constructs a result in the initial state.
bool is_written_
Whether the outcome of the check is written.
check_result && operator<<(const T &msg) &&
Appends a message to the check.
void init(const Expr_T &expr, check_kind kind, const reflection::source_location &location, test_case &test_case, expression_formatter &expression, bool writes_passed)
Initialises the result with the check of an expression.
bool value_
Stores the result value of the check.
failure_info info_
The details displayed when the check fails.
Local implementation of source location information for diagnostics.
A named, runnable test case that lives inside a suite.
Concept satisfied when T is a callable object that returns a printable message.
Concept satisfied when T can be appended to the message of a check.
Concept satisfied when a type is a framework expression type.
Internal implementation details for the µTest++ framework.
check_kind
The kind of a check, which determines what happens when it fails.
Primary namespace for the µTest++ testing framework.