|
| template<typename Lhs_T, typename Rhs_T> |
| | and_ (const Lhs_T &, const Rhs_T &) -> and_< Lhs_T, Rhs_T > |
template<class T>
requires std::is_arithmetic_v<T> |
| void | append_number_ (std::string &buffer, T v) |
| | Appends the string representation of a numeric value to a buffer, using std::to_chars for allocation-free, locale-independent formatting.
|
| template<typename Lhs_T, typename Rhs_T> |
| | eq_ (const Lhs_T &, const Rhs_T &) -> eq_< Lhs_T, Rhs_T > |
| template<typename Lhs_T, typename Rhs_T> |
| | ge_ (const Lhs_T &, const Rhs_T &) -> ge_< Lhs_T, Rhs_T > |
| template<class T> |
| constexpr auto | get (const T &t) |
| | Generic getter function template for value retrieval.
|
| template<typename Lhs_T, typename Rhs_T> |
| | gt_ (const Lhs_T &, const Rhs_T &) -> gt_< Lhs_T, Rhs_T > |
| template<typename Lhs_T, typename Rhs_T> |
| | le_ (const Lhs_T &, const Rhs_T &) -> le_< Lhs_T, Rhs_T > |
| template<typename Lhs_T, typename Rhs_T> |
| | lt_ (const Lhs_T &, const Rhs_T &) -> lt_< Lhs_T, Rhs_T > |
| template<typename Lhs_T, typename Rhs_T> |
| | ne_ (const Lhs_T &, const Rhs_T &) -> ne_< Lhs_T, Rhs_T > |
| template<typename T> |
| | not_ (const T &) -> not_< T > |
| template<typename Lhs_T, typename Rhs_T> |
| | or_ (const Lhs_T &, const Rhs_T &) -> or_< Lhs_T, Rhs_T > |
| void | register_static_suite (static_runner &static_runner_ref, static_suite &static_suite_ref) |
| | Registers a static suite with a static runner.
|
| runner & | to_runner (static_runner &static_runner_ref) noexcept |
| | Converts a static_runner reference to a runner reference.
|
The detail namespace encapsulates the internal mechanisms, helper structures, and implementation utilities employed by the µTest++ testing framework. These components do not form part of the public API and may be modified without prior notice.
Within this namespace, one will find assertion handling, generic getter utilities, comparator structures for logical and relational operations, mechanisms for exception checking, and base classes for deferred reporting of test results.
All definitions within detail are intended exclusively for internal use, ensuring a clear distinction between user-facing and internal components. This approach enhances maintainability, mitigates the risk of naming conflicts, and keeps the public API succinct.
The relevant header files are organised within the include/micro-os-plus folder to maintain a structured and modular codebase.
template<class T>
requires std::is_arithmetic_v<T>
| void micro_os_plus::micro_test_plus::detail::append_number_ |
( |
std::string & | buffer, |
|
|
T | v ) |
- Template Parameters
-
| T | The numeric type to format. |
- Parameters
-
| buffer | The string to append to. |
| v | The value to format. |
- Returns
- Nothing.
For long double, a platform-specific path is chosen:
- On Windows and on platforms where long double has the same storage width as double (e.g., ARM, RISC-V), the value is cast to double and formatted with std::to_chars.
- On x86-64 Linux/macOS with 80-bit extended precision, snprintf with Lg is used as a portable fallback because std::to_chars for long double may be unavailable when linking with lld.
For all other numeric types, std::to_chars is called directly, providing locale-independent, allocation-free formatting.
Definition at line 674 of file detail-inlines.h.
675 {
676 char buf[32];
677 if constexpr (std::is_same_v<T, long double>)
678 {
679#if defined(_WIN32) \
680 || (defined(__SIZEOF_LONG_DOUBLE__) \
681 && __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__)
682
683
684
685
686
687 const auto [ptr, ec] = std::to_chars (buf, buf + sizeof (buf),
688 static_cast<double> (v));
689 if (ec == std::errc{})
690 buffer.append (buf, ptr);
691#else
692
693
694
695
696 snprintf (buf, sizeof (buf), "%Lg", v);
697 buffer.append (buf);
698#endif
699 }
700 else
701 {
702 const auto [ptr, ec] = std::to_chars (buf, buf + sizeof (buf), v);
703 if (ec == std::errc{})
704 buffer.append (buf, ptr);
705 }
706 }
Referenced by micro_os_plus::micro_test_plus::detail::expression_formatter::operator<<(), micro_os_plus::micro_test_plus::detail::expression_formatter::operator<<(), micro_os_plus::micro_test_plus::detail::expression_formatter::operator<<(), micro_os_plus::micro_test_plus::detail::expression_formatter::operator<<(), micro_os_plus::micro_test_plus::detail::expression_formatter::operator<<(), micro_os_plus::micro_test_plus::detail::expression_formatter::operator<<(), micro_os_plus::micro_test_plus::detail::expression_formatter::operator<<(), micro_os_plus::micro_test_plus::detail::expression_formatter::operator<<(), micro_os_plus::micro_test_plus::detail::expression_formatter::operator<<(), micro_os_plus::micro_test_plus::detail::expression_formatter::operator<<(), micro_os_plus::micro_test_plus::detail::expression_formatter::operator<<(), micro_os_plus::micro_test_plus::detail::expression_formatter::operator<<(), micro_os_plus::micro_test_plus::detail::expression_formatter::operator<<(), micro_os_plus::micro_test_plus::detail::expression_formatter::operator<<(), and micro_os_plus::micro_test_plus::reporter::operator<<().