From 0e0f656f5031585c6b691d80057dfdc00bc48400 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 17 Oct 2017 07:31:42 -0700 Subject: 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 --- .../qstringapisymmetry/tst_qstringapisymmetry.cpp | 31 +--------------------- 1 file changed, 1 insertion(+), 30 deletions(-) (limited to 'tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp') 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 @@ -482,32 +482,6 @@ struct has_qCompareStrings { !is_utf8_encoded::value && !is_utf8_encoded::value }; }; -template -using if_has_qCompareStrings = typename std::enable_if::value, bool>::type; - -template -using if_lacks_qCompareStrings = typename std::enable_if::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 = 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 = true> -int qCompareStringsWrapper(const LHS &, const RHS &, Qt::CaseSensitivity, int result) -{ - return result; -} - template void tst_QStringApiSymmetry::compare_impl() const { @@ -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) { \ -- cgit v1.2.3