Add TEST_ALL_COMPARISON to tst_qstringview
While porting some of these tests to QUtf8StringView, Thiago suggested to add the comparison tests from qcomparisontesthelper_p.h. Pick-to: 6.8 Change-Id: Id8f2c1c5690f7219ac000eebb637f48acbc5662d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 1ecbad8da9828dc561268d0fce8c24239f0a7f2d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
4019fca886
commit
1e51b8ac7b
@ -17,6 +17,7 @@ qt_internal_add_test(tst_qstringview
|
||||
arrays_of_unknown_bounds.cpp arrays_of_unknown_bounds.h
|
||||
LIBRARIES
|
||||
Qt::CorePrivate
|
||||
Qt::TestPrivate
|
||||
)
|
||||
|
||||
if(QT_FEATURE_sanitize_undefined)
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <QChar>
|
||||
#include <QVarLengthArray>
|
||||
#include <QList>
|
||||
#include <private/qcomparisontesthelper_p.h>
|
||||
#if QT_CONFIG(cpp_winrt)
|
||||
# include <private/qt_winrtbase_p.h>
|
||||
#endif
|
||||
@ -423,9 +424,7 @@ void tst_QStringView::basics() const
|
||||
QVERIFY(sv1.isEmpty());
|
||||
|
||||
QStringView sv2;
|
||||
|
||||
QVERIFY(sv2 == sv1);
|
||||
QVERIFY(!(sv2 != sv1));
|
||||
QT_TEST_ALL_COMPARISON_OPS(sv2, sv1, Qt::strong_ordering::equal);
|
||||
}
|
||||
|
||||
void tst_QStringView::literals() const
|
||||
@ -885,6 +884,9 @@ void tst_QStringView::comparison()
|
||||
QVERIFY(aa < bb);
|
||||
QVERIFY(bb > aa);
|
||||
|
||||
QT_TEST_ALL_COMPARISON_OPS(aa, aa, Qt::strong_ordering::equal);
|
||||
QT_TEST_ALL_COMPARISON_OPS(aa, bb, Qt::strong_ordering::less);
|
||||
|
||||
QCOMPARE(aa.compare(aa), 0);
|
||||
QVERIFY(aa.compare(upperAa) != 0);
|
||||
QCOMPARE(aa.compare(upperAa, Qt::CaseInsensitive), 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user