diff options
author | Andreas Buhr <andreas.buhr@qt.io> | 2020-10-09 00:02:00 +0200 |
---|---|---|
committer | Andreas Buhr <andreas.buhr@qt.io> | 2020-11-09 16:01:33 +0100 |
commit | 223e409efbf29f7c06bec7a403403c9689f42b3e (patch) | |
tree | 005c43d0ac9d33a74af85e5e3e9c0277b19dadd9 /tests/auto/concurrent/qtconcurrentfilter | |
parent | 3553f8119b5cd8c04c7208c519bb08245a44720e (diff) |
Automatically generate unit tests for QtConcurrent
There are many different ways to to call map and filter functions
in QtConcurrent. This patch adds a python script to generate
all possible combinations.
Change-Id: I61ed1758601e219c5852e8cc939c5feebb23d2f6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'tests/auto/concurrent/qtconcurrentfilter')
-rw-r--r-- | tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp b/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp index 242f95fd92..a0114d57b2 100644 --- a/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp +++ b/tests/auto/concurrent/qtconcurrentfilter/tst_qtconcurrentfilter.cpp @@ -265,13 +265,13 @@ void tst_QtConcurrentFilter::filtered() { // move only types sequences - auto future = QtConcurrent::filtered(MoveOnlyVector({ 1, 2, 3, 4 }), keepEvenIntegers); + auto future = QtConcurrent::filtered(MoveOnlyVector<int>({ 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); + MoveOnlyVector<int>({ 1, 2, 3, 4 }), keepEvenIntegers); QCOMPARE(result, std::vector<int>({ 2, 4 })); #endif } @@ -341,15 +341,15 @@ void tst_QtConcurrentFilter::filteredThreadPool() { // move-only sequences - auto future = QtConcurrent::filtered( - &pool, MoveOnlyVector({ 1, 2, 3, 4 }), keepEvenIntegers); + auto future = QtConcurrent::filtered(&pool, MoveOnlyVector<int>({ 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); + &pool, MoveOnlyVector<int>({ 1, 2, 3, 4 }), keepEvenIntegers); QCOMPARE(result, std::vector<int>({ 2, 4 })); #endif } @@ -550,11 +550,11 @@ void tst_QtConcurrentFilter::filteredReduced() { // move only sequences - auto future = QtConcurrent::filteredReduced(MoveOnlyVector({ 1, 2, 3, 4 }), + auto future = QtConcurrent::filteredReduced(MoveOnlyVector<int>({ 1, 2, 3, 4 }), keepEvenIntegers, intSumReduce); QCOMPARE(future.result(), intSum); - auto result = QtConcurrent::blockingFilteredReduced(MoveOnlyVector({ 1, 2, 3, 4 }), + auto result = QtConcurrent::blockingFilteredReduced(MoveOnlyVector<int>({ 1, 2, 3, 4 }), keepEvenIntegers, intSumReduce); QCOMPARE(result, intSum); } @@ -649,12 +649,12 @@ void tst_QtConcurrentFilter::filteredReducedThreadPool() { // move only sequences - auto future = QtConcurrent::filteredReduced(&pool, MoveOnlyVector({ 1, 2, 3, 4 }), + auto future = QtConcurrent::filteredReduced(&pool, MoveOnlyVector<int>({ 1, 2, 3, 4 }), keepOddIntegers, intSumReduce); QCOMPARE(future.result(), intSum); - auto result = QtConcurrent::blockingFilteredReduced(&pool, MoveOnlyVector({ 1, 2, 3, 4 }), - keepOddIntegers, intSumReduce); + auto result = QtConcurrent::blockingFilteredReduced( + &pool, MoveOnlyVector<int>({ 1, 2, 3, 4 }), keepOddIntegers, intSumReduce); QCOMPARE(result, intSum); } } @@ -923,12 +923,12 @@ void tst_QtConcurrentFilter::filteredReducedInitialValue() { // move only sequences - auto future = QtConcurrent::filteredReduced(MoveOnlyVector({ 1, 2, 3, 4 }), + auto future = QtConcurrent::filteredReduced(MoveOnlyVector<int>({ 1, 2, 3, 4 }), keepEvenIntegers, intSumReduce, intInitial); QCOMPARE(future.result(), intSum); auto result = QtConcurrent::blockingFilteredReduced( - MoveOnlyVector({ 1, 2, 3, 4 }), keepEvenIntegers, intSumReduce, intInitial); + MoveOnlyVector<int>({ 1, 2, 3, 4 }), keepEvenIntegers, intSumReduce, intInitial); QCOMPARE(result, intSum); } } @@ -1034,12 +1034,13 @@ void tst_QtConcurrentFilter::filteredReducedInitialValueThreadPool() { // move only sequences - auto future = QtConcurrent::filteredReduced(&pool, MoveOnlyVector({ 1, 2, 3, 4 }), + auto future = QtConcurrent::filteredReduced(&pool, MoveOnlyVector<int>({ 1, 2, 3, 4 }), keepOddIntegers, intSumReduce, intInitial); QCOMPARE(future.result(), intSum); - auto result = QtConcurrent::blockingFilteredReduced( - &pool, MoveOnlyVector({ 1, 2, 3, 4 }), keepOddIntegers, intSumReduce, intInitial); + auto result = + QtConcurrent::blockingFilteredReduced(&pool, MoveOnlyVector<int>({ 1, 2, 3, 4 }), + keepOddIntegers, intSumReduce, intInitial); QCOMPARE(result, intSum); } } |