Add unit test for QAnyStringView::compare
Coverage tests revealed that QAnyStringView::compare(QAnyStringView, QAnyStringView, CaseSensitivity) was not tested in our unit tests. This patch adds a test for this. Pick-to: 6.0 Change-Id: Id8e0d8af87e7e7ab192fb7554a278ddbb890fb14 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
146a2a21b1
commit
ae2c309420
@ -930,7 +930,6 @@ void tst_QStringApiSymmetry::compare_impl() const
|
||||
QFETCH(QLatin1String, rhsLatin1);
|
||||
QFETCH(int, caseSensitiveCompareResult);
|
||||
QFETCH(const int, caseInsensitiveCompareResult);
|
||||
Q_UNUSED(caseInsensitiveCompareResult);
|
||||
|
||||
const auto lhsU8 = lhsUnicode.toUtf8();
|
||||
const auto rhsU8 = rhsUnicode.toUtf8();
|
||||
@ -938,6 +937,14 @@ void tst_QStringApiSymmetry::compare_impl() const
|
||||
const auto lhs = make<LHS>(lhsUnicode, lhsLatin1, lhsU8);
|
||||
const auto rhs = make<RHS>(rhsUnicode, rhsLatin1, rhsU8);
|
||||
|
||||
auto icResult = sign(
|
||||
QAnyStringView::compare(QAnyStringView(lhs), QAnyStringView(rhs), Qt::CaseInsensitive));
|
||||
QCOMPARE(icResult, caseInsensitiveCompareResult);
|
||||
|
||||
auto scResult = sign(
|
||||
QAnyStringView::compare(QAnyStringView(lhs), QAnyStringView(rhs), Qt::CaseSensitive));
|
||||
QCOMPARE(scResult, caseSensitiveCompareResult);
|
||||
|
||||
#define CHECK(op) \
|
||||
do { \
|
||||
/* comment out the noexcept check for now, as we first need to sort all the overloads anew */ \
|
||||
|
Loading…
Reference in New Issue
Block a user