summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2020-10-08 12:12:07 +0200
committerSona Kurazyan <sona.kurazyan@qt.io>2020-10-12 13:51:45 +0200
commit4a981b9bdb6d512ac077ecdeaf478fc9a5792d17 (patch)
tree80d3734dd8774d516373d036229a8811bf088036
parent3d040267f436e4f28819e1b5f362a1a908dceea5 (diff)
Enable some-of the QtConcurrent test cases
QtConcurrent::filtered test-cases for move-only containers were failing to compile, because it is assumed that the passed container should have value_type defined. Change-Id: I3e9e5ebc07704cb98a15b125ae8bd5b5a84d497a Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
-rw-r--r--tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp15
-rw-r--r--tests/auto/concurrent/qtconcurrentmap/functions.h2
2 files changed, 9 insertions, 8 deletions
diff --git a/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp b/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp
index c7ab64c14c..53b1b0fb55 100644
--- a/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp
+++ b/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp
@@ -231,19 +231,18 @@ void tst_QtConcurrentFilter::filtered()
QCOMPARE(result, std::vector<int>({ 2, 4 }));
}
-#if 0
- // does not work yet
{
// move only types sequences
- auto future = QtConcurrent::filtered(
- MoveOnlyVector({ 1, 2, 3, 4 }), keepEvenIntegers);
+ auto future = QtConcurrent::filtered(MoveOnlyVector({ 1, 2, 3, 4 }), keepEvenIntegers);
QCOMPARE(future.results(), QList<int>({ 2, 4 }));
+#if 0
+ // does not work yet
auto result = QtConcurrent::blockingFiltered(
MoveOnlyVector({ 1, 2, 3, 4 }), keepEvenIntegers);
QCOMPARE(result, std::vector<int>({ 2, 4 }));
- }
#endif
+ }
}
template <typename SourceObject,
@@ -308,20 +307,20 @@ void tst_QtConcurrentFilter::filteredThreadPool()
QCOMPARE(result, std::vector<int>({ 2, 4 }));
}
-#if 0
- // does not work yet
{
// move-only sequences
auto future = QtConcurrent::filtered(
&pool, MoveOnlyVector({ 1, 2, 3, 4 }), keepEvenIntegers);
QCOMPARE(future.results(), QList<int>({ 2, 4 }));
+#if 0
+ // does not work yet
auto result =
QtConcurrent::blockingFiltered(
&pool, MoveOnlyVector({ 1, 2, 3, 4 }), keepEvenIntegers);
QCOMPARE(result, std::vector<int>({ 2, 4 }));
- }
#endif
+ }
}
template <typename SourceObject,
diff --git a/tests/auto/concurrent/qtconcurrentmap/functions.h b/tests/auto/concurrent/qtconcurrentmap/functions.h
index 7c30c256cb..e5090ef03e 100644
--- a/tests/auto/concurrent/qtconcurrentmap/functions.h
+++ b/tests/auto/concurrent/qtconcurrentmap/functions.h
@@ -138,6 +138,8 @@ public:
class MoveOnlyVector
{
public:
+ using value_type = int;
+
// rule of six
MoveOnlyVector() = default;
~MoveOnlyVector() = default;