summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qstringapisymmetry
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2017-10-17 07:31:42 -0700
committerLars Knoll <lars.knoll@qt.io>2017-10-29 10:13:13 +0000
commit0e0f656f5031585c6b691d80057dfdc00bc48400 (patch)
treea1924fa5e8e0ea3ab5bfc264c9b1b82583f0827e /tests/auto/corelib/tools/qstringapisymmetry
parent81f251660026fff198daf8920edc62bbc782ff7d (diff)
Mark the previously public qstringalgorithms.h functions private
Discussed during Qt Contributor Summit 2017. We concluded that we don't want to make these functions public, as they do not follow Qt coding style API. Specifically, qStartsWith(a, b) is not easily understood which argument is the needle and which argument is the haystack (same problem memcpy() has). Compare that to a.startsWith(b) which can clearly be read in English as a subject-verb-object sentence. This commit removes the unit tests that called compare(). Discussed-on: http://lists.qt-project.org/pipermail/development/2017-October/031060.html Change-Id: Icaa86fc7b54d4b368c0efffd14ee6205eb9043fb Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'tests/auto/corelib/tools/qstringapisymmetry')
-rw-r--r--tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp31
1 files changed, 1 insertions, 30 deletions
diff --git a/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp b/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp
index e482b409a5..61d1f86f00 100644
--- a/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp
+++ b/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp
@@ -483,32 +483,6 @@ struct has_qCompareStrings {
};
template <typename LHS, typename RHS>
-using if_has_qCompareStrings = typename std::enable_if<has_qCompareStrings<LHS, RHS>::value, bool>::type;
-
-template <typename LHS, typename RHS>
-using if_lacks_qCompareStrings = typename std::enable_if<!has_qCompareStrings<LHS, RHS>::value, bool>::type;
-
-static inline Q_DECL_CONSTEXPR int sign(int x) Q_DECL_NOTHROW
-{
- return x < 0 ? -1 :
- x > 0 ? +1 :
- /*else*/ 0 ;
-}
-
-template <typename LHS, typename RHS, if_has_qCompareStrings<LHS, RHS> = true>
-int qCompareStringsWrapper(const LHS &lhs, const RHS &rhs, Qt::CaseSensitivity cs, int)
- Q_DECL_NOEXCEPT_EXPR(noexcept(qCompareStrings(lhs, rhs, cs)))
-{
- return qCompareStrings(lhs, rhs, cs);
-}
-
-template <typename LHS, typename RHS, if_lacks_qCompareStrings<LHS, RHS> = true>
-int qCompareStringsWrapper(const LHS &, const RHS &, Qt::CaseSensitivity, int result)
-{
- return result;
-}
-
-template <typename LHS, typename RHS>
void tst_QStringApiSymmetry::compare_impl() const
{
QFETCH(QStringRef, lhsUnicode);
@@ -517,6 +491,7 @@ 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();
@@ -533,10 +508,6 @@ void tst_QStringApiSymmetry::compare_impl() const
# define QVERIFY_NOEXCEPT(expr)
#endif
- QCOMPARE(sign(qCompareStringsWrapper(lhs, rhs, Qt::CaseSensitive, caseSensitiveCompareResult)),
- sign(caseSensitiveCompareResult));
- QCOMPARE(sign(qCompareStringsWrapper(lhs, rhs, Qt::CaseInsensitive, caseInsensitiveCompareResult)),
- sign(caseInsensitiveCompareResult));
#define CHECK(op) \
QVERIFY_NOEXCEPT(lhs op rhs); \
do { if (caseSensitiveCompareResult op 0) { \