From ae2c30942086bd0387c6d5297c0cb85b505f29a0 Mon Sep 17 00:00:00 2001 From: Andreas Buhr Date: Thu, 19 Nov 2020 12:42:15 +0100 Subject: 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 Reviewed-by: Thiago Macieira --- .../corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp b/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp index 9f94de7af2..7a3448fdd6 100644 --- a/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp +++ b/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp @@ -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(lhsUnicode, lhsLatin1, lhsU8); const auto rhs = make(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 */ \ -- cgit v1.2.3