summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
authorAndreas Buhr <andreas.buhr@qt.io>2020-11-19 12:42:15 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-11-21 15:57:14 +0000
commit628ce898fa609e98db057472280b6ff3369669b9 (patch)
treecefb66d2ead29b623d239394affcb2ff610e6db3 /tests/auto/corelib
parent7b2b4bb5d092e215cd59b8c28bda69000a6c2fd4 (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. Change-Id: Id8e0d8af87e7e7ab192fb7554a278ddbb890fb14 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit ae2c30942086bd0387c6d5297c0cb85b505f29a0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/auto/corelib')
-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 */ \