-
User Story
-
Resolution: Unresolved
-
P2: Important
-
None
-
None
-
None
-
5
-
Foundation PM Prioritized
Following the implementation of QTBUG-98873, I would also like a QCOMPARE macro that tests my C++20 spaceship operators <=>. It's tedious to use the moral equivalents of
QVERIFY((a <=> b) == r); QCOMPARE(a <=> b, r);
esp since the std::*_ordering types don't support comparing two objects of their type with each other.
Locally, I have defined me a
#define COMPARE_3WAY(a, b, r) \
do { \
static_assert(std::is_same_v<decltype((a) <=> (b)), decltype(r)>) ; \
const auto actual = (a) <=> (b); \
QCOMPARE(std::is_eq(actual), std::is_eq(r); \
QCOMPARE(std::is_lt(actual), std::is_lt(r); \
QCOMPARE(std::is_gt(actual), std::is_gt(r); \
} while (0)
But that, of course, doesn't output the values of a, b, and r upon failure, and doesn't work with strong_ordering::equivalent).
- is required for
-
QTBUG-104111 Modernize comparisons [Core: Date/Time]
-
- Open
-
-
QTBUG-104113 Modernize comparisons: can we provide macros?
-
- Open
-
| For Gerrit Dashboard: QTBUG-104108 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V |
| 415262,3 | tst_QAnyStringView: explicitly check the spaceship operator | dev | qt/qtbase | Status: MERGED | +2 | 0 |
| 416070,2 | tst_QAnyStringView: explicitly check the spaceship operator | 6.4 | qt/qtbase | Status: MERGED | +2 | 0 |
| 416071,3 | tst_QAnyStringView: explicitly check the spaceship operator | 6.3 | qt/qtbase | Status: MERGED | +2 | 0 |
| 416082,3 | tst_QAnyStringView: explicitly check the spaceship operator | tqtc/lts-6.2 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |
| 565936,50 | Create a QCOMPARE_3WAY macro to test the C++20 spaceship operator <=> | dev | qt/qtbase | Status: MERGED | +2 | 0 |