micro-test-plus 6.0.1
µTest++ Testing Framework
Loading...
Searching...
No Matches
math.h
Go to the documentation of this file.
1/*
2 * This file is part of the µOS++ project (https://micro-os-plus.github.io/).
3 * Copyright (c) 2021-2026 Liviu Ionescu. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose is hereby granted, under the terms of the MIT license.
7 *
8 * If a copy of the license was not distributed with this file, it can be
9 * obtained from https://opensource.org/licenses/mit.
10 *
11 * Major parts of the code are inspired from v1.1.8 of the Boost UT project,
12 * released under the terms of the Boost Version 1.0 Software License,
13 * which can be obtained from https://www.boost.org/LICENSE_1_0.txt.
14 */
15
16// ----------------------------------------------------------------------------
17
42
43#ifndef MICRO_OS_PLUS_MICRO_TEST_PLUS_MATH_H_
44#define MICRO_OS_PLUS_MICRO_TEST_PLUS_MATH_H_
45
46// ----------------------------------------------------------------------------
47
48#if defined(__cplusplus)
49
50// ----------------------------------------------------------------------------
51
52#if __has_include("micro-os-plus/project-config.h")
53#include "micro-os-plus/project-config.h"
54#endif // __has_include("micro-os-plus/project-config.h")
55
56#if __has_include("micro-os-plus/micro-test-plus-defines.h")
57#include "micro-os-plus/micro-test-plus-defines.h"
58#endif // __has_include("micro-os-plus/micro-test-plus-defines.h")
59
60#include <array>
61#include <limits>
62
63// ----------------------------------------------------------------------------
64
65#if defined(__GNUC__)
66#pragma GCC diagnostic push
67
68#pragma GCC diagnostic ignored "-Wconversion"
69#pragma GCC diagnostic ignored "-Wpadded"
70#if defined(__clang__)
71#pragma clang diagnostic ignored "-Wc++98-compat"
72#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
73#pragma clang diagnostic ignored "-Wc++20-compat"
74#endif // defined(__clang__)
75#endif // defined(__GNUC__)
76
77// ============================================================================
78
80{
81 // --------------------------------------------------------------------------
82
104 namespace detail::math
105 {
115 template <class T>
116 [[nodiscard]] constexpr auto
117 abs (const T t) noexcept -> T;
118
119#if defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_DEPRECATED_ENABLED)
130 template <class T>
131 [[nodiscard]] constexpr auto
132 min_value (const T& lhs, const T& rhs) noexcept -> const T&;
133#endif // defined(MICRO_OS_PLUS_MICRO_TEST_PLUS_DEPRECATED_ENABLED)
134
135 // ------------------------------------------------------------------------
136 } // namespace detail::math
137
138 // --------------------------------------------------------------------------
139} // namespace micro_os_plus::micro_test_plus
140
141#if defined(__GNUC__)
142#pragma GCC diagnostic pop
143#endif // defined(__GNUC__)
144
145// ----------------------------------------------------------------------------
146
147#endif // defined(__cplusplus)
148
149// ============================================================================
150// Templates, inlines & constexpr implementations.
151
152#include "inlines/math-inlines.h"
153
154// ----------------------------------------------------------------------------
155
156#endif // MICRO_OS_PLUS_MICRO_TEST_PLUS_MATH_H_
157
158// ----------------------------------------------------------------------------
C++ header file with inline implementations for the µTest++ mathematical utilities.
Internal mathematical utilities for the µTest++ testing framework.
Definition deprecated.h:123
constexpr auto abs(const T t) noexcept -> T
Computes the absolute value of a given comparable value.
constexpr auto min_value(const T &lhs, const T &rhs) noexcept -> const T &
Computes the minimum of two comparable values.
Primary namespace for the µTest++ testing framework.