tst_QCompare: restore some test coverage to QPartialOrdering
When I split Qt::partial_ordering off of QPartialOrdering, O
duplicated the partialOrdering() test, but lost the conversion() part
of the tests.
This patch brings them back.
Because we maintained the test coverage for Qt::partial_ordering, it
suffices to check that QPartialOrdering::X correctly maps to
std::partial_ordering::x. The rest follows from transtivity of
equality.
We're still lacking conversions of QPartialOrdering to Qt::_ordering
types. That will be the subject of a follow-up patch.
Amends 4b6f757020.
Change-Id: I1938d09f696ed8d58143dbacccb72cfd54ca12dd
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
bb10
parent
ddb646d17b
commit
6e41101217
|
|
@ -13,6 +13,7 @@ class tst_QCompare: public QObject
|
|||
Q_OBJECT
|
||||
private slots:
|
||||
void legacyPartialOrdering();
|
||||
void legacyConversions();
|
||||
void stdQtBinaryCompatibility();
|
||||
void partialOrdering();
|
||||
void weakOrdering();
|
||||
|
|
@ -131,6 +132,27 @@ void tst_QCompare::legacyPartialOrdering()
|
|||
static_assert(!(0 >= QPartialOrdering::Greater));
|
||||
}
|
||||
|
||||
void tst_QCompare::legacyConversions()
|
||||
{
|
||||
#define CHECK_CONVERTS(Lhs, Rhs) static_assert(std::is_convertible_v<Lhs, Rhs>)
|
||||
#define CHECK_ALL(NS) do { \
|
||||
CHECK_CONVERTS(QPartialOrdering, NS ::partial_ordering); \
|
||||
static_assert(QPartialOrdering::Less == NS ::partial_ordering::less); \
|
||||
static_assert(QPartialOrdering::Greater == NS ::partial_ordering::greater); \
|
||||
static_assert(QPartialOrdering::Equivalent == NS ::partial_ordering::equivalent); \
|
||||
static_assert(QPartialOrdering::Unordered == NS ::partial_ordering::unordered); \
|
||||
\
|
||||
CHECK_CONVERTS(NS ::partial_ordering, QPartialOrdering); \
|
||||
} while (false)
|
||||
|
||||
#ifdef __cpp_lib_three_way_comparison
|
||||
CHECK_ALL(std);
|
||||
#endif // __cpp_lib_three_way_comparison
|
||||
|
||||
#undef CHECK_ALL
|
||||
#undef CHECK_CONVERTS
|
||||
}
|
||||
|
||||
void tst_QCompare::stdQtBinaryCompatibility()
|
||||
{
|
||||
#ifndef __cpp_lib_three_way_comparison
|
||||
|
|
|
|||
Loading…
Reference in New Issue