micro-test-plus 4.1.0
µ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_TEST_PLUS_OPERATORS_INLINES_H_
41#define MICRO_TEST_PLUS_OPERATORS_INLINES_H_
42
43// ----------------------------------------------------------------------------
44
45#ifdef __cplusplus
46
47// ----------------------------------------------------------------------------
48
50
51// ----------------------------------------------------------------------------
52
53#if defined(__GNUC__)
54#pragma GCC diagnostic push
55#pragma GCC diagnostic ignored "-Waggregate-return"
56#if defined(__clang__)
57#pragma clang diagnostic ignored "-Wc++98-compat"
58#endif
59#endif
60
61// ============================================================================
62
64{
65 namespace operators
66 {
67 // ========================================================================
68
75 constexpr auto
76 operator== (std::string_view lhs, std::string_view rhs)
77 {
78 return detail::eq_{ lhs, rhs };
79 }
80
87 constexpr auto
88 operator!= (std::string_view lhs, std::string_view rhs)
89 {
90 return detail::ne_{ lhs, rhs };
91 }
92
102 template <class Lhs_T, class Rhs_T>
105 constexpr auto
106 operator== (const Lhs_T& lhs, const Rhs_T& rhs)
107 {
108 return detail::eq_{ lhs, rhs };
109 }
110
120 template <class Lhs_T, class Rhs_T>
123 constexpr auto
124 operator!= (const Lhs_T& lhs, const Rhs_T& rhs)
125 {
126 return detail::ne_{ lhs, rhs };
127 }
128
135 template <class Lhs_T, class Rhs_T>
137 constexpr auto
138 operator== (const Lhs_T& lhs, const Rhs_T& rhs)
139 {
140 return detail::eq_{ lhs, rhs };
141 }
142
149 template <class Lhs_T, class Rhs_T>
151 constexpr auto
152 operator!= (const Lhs_T& lhs, const Rhs_T& rhs)
153 {
154 return detail::ne_{ lhs, rhs };
155 }
156
163 template <class Lhs_T, class Rhs_T>
165 constexpr auto
166 operator> (const Lhs_T& lhs, const Rhs_T& rhs)
167 {
168 return detail::gt_{ lhs, rhs };
169 }
170
178 template <class Lhs_T, class Rhs_T>
180 constexpr auto
181 operator>= (const Lhs_T& lhs, const Rhs_T& rhs)
182 {
183 return detail::ge_{ lhs, rhs };
184 }
185
192 template <class Lhs_T, class Rhs_T>
194 constexpr auto
195 operator< (const Lhs_T& lhs, const Rhs_T& rhs)
196 {
197 return detail::lt_{ lhs, rhs };
198 }
199
207 template <class Lhs_T, class Rhs_T>
209 constexpr auto
210 operator<= (const Lhs_T& lhs, const Rhs_T& rhs)
211 {
212 return detail::le_{ lhs, rhs };
213 }
214
221 template <class Lhs_T, class Rhs_T>
223 constexpr auto
224 operator and (const Lhs_T& lhs, const Rhs_T& rhs)
225 {
226 return detail::and_{ lhs, rhs };
227 }
228
235 template <class Lhs_T, class Rhs_T>
237 constexpr auto
238 operator or (const Lhs_T& lhs, const Rhs_T& rhs)
239 {
240 return detail::or_{ lhs, rhs };
241 }
242
249 template <class T>
250 requires type_traits::is_op<T>
251 constexpr auto
252 operator not(const T& t)
253 {
254 return detail::not_{ t };
255 }
256
257 // ------------------------------------------------------------------------
258 } // namespace operators
259
260 // --------------------------------------------------------------------------
261} // namespace micro_os_plus::micro_test_plus
262
263#if defined(__GNUC__)
264#pragma GCC diagnostic pop
265#endif
266
267// ----------------------------------------------------------------------------
268
269#endif // __cplusplus
270
271// ----------------------------------------------------------------------------
272
273#endif // MICRO_TEST_PLUS_OPERATORS_INLINES_H_
274
275// ----------------------------------------------------------------------------
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:503
Equality comparator struct template.
Definition detail.h:306
Greater than or equal comparator struct template.
Definition detail.h:403
Greater than comparator struct template.
Definition detail.h:370
Less than or equal comparator struct template.
Definition detail.h:469
Less than comparator struct template.
Definition detail.h:436
Non-equality comparator struct template.
Definition detail.h:338
Logical NOT comparator struct template.
Definition detail.h:567
Logical OR comparator struct template.
Definition detail.h:536