summaryrefslogtreecommitdiffstats
path: root/tests/auto/concurrent
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2020-10-27 17:06:26 +0100
committerSona Kurazyan <sona.kurazyan@qt.io>2020-11-04 09:40:12 +0100
commit62a741cd2b7dc6ff3f3afd4fa785c5c12da1041a (patch)
tree0db17c6ca8069fe71bfe0866e16d82b66f19a142 /tests/auto/concurrent
parentb26fa9722f9e8c81406259f6db8044e8bbc2d50b (diff)
Improve QtConcurrent::blockingMapped tests
QtConcurrent::blockingMapped was not able to determine the result type in case of passing containers that have more than one template argument. This should be fixed by the parrent commit. Also fixed some unrelated compiler warnings. Change-Id: I96618dc955c5e4c3792f28f6436d6851745dc01d Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'tests/auto/concurrent')
-rw-r--r--tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp29
1 files changed, 11 insertions, 18 deletions
diff --git a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
index d1ea999e37..9bc2af9f8c 100644
--- a/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
+++ b/tests/auto/concurrent/qtconcurrentmap/tst_qtconcurrentmap.cpp
@@ -568,8 +568,7 @@ void tst_QtConcurrentMap::mapped()
auto future = QtConcurrent::mapped(std::vector { 1, 2, 3 }, multiplyBy2);
QCOMPARE(future.results(), QList<int>({ 2, 4, 6 }));
- auto result = QtConcurrent::blockingMapped<std::vector<int>>(std::vector { 1, 2, 3 },
- multiplyBy2);
+ auto result = QtConcurrent::blockingMapped(std::vector { 1, 2, 3 }, multiplyBy2);
QCOMPARE(result, std::vector<int>({ 2, 4, 6 }));
}
@@ -1798,15 +1797,15 @@ void tst_QtConcurrentMap::stlContainers()
vector.push_back(1);
vector.push_back(2);
- std::vector<int> vector2 = QtConcurrent::blockingMapped<std::vector<int> >(vector, mapper);
- QCOMPARE(vector2.size(), (std::vector<int>::size_type)(2));
+ std::vector<int> vector2 = QtConcurrent::blockingMapped(vector, mapper);
+ QCOMPARE(vector2.size(), 2);
std::list<int> list;
list.push_back(1);
list.push_back(2);
- std::list<int> list2 = QtConcurrent::blockingMapped<std::list<int> >(list, mapper);
- QCOMPARE(list2.size(), (std::vector<int>::size_type)(2));
+ std::list<int> list2 = QtConcurrent::blockingMapped(list, mapper);
+ QCOMPARE(list2.size(), 2);
QtConcurrent::mapped(list, mapper).waitForFinished();
@@ -1819,23 +1818,17 @@ void tst_QtConcurrentMap::stlContainersLambda()
vector.push_back(1);
vector.push_back(2);
- std::vector<int> vector2 = QtConcurrent::blockingMapped<std::vector<int> >(vector,
- [](const int &i) {
- return mapper(i);
- }
- );
- QCOMPARE(vector2.size(), (std::vector<int>::size_type)(2));
+ std::vector<int> vector2 =
+ QtConcurrent::blockingMapped(vector, [](const int &i) { return mapper(i); });
+ QCOMPARE(vector2.size(), 2);
std::list<int> list;
list.push_back(1);
list.push_back(2);
- std::list<int> list2 = QtConcurrent::blockingMapped<std::list<int> >(list,
- [](const int &i) {
- return mapper(i);
- }
- );
- QCOMPARE(list2.size(), (std::vector<int>::size_type)(2));
+ std::list<int> list2 =
+ QtConcurrent::blockingMapped(list, [](const int &i) { return mapper(i); });
+ QCOMPARE(list2.size(), 2);
QtConcurrent::mapped(list, [](const int &i) { return mapper(i); }).waitForFinished();