|
| 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 653 of file detail-inlines.h.
654 {
655 char buf[32];
656 if constexpr (std::is_same_v<T, long double>)
657 {
658#if defined(_WIN32) \
659 || (defined(__SIZEOF_LONG_DOUBLE__) \
660 && __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__)
661
662
663
664
665
666 const auto [ptr, ec] = std::to_chars (buf, buf + sizeof (buf),
667 static_cast<double> (v));
668 if (ec == std::errc{})
669 buffer.append (buf, ptr);
670#else
671
672
673
674
675 snprintf (buf, sizeof (buf), "%Lg", v);
676 buffer.append (buf);
677#endif
678 }
679 else
680 {
681 const auto [ptr, ec] = std::to_chars (buf, buf + sizeof (buf), v);
682 if (ec == std::errc{})
683 buffer.append (buf, ptr);
684 }
685 }
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<<().