summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorAndreas Buhr <andreas.buhr@qt.io>2020-11-19 12:42:15 +0100
committerAndreas Buhr <andreas.buhr@qt.io>2020-11-21 06:11:55 +0100
commitae2c30942086bd0387c6d5297c0cb85b505f29a0 (patch)
treeffa217ec05bf42b252391f41fd84022de1052754 /tests/auto
parent146a2a21b1fd279e3f26690243db30fba89f9027 (diff)
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>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp9
1 files changed, 8 insertions, 1 deletions
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<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 */ \