diff options
author | Dan Vrátil <dvratil@redhat.com> | 2014-12-11 15:55:18 +0100 |
---|---|---|
committer | Dan Vrátil <dvratil@redhat.com> | 2014-12-11 15:55:18 +0100 |
commit | c30e9145049c52feb2de719307ebbfee0650f01b (patch) | |
tree | 6896823401fb174c0f396ec30eae6257d32f8a41 /async/autotests/asynctest.cpp | |
parent | 1aee1bda9fc81c888ad18fea107c271133dd5442 (diff) | |
download | sink-c30e9145049c52feb2de719307ebbfee0650f01b.tar.gz sink-c30e9145049c52feb2de719307ebbfee0650f01b.zip |
Async: move the actual task exection into Executor implementation
As of now, Job is only front interface to a chain of Executor subclasses. Each
Executor subclass specializes for given type of execution (then, each, reduce, ...),
and the chain is then executed recursively, as we did with the original Job
implementation.
Diffstat (limited to 'async/autotests/asynctest.cpp')
-rw-r--r-- | async/autotests/asynctest.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/async/autotests/asynctest.cpp b/async/autotests/asynctest.cpp index 19e40f7..403fb83 100644 --- a/async/autotests/asynctest.cpp +++ b/async/autotests/asynctest.cpp | |||
@@ -91,18 +91,21 @@ void AsyncTest::testAsyncPromises() | |||
91 | 91 | ||
92 | void AsyncTest::testSyncEach() | 92 | void AsyncTest::testSyncEach() |
93 | { | 93 | { |
94 | /* | ||
95 | auto job = Async::start<QList<int>>( | 94 | auto job = Async::start<QList<int>>( |
96 | []() -> Async::Future<QList<int>> { | 95 | [](Async::Future<QList<int>> &future) { |
97 | Async::Future<QList<int>> future(QList<int>{ 1, 2, 3, 4 }); | 96 | future.setValue(QList<int>{ 1, 2, 3, 4 }); |
98 | future.setFinished(); | 97 | future.setFinished(); |
99 | return future; | ||
100 | }) | 98 | }) |
101 | .each<QList<int>, int>( | 99 | .each<QList<int>, int>( |
102 | [](const int &v, Async::Future<QList<int>> &future) { | 100 | [](const int &v, Async::Future<QList<int>> &future) { |
103 | setFinished(); | 101 | future.setValue(QList<int>{ v + 1 }); |
102 | future.setFinished(); | ||
104 | }); | 103 | }); |
105 | */ | 104 | |
105 | job.exec(); | ||
106 | Async::Future<QList<int>> future = job.result(); | ||
107 | const QList<int> expected({ 2, 3, 4, 5 }); | ||
108 | QCOMPARE(future.value(), expected); | ||
106 | } | 109 | } |
107 | 110 | ||
108 | 111 | ||