diff options
Diffstat (limited to 'tests/benchmarks/corelib/thread/qfuture/tst_bench_qfuture.cpp')
-rw-r--r-- | tests/benchmarks/corelib/thread/qfuture/tst_bench_qfuture.cpp | 48 |
1 files changed, 12 insertions, 36 deletions
diff --git a/tests/benchmarks/corelib/thread/qfuture/tst_bench_qfuture.cpp b/tests/benchmarks/corelib/thread/qfuture/tst_bench_qfuture.cpp index 17c2f20712..38b3f636c9 100644 --- a/tests/benchmarks/corelib/thread/qfuture/tst_bench_qfuture.cpp +++ b/tests/benchmarks/corelib/thread/qfuture/tst_bench_qfuture.cpp @@ -1,35 +1,11 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> #include <qexception.h> #include <qfuture.h> +#include <qpromise.h> #include <qsemaphore.h> class tst_QFuture : public QObject @@ -37,7 +13,7 @@ class tst_QFuture : public QObject Q_OBJECT private slots: - void makeReadyfuture(); + void makeReadyValueFuture(); #ifndef QT_NO_EXCEPTIONS void makeExceptionalFuture(); #endif @@ -67,10 +43,10 @@ private slots: void progressText(); }; -void tst_QFuture::makeReadyfuture() +void tst_QFuture::makeReadyValueFuture() { QBENCHMARK { - auto future = QtFuture::makeReadyFuture(42); + auto future = QtFuture::makeReadyValueFuture(42); Q_UNUSED(future); } } @@ -88,7 +64,7 @@ void tst_QFuture::makeExceptionalFuture() void tst_QFuture::result() { - auto future = QtFuture::makeReadyFuture(42); + auto future = QtFuture::makeReadyValueFuture(42); QBENCHMARK { auto value = future.result(); @@ -116,7 +92,7 @@ void tst_QFuture::results() void tst_QFuture::takeResult() { QBENCHMARK { - auto future = QtFuture::makeReadyFuture(42); + auto future = QtFuture::makeReadyValueFuture(42); auto value = future.takeResult(); Q_UNUSED(value); } @@ -164,7 +140,7 @@ void tst_QFuture::reportException() void tst_QFuture::then() { - auto f = QtFuture::makeReadyFuture(42); + auto f = QtFuture::makeReadyValueFuture(42); QBENCHMARK { auto future = f.then([](int value) { return value; }); Q_UNUSED(future); @@ -173,7 +149,7 @@ void tst_QFuture::then() void tst_QFuture::thenVoid() { - auto f = QtFuture::makeReadyFuture(); + auto f = QtFuture::makeReadyVoidFuture(); QBENCHMARK { auto future = f.then([] {}); Q_UNUSED(future); @@ -229,7 +205,7 @@ void tst_QFuture::onFailedVoid() void tst_QFuture::thenOnFailed() { - auto f = QtFuture::makeReadyFuture(42); + auto f = QtFuture::makeReadyValueFuture(42); QBENCHMARK { auto future = f.then([](int) { throw std::runtime_error("error"); }).onFailed([] { return 0; }); @@ -239,7 +215,7 @@ void tst_QFuture::thenOnFailed() void tst_QFuture::thenOnFailedVoid() { - auto f = QtFuture::makeReadyFuture(); + auto f = QtFuture::makeReadyVoidFuture(); QBENCHMARK { auto future = f.then([] { throw std::runtime_error("error"); }).onFailed([] {}); Q_UNUSED(future); |