micro-test-plus 5.0.1
µTest++ Testing Framework
Loading...
Searching...
No Matches
operators-inlines.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
39
40#ifndef MICRO_OS_PLUS_MICRO_TEST_PLUS_INLINES_OPERATORS_INLINES_H_
41#define MICRO_OS_PLUS_MICRO_TEST_PLUS_INLINES_OPERATORS_INLINES_H_
42
43// ----------------------------------------------------------------------------
44
45#if defined(__cplusplus)
46
47// ----------------------------------------------------------------------------
48
50
51// ----------------------------------------------------------------------------
52
53#if defined(__GNUC__)
54#pragma GCC diagnostic push
55
56#pragma GCC diagnostic ignored "-Waggregate-return"
57#if defined(__clang__)
58#pragma clang diagnostic ignored "-Wc++98-compat"
59#endif // defined(__clang__)
60#endif // defined(__GNUC__)
61
62// ============================================================================
63
65{
66 namespace operators
67 {
68 // ========================================================================
69
76 constexpr auto
77 operator== (std::string_view lhs, std::string_view rhs)
78 {
79 return detail::eq_{ lhs, rhs };
80 }
81
88 constexpr auto
89 operator!= (std::string_view lhs, std::string_view rhs)
90 {
91 return detail::ne_{ lhs, rhs };
92 }
93
103 template <class Lhs_T, class Rhs_T>
106 constexpr auto
107 operator== (const Lhs_T& lhs, const Rhs_T& rhs)
108 {
109 return detail::eq_{ lhs, rhs };
110 }
111
121 template <class Lhs_T, class Rhs_T>
124 constexpr auto
125 operator!= (const Lhs_T& lhs, const Rhs_T& rhs)
126 {
127 return detail::ne_{ lhs, rhs };
128 }
129
136 template <class Lhs_T, class Rhs_T>
138 constexpr auto
139 operator== (const Lhs_T& lhs, const Rhs_T& rhs)
140 {
141 return detail::eq_{ lhs, rhs };
142 }
143
150 template <class Lhs_T, class Rhs_T>
152 constexpr auto
153 operator!= (const Lhs_T& lhs, const Rhs_T& rhs)
154 {
155 return detail::ne_{ lhs, rhs };
156 }
157
164 template <class Lhs_T, class Rhs_T>
166 constexpr auto
167 operator> (const Lhs_T& lhs, const Rhs_T& rhs)
168 {
169 return detail::gt_{ lhs, rhs };
170 }
171
179 template <class Lhs_T, class Rhs_T>
181 constexpr auto
182 operator>= (const Lhs_T& lhs, const Rhs_T& rhs)
183 {
184 return detail::ge_{ lhs, rhs };
185 }
186
193 template <class Lhs_T, class Rhs_T>
195 constexpr auto
196 operator< (const Lhs_T& lhs, const Rhs_T& rhs)
197 {
198 return detail::lt_{ lhs, rhs };
199 }
200
208 template <class Lhs_T, class Rhs_T>
210 constexpr auto
211 operator<= (const Lhs_T& lhs, const Rhs_T& rhs)
212 {
213 return detail::le_{ lhs, rhs };
214 }
215
222 template <class Lhs_T, class Rhs_T>
224 constexpr auto
225 operator and (const Lhs_T& lhs, const Rhs_T& rhs)
226 {
227 return detail::and_{ lhs, rhs };
228 }
229
236 template <class Lhs_T, class Rhs_T>
238 constexpr auto
239 operator or (const Lhs_T& lhs, const Rhs_T& rhs)
240 {
241 return detail::or_{ lhs, rhs };
242 }
243
250 template <class T>
251 requires type_traits::is_op<T>
252 constexpr auto
253 operator not(const T& t)
254 {
255 return detail::not_{ t };
256 }
257
258 // ------------------------------------------------------------------------
259 } // namespace operators
260
261 // --------------------------------------------------------------------------
262} // namespace micro_os_plus::micro_test_plus
263
264#if defined(__GNUC__)
265#pragma GCC diagnostic pop
266#endif // defined(__GNUC__)
267
268// ----------------------------------------------------------------------------
269
270#endif // defined(__cplusplus)
271
272// ----------------------------------------------------------------------------
273
274#endif // MICRO_OS_PLUS_MICRO_TEST_PLUS_INLINES_OPERATORS_INLINES_H_
275
276// ----------------------------------------------------------------------------
C++20 concept satisfied when at least one of two types derives from op.
C++20 concept satisfied when T provides both begin() and end() member functions.
C++20 concept satisfied when a type derives from op.
C++ header file with declarations for the µTest++ internals.
constexpr auto operator<=(const Lhs_T &lhs, const Rhs_T &rhs)
Less than or equal operator. Matches only if at least one operand is of local type (derived from loca...
constexpr auto operator<(const Lhs_T &lhs, const Rhs_T &rhs)
Less than operator. Matches only if at least one operand is of local type (derived from local op).
constexpr auto operator>=(const Lhs_T &lhs, const Rhs_T &rhs)
Greater than or equal operator. Matches only if at least one operand is of local type (derived from l...
constexpr auto operator>(const Lhs_T &lhs, const Rhs_T &rhs)
Greater than operator. Matches only if at least one operand is of local type (derived from local op).
constexpr auto operator!=(std::string_view lhs, std::string_view rhs)
Non-equality operator for string_view objects.
constexpr auto operator==(std::string_view lhs, std::string_view rhs)
Equality operator for string_view objects.
Custom operator overloads for expressive and type-safe test assertions.
Primary namespace for the µTest++ testing framework.
Logical AND comparator struct template.
Definition detail.h:512
Equality comparator struct template.
Definition detail.h:315
Greater than or equal comparator struct template.
Definition detail.h:412
Greater than comparator struct template.
Definition detail.h:379
Less than or equal comparator struct template.
Definition detail.h:478
Less than comparator struct template.
Definition detail.h:445
Non-equality comparator struct template.
Definition detail.h:347
Logical NOT comparator struct template.
Definition detail.h:576
Logical OR comparator struct template.
Definition detail.h:545