summaryrefslogtreecommitdiffstats
path: root/tests/auto/concurrent
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2020-06-22 15:07:48 +0200
committerJarek Kobus <jaroslaw.kobus@qt.io>2020-06-22 16:46:01 +0200
commit95a5cd71b626b24556116f8539bf79bcf8baf4cd (patch)
treee8dad245be4cf9d49e943041e5e08b3505e66107 /tests/auto/concurrent
parentb0792f391d9937cabb6f42109310b2c7ffaf8b78 (diff)
Use QList instead of QVector in concurrent tests
Task-number: QTBUG-84469 Change-Id: Ia8113ef044a918e46176bfa3f4b34781dc69dd03 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'tests/auto/concurrent')
-rw-r--r--tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp8
-rw-r--r--tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp23
-rw-r--r--tests/auto/concurrent/qtconcurrenttask/tst_qtconcurrenttask.cpp12
3 files changed, 22 insertions, 21 deletions
diff --git a/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp b/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp
index ac8aec4dcd..945f286c9d 100644
--- a/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp
+++ b/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp
@@ -356,8 +356,8 @@ void tst_QtConcurrentFilter::filteredReduced()
const int intSum = 6; // sum of even values
const Number numberSum = 6; // sum of even values
- void (QVector<int>::*pushBackInt)(const int &) = &QVector<int>::push_back;
- void (QVector<Number>::*pushBackNumber)(const Number &) = &QVector<Number>::push_back;
+ void (QList<int>::*pushBackInt)(const int &) = &QList<int>::push_back;
+ void (QList<Number>::*pushBackNumber)(const Number &) = &QList<Number>::push_back;
auto lambdaIsEven = [](const int &x) {
return (x & 1) == 0;
@@ -612,8 +612,8 @@ void tst_QtConcurrentFilter::filteredReducedInitialValue()
const int intSum = 16; // sum of even values and initial value
const Number numberSum = 16; // sum of even values and initial value
- void (QVector<int>::*pushBackInt)(const int &) = &QVector<int>::push_back;
- void (QVector<Number>::*pushBackNumber)(const Number &) = &QVector<Number>::push_back;
+ void (QList<int>::*pushBackInt)(const int &) = &QList<int>::push_back;
+ void (QList<Number>::*pushBackNumber)(const Number &) = &QList<Number>::push_back;
auto lambdaIsEven = [](const int &x) {
return (x & 1) == 0;
diff --git a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
index fefa7676ab..39af0acd06 100644
--- a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
+++ b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
@@ -609,7 +609,7 @@ void tst_QtConcurrentMap::mappedReduced()
const int sum = 6;
const int sumOfSquares = 14;
- void (QVector<int>::*push_back)(const int &) = &QVector<int>::push_back;
+ void (QList<int>::*push_back)(const int &) = &QList<int>::push_back;
auto lambdaSquare = [](int x) {
return x * x;
@@ -857,7 +857,7 @@ void tst_QtConcurrentMap::mappedReducedInitialValue()
const int sumOfSquares = 24;
const int intInitial = 10;
- void (QVector<int>::*push_back)(const int &) = &QVector<int>::push_back;
+ void (QList<int>::*push_back)(const int &) = &QList<int>::push_back;
auto lambdaSquare = [](int x) {
return x * x;
@@ -1161,7 +1161,7 @@ public:
}
};
-Q_DECLARE_METATYPE(QVector<MemFnTester>);
+Q_DECLARE_METATYPE(QList<MemFnTester>);
void tst_QtConcurrentMap::functionOverloads()
{
@@ -1175,10 +1175,10 @@ void tst_QtConcurrentMap::functionOverloads()
QtConcurrent::mapped(classList, &MemFnTester::fnConst);
QtConcurrent::mapped(constMemFnTesterList, &MemFnTester::fnConst);
- QtConcurrent::blockingMapped<QVector<int> >(intList, fnConst);
- QtConcurrent::blockingMapped<QVector<int> >(constIntList, fnConst);
- QtConcurrent::blockingMapped<QVector<MemFnTester> >(classList, &MemFnTester::fnConst);
- QtConcurrent::blockingMapped<QVector<MemFnTester> >(constMemFnTesterList, &MemFnTester::fnConst);
+ QtConcurrent::blockingMapped<QList<int>>(intList, fnConst);
+ QtConcurrent::blockingMapped<QList<int>>(constIntList, fnConst);
+ QtConcurrent::blockingMapped<QList<MemFnTester>>(classList, &MemFnTester::fnConst);
+ QtConcurrent::blockingMapped<QList<MemFnTester>>(constMemFnTesterList, &MemFnTester::fnConst);
QtConcurrent::blockingMapped<QList<QString> >(intList, changeTypeConst);
QtConcurrent::blockingMapped<QList<QString> >(constIntList, changeTypeConst);
@@ -1198,10 +1198,11 @@ void tst_QtConcurrentMap::noExceptFunctionOverloads()
QtConcurrent::mapped(classList, &MemFnTester::fnConstNoExcept);
QtConcurrent::mapped(constMemFnTesterList, &MemFnTester::fnConstNoExcept);
- QtConcurrent::blockingMapped<QVector<int> >(intList, fnConstNoExcept);
- QtConcurrent::blockingMapped<QVector<int> >(constIntList, fnConstNoExcept);
- QtConcurrent::blockingMapped<QVector<MemFnTester> >(classList, &MemFnTester::fnConstNoExcept);
- QtConcurrent::blockingMapped<QVector<MemFnTester> >(constMemFnTesterList, &MemFnTester::fnConstNoExcept);
+ QtConcurrent::blockingMapped<QList<int>>(intList, fnConstNoExcept);
+ QtConcurrent::blockingMapped<QList<int>>(constIntList, fnConstNoExcept);
+ QtConcurrent::blockingMapped<QList<MemFnTester>>(classList, &MemFnTester::fnConstNoExcept);
+ QtConcurrent::blockingMapped<QList<MemFnTester>>(constMemFnTesterList,
+ &MemFnTester::fnConstNoExcept);
QtConcurrent::blockingMapped<QList<QString> >(intList, changeTypeConstNoExcept);
QtConcurrent::blockingMapped<QList<QString> >(constIntList, changeTypeConstNoExcept);
diff --git a/tests/auto/concurrent/qtconcurrenttask/tst_qtconcurrenttask.cpp b/tests/auto/concurrent/qtconcurrenttask/tst_qtconcurrenttask.cpp
index b8a82dfa14..f4e6f99660 100644
--- a/tests/auto/concurrent/qtconcurrenttask/tst_qtconcurrenttask.cpp
+++ b/tests/auto/concurrent/qtconcurrenttask/tst_qtconcurrenttask.cpp
@@ -107,18 +107,18 @@ void tst_QtConcurrentTask::setPriority()
QSemaphore sem;
- QVector<QFuture<void>> futureResults;
+ QList<QFuture<void>> futureResults;
futureResults << task([&]{ sem.acquire(); })
.onThreadPool(pool)
.spawn();
const int tasksCount = 10;
- QVector<int> priorities(tasksCount);
+ QList<int> priorities(tasksCount);
std::iota(priorities.begin(), priorities.end(), 1);
auto seed = std::chrono::system_clock::now().time_since_epoch().count();
std::shuffle(priorities.begin(), priorities.end(), std::default_random_engine(seed));
- QVector<int> actual;
+ QList<int> actual;
for (int priority : priorities)
futureResults << task([priority, &actual] { actual << priority; })
.onThreadPool(pool)
@@ -131,7 +131,7 @@ void tst_QtConcurrentTask::setPriority()
for (const auto &f : futureResults)
QVERIFY(f.isFinished());
- QVector<int> expected(priorities);
+ QList<int> expected(priorities);
std::sort(expected.begin(), expected.end(), std::greater<>());
QCOMPARE(actual, expected);
@@ -144,7 +144,7 @@ void tst_QtConcurrentTask::adjustAllSettings()
const int priority = 10;
- QVector<int> result;
+ QList<int> result;
auto append = [&](auto &&...args){ (result << ... << args); };
task(std::move(append))
@@ -154,7 +154,7 @@ void tst_QtConcurrentTask::adjustAllSettings()
.spawn()
.waitForFinished();
- QCOMPARE(result, QVector<int>({1, 2, 3}));
+ QCOMPARE(result, QList<int>({ 1, 2, 3 }));
}
void tst_QtConcurrentTask::ignoreFutureResult()
{