232 constexpr bool isQOrderingType = std::is_same_v<OrderingType, Qt::partial_ordering>
233 || std::is_same_v<OrderingType, Qt::weak_ordering>
234 || std::is_same_v<OrderingType, Qt::strong_ordering>;
235#ifdef __cpp_lib_three_way_comparison
236 constexpr bool isStdOrderingType = std::is_same_v<OrderingType, std::partial_ordering>
237 || std::is_same_v<OrderingType, std::weak_ordering>
238 || std::is_same_v<OrderingType, std::strong_ordering>;
240 constexpr bool isStdOrderingType =
false;
243 static_assert(isQOrderingType || isStdOrderingType,
244 "Please provide, as the expectedOrdering parameter, a value "
245 "of one of the Qt::{partial,weak,strong}_ordering or "
246 "std::{partial,weak,strong}_ordering types.");
250 const bool expectedEqual = expectedOrdering == Qt::partial_ordering::equivalent;
251 const bool expectedLess = expectedOrdering == Qt::partial_ordering::less;
252 const bool expectedUnordered = expectedOrdering == Qt::partial_ordering::unordered;
255 !expectedUnordered && expectedEqual);
257 expectedUnordered || !expectedEqual);
259 !expectedUnordered && expectedLess);
261 !expectedUnordered && !expectedLess && !expectedEqual);
263 !expectedUnordered && (expectedEqual || expectedLess));
265 !expectedUnordered && !expectedLess);
266#ifdef __cpp_lib_three_way_comparison
267 if constexpr (implementsThreeWayComparisonOp_v<LeftType, RightType>) {
268 if constexpr (std::is_convertible_v<OrderingType, std::strong_ordering>)
269 static_assert(std::is_same_v<
decltype(lhs <=> rhs), std::strong_ordering>);
270 else if constexpr (std::is_convertible_v<OrderingType, std::weak_ordering>)
271 static_assert(std::is_same_v<
decltype(lhs <=> rhs), std::weak_ordering>);
273 static_assert(std::is_same_v<
decltype(lhs <=> rhs), std::partial_ordering>);
275 CHECK_RUNTIME_CREF(CHECK_RUNTIME_3WAY, lhs, rhs, ==,
276 !expectedUnordered && expectedEqual);
277 CHECK_RUNTIME_CREF(CHECK_RUNTIME_3WAY, lhs, rhs, !=,
278 expectedUnordered || !expectedEqual);
279 CHECK_RUNTIME_CREF(CHECK_RUNTIME_3WAY, lhs, rhs, <,
280 !expectedUnordered && expectedLess);
281 CHECK_RUNTIME_CREF(CHECK_RUNTIME_3WAY, lhs, rhs, >,
282 !expectedUnordered && !expectedLess && !expectedEqual);
283 CHECK_RUNTIME_CREF(CHECK_RUNTIME_3WAY, lhs, rhs, <=,
284 !expectedUnordered && (expectedEqual || expectedLess));
285 CHECK_RUNTIME_CREF(CHECK_RUNTIME_3WAY, lhs, rhs, >=,
286 !expectedUnordered && !expectedLess);
291 !expectedUnordered && expectedEqual);
293 expectedUnordered || !expectedEqual);
295 !expectedUnordered && !expectedLess && !expectedEqual);
297 !expectedUnordered && expectedLess);
299 !expectedUnordered && !expectedLess);
301 !expectedUnordered && (expectedEqual || expectedLess));
302#ifdef __cpp_lib_three_way_comparison
303 if constexpr (implementsThreeWayComparisonOp_v<LeftType, RightType>) {
304 if constexpr (std::is_convertible_v<OrderingType, std::strong_ordering>)
305 static_assert(std::is_same_v<
decltype(rhs <=> lhs), std::strong_ordering>);
306 else if constexpr (std::is_convertible_v<OrderingType, std::weak_ordering>)
307 static_assert(std::is_same_v<
decltype(rhs <=> lhs), std::weak_ordering>);
309 static_assert(std::is_same_v<
decltype(rhs <=> lhs), std::partial_ordering>);
311 CHECK_RUNTIME_CREF(CHECK_RUNTIME_3WAY, rhs, lhs, ==,
312 !expectedUnordered && expectedEqual);
313 CHECK_RUNTIME_CREF(CHECK_RUNTIME_3WAY, rhs, lhs, !=,
314 expectedUnordered || !expectedEqual);
315 CHECK_RUNTIME_CREF(CHECK_RUNTIME_3WAY, rhs, lhs, <,
316 !expectedUnordered && !expectedLess && !expectedEqual);
317 CHECK_RUNTIME_CREF(CHECK_RUNTIME_3WAY, rhs, lhs, >,
318 !expectedUnordered && expectedLess);
319 CHECK_RUNTIME_CREF(CHECK_RUNTIME_3WAY, rhs, lhs, <=,
320 !expectedUnordered && !expectedLess);
321 CHECK_RUNTIME_CREF(CHECK_RUNTIME_3WAY, rhs, lhs, >=,
322 !expectedUnordered && (expectedEqual || expectedLess));