From c30e9145049c52feb2de719307ebbfee0650f01b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Vr=C3=A1til?= Date: Thu, 11 Dec 2014 15:55:18 +0100 Subject: 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. --- async/autotests/asynctest.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'async/autotests') 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() void AsyncTest::testSyncEach() { - /* auto job = Async::start>( - []() -> Async::Future> { - Async::Future> future(QList{ 1, 2, 3, 4 }); + [](Async::Future> &future) { + future.setValue(QList{ 1, 2, 3, 4 }); future.setFinished(); - return future; }) .each, int>( [](const int &v, Async::Future> &future) { - setFinished(); + future.setValue(QList{ v + 1 }); + future.setFinished(); }); - */ + + job.exec(); + Async::Future> future = job.result(); + const QList expected({ 2, 3, 4, 5 }); + QCOMPARE(future.value(), expected); } -- cgit v1.2.3