diff options
Diffstat (limited to 'tests/auto/corelib/text/qbytearraymatcher')
-rw-r--r-- | tests/auto/corelib/text/qbytearraymatcher/CMakeLists.txt | 9 | ||||
-rw-r--r-- | tests/auto/corelib/text/qbytearraymatcher/tst_qbytearraymatcher.cpp | 19 |
2 files changed, 13 insertions, 15 deletions
diff --git a/tests/auto/corelib/text/qbytearraymatcher/CMakeLists.txt b/tests/auto/corelib/text/qbytearraymatcher/CMakeLists.txt index a70d8d91b6..f500210f0f 100644 --- a/tests/auto/corelib/text/qbytearraymatcher/CMakeLists.txt +++ b/tests/auto/corelib/text/qbytearraymatcher/CMakeLists.txt @@ -1,9 +1,16 @@ -# Generated from qbytearraymatcher.pro. +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause ##################################################################### ## tst_qbytearraymatcher Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qbytearraymatcher LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qbytearraymatcher SOURCES tst_qbytearraymatcher.cpp diff --git a/tests/auto/corelib/text/qbytearraymatcher/tst_qbytearraymatcher.cpp b/tests/auto/corelib/text/qbytearraymatcher/tst_qbytearraymatcher.cpp index a01b097576..cb2ede7db6 100644 --- a/tests/auto/corelib/text/qbytearraymatcher/tst_qbytearraymatcher.cpp +++ b/tests/auto/corelib/text/qbytearraymatcher/tst_qbytearraymatcher.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2016 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> @@ -9,9 +9,7 @@ #include <numeric> #include <string> -#if QT_CONFIG(cxx11_future) -# include <thread> -#endif +#include <thread> // COM interface #if defined(Q_OS_WIN) && defined(interface) @@ -91,12 +89,12 @@ void tst_QByteArrayMatcher::interface() QCOMPARE(matcher5.indexIn(haystack), 42); QCOMPARE(matcher6.indexIn(haystack), 42); - QCOMPARE(matcher1.indexIn(haystack.constData(), haystack.length()), 42); + QCOMPARE(matcher1.indexIn(haystack.constData(), haystack.size()), 42); QCOMPARE(matcher1.indexIn(haystack, 43), 84); - QCOMPARE(matcher1.indexIn(haystack.constData(), haystack.length(), 43), 84); + QCOMPARE(matcher1.indexIn(haystack.constData(), haystack.size(), 43), 84); QCOMPARE(matcher1.indexIn(haystack, 85), -1); - QCOMPARE(matcher1.indexIn(haystack.constData(), haystack.length(), 85), -1); + QCOMPARE(matcher1.indexIn(haystack.constData(), haystack.size(), 85), -1); QByteArrayMatcher matcher7(QByteArray("123")); QCOMPARE(matcher7.indexIn(haystack), 6); @@ -253,14 +251,7 @@ void tst_QByteArrayMatcher::haystacksWithMoreThan4GiBWork() QCOMPARE(large.size(), BaseSize + needle.size()); qDebug("created dataset in %lld ms", timer.elapsed()); -# if QT_CONFIG(cxx11_future) using MaybeThread = std::thread; -# else - struct MaybeThread { - std::function<void()> func; - void join() { func(); } - }; -# endif // // WHEN: trying to match an occurrence past the 4GiB mark |