micro-test-plus
5.0.1
µTest++ Testing Framework
Toggle main menu visibility
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
49
#include "
micro-os-plus/micro-test-plus/detail.h
"
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
64
namespace
micro_os_plus::micro_test_plus
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>
104
requires
(
type_traits::container_like<Lhs_T>
105
and
type_traits::container_like<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>
122
requires
(
type_traits::container_like<Lhs_T>
123
and
type_traits::container_like<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>
137
requires
type_traits::any_op<Lhs_T, 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>
151
requires
type_traits::any_op<Lhs_T, 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>
165
requires
type_traits::any_op<Lhs_T, 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>
180
requires
type_traits::any_op<Lhs_T, 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>
194
requires
type_traits::any_op<Lhs_T, 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>
209
requires
type_traits::any_op<Lhs_T, 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>
223
requires
type_traits::any_op<Lhs_T, 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>
237
requires
type_traits::any_op<Lhs_T, 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
// ----------------------------------------------------------------------------
micro_os_plus::micro_test_plus::type_traits::any_op
C++20 concept satisfied when at least one of two types derives from op.
Definition
type-traits.h:463
micro_os_plus::micro_test_plus::type_traits::container_like
C++20 concept satisfied when T provides both begin() and end() member functions.
Definition
type-traits.h:372
micro_os_plus::micro_test_plus::type_traits::is_op
C++20 concept satisfied when a type derives from op.
Definition
type-traits.h:446
detail.h
C++ header file with declarations for the µTest++ internals.
micro_os_plus::micro_test_plus::operators::operator<=
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...
Definition
operators-inlines.h:211
micro_os_plus::micro_test_plus::operators::operator<
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).
Definition
operators-inlines.h:196
micro_os_plus::micro_test_plus::operators::operator>=
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...
Definition
operators-inlines.h:182
micro_os_plus::micro_test_plus::operators::operator>
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).
Definition
operators-inlines.h:167
micro_os_plus::micro_test_plus::operators::operator!=
constexpr auto operator!=(std::string_view lhs, std::string_view rhs)
Non-equality operator for string_view objects.
Definition
operators-inlines.h:89
micro_os_plus::micro_test_plus::operators::operator==
constexpr auto operator==(std::string_view lhs, std::string_view rhs)
Equality operator for string_view objects.
Definition
operators-inlines.h:77
micro_os_plus::micro_test_plus::operators
Custom operator overloads for expressive and type-safe test assertions.
Definition
operators-inlines.h:67
micro_os_plus::micro_test_plus
Primary namespace for the µTest++ testing framework.
Definition
deferred-reporter.h:82
micro_os_plus::micro_test_plus::detail::and_
Logical AND comparator struct template.
Definition
detail.h:512
micro_os_plus::micro_test_plus::detail::eq_
Equality comparator struct template.
Definition
detail.h:315
micro_os_plus::micro_test_plus::detail::ge_
Greater than or equal comparator struct template.
Definition
detail.h:412
micro_os_plus::micro_test_plus::detail::gt_
Greater than comparator struct template.
Definition
detail.h:379
micro_os_plus::micro_test_plus::detail::le_
Less than or equal comparator struct template.
Definition
detail.h:478
micro_os_plus::micro_test_plus::detail::lt_
Less than comparator struct template.
Definition
detail.h:445
micro_os_plus::micro_test_plus::detail::ne_
Non-equality comparator struct template.
Definition
detail.h:347
micro_os_plus::micro_test_plus::detail::not_
Logical NOT comparator struct template.
Definition
detail.h:576
micro_os_plus::micro_test_plus::detail::or_
Logical OR comparator struct template.
Definition
detail.h:545
include
micro-os-plus
micro-test-plus
inlines
operators-inlines.h
Generated by
1.17.0