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