Branch: Tag:

2017-12-04

2017-12-04 14:13:30 by Stephen R. van den Berg <srb@cuci.nl>

Concurrent: Add convenience variant to zip() and extend testsuite.

167:   dnl - transform_with()      dnl - zip() + init_promise() + test_do([[ add_constant("p11", Concurrent.Promise()); ]]) + test_do([[ add_constant("p12", Concurrent.Promise()); ]]) + test_do([[ add_constant("p13", Concurrent.Promise()); ]]) + test_do([[ p12->success(12); ]]) + test_do([[ promise->success(14); ]]) + test_do([[ add_constant("future", +  promise->future()->zip(p11, p12, p13)); ]]) + init_future() + test_do([[ p13->success(13); ]]) + test_do([[ p11->success(11); ]]) + test_do([[ add_constant("p11"); ]]) + test_do([[ add_constant("p12"); ]]) + test_do([[ add_constant("p13"); ]]) + exit_promise(1, ({14, 11, 12, 13}))      dnl - Promise.depend() - true   init_promise()
188:   test_do([[ add_constant("p13"); ]])   exit_promise(1, ({11, 12, 13, 13, 11, 12, 14, 15}))    + dnl - Promise.depend() no backend - true + init_promise() + test_do([[ Concurrent.use_backend(0); ]]); + test_do([[ add_constant("p11", Concurrent.Promise()); ]]) + test_do([[ add_constant("p12", Concurrent.Promise()); ]]) + test_do([[ add_constant("p13", Concurrent.Promise()); ]]) + test_do([[ add_constant("future", +  promise->depend(({p11->future(),p12->future()})) +  ->depend(({}))->depend(p13->future()) +  ->depend(({p13->future(),p11->future(),p12->future()}))); ]]) + test_do([[ promise->depend()->success(14); ]]) + test_do([[ p13->success(13); ]]) + test_do([[ promise->depend()->success(15); ]]) + init_future() + test_do([[ p11->success(11); ]]) + test_do([[ p12->success(12); ]]) + test_do([[ add_constant("p11"); ]]) + test_do([[ add_constant("p12"); ]]) + test_do([[ add_constant("p13"); ]]) + exit_promise(1, ({11, 12, 13, 13, 11, 12, 14, 15})) + test_do([[ Concurrent.use_backend(1); ]]); +    dnl - Promise.depend() - false   init_promise()   test_do([[ add_constant("p11", Concurrent.Promise()); ]])
208:   test_do([[ add_constant("p13"); ]])   exit_promise(-1, 13)    + dnl - Promise.depend() no backend - false + init_promise() + test_do([[ Concurrent.use_backend(0); ]]); + test_do([[ add_constant("p11", Concurrent.Promise()); ]]) + test_do([[ add_constant("p12", Concurrent.Promise()); ]]) + test_do([[ add_constant("p13", Concurrent.Promise()); ]]) + test_do([[ add_constant("future", +  promise->depend(({p11->future(),p12->future()})) +  ->depend(({}))->depend(p13->future()) +  ->depend(({p13->future(),p11->future(),p12->future()}))); ]]) + test_do([[ promise->depend()->success(14); ]]) + test_do([[ p11->success(11); ]]) + test_do([[ promise->depend()->success(15); ]]) + init_future() + test_do([[ p13->failure(13); ]]) + test_do([[ p12->failure(12); ]]) + test_do([[ add_constant("p11"); ]]) + test_do([[ add_constant("p12"); ]]) + test_do([[ add_constant("p13"); ]]) + exit_promise(-1, 13) + test_do([[ Concurrent.use_backend(1); ]]); +    dnl - Promise.fold() - true   init_promise()   test_do([[ add_constant("p11", Concurrent.Promise()); ]])
253:   exit_promise(-1, 11)      dnl - Concurrent.first_completed() + init_promise() + test_do([[ add_constant("p11", Concurrent.Promise()); ]]) + test_do([[ add_constant("p12", Concurrent.Promise()); ]]) + test_do([[ add_constant("p13", Concurrent.Promise()); ]]) + test_do([[ add_constant("future", +  Concurrent.first_completed(({p11, promise, p12, p13}) +  ->future())); ]]) + init_future() + test_do([[ p12->success(12); ]]) + test_do([[ p13->success(13); ]]) + test_do([[ promise->success(14); ]]) + test_do([[ p11->success(11); ]]) + test_do([[ add_constant("p11"); ]]) + test_do([[ add_constant("p12"); ]]) + test_do([[ add_constant("p13"); ]]) + exit_promise(1, 12)      dnl - Concurrent.results() -  + init_promise() + test_do([[ add_constant("p11", Concurrent.Promise()); ]]) + test_do([[ add_constant("p12", Concurrent.Promise()); ]]) + test_do([[ add_constant("p13", Concurrent.Promise()); ]]) + test_do([[ add_constant("future", +  Concurrent.results(({p11, promise, p12, p13}) +  ->future())); ]]) + init_future() + test_do([[ p12->success(12); ]]) + test_do([[ p13->success(13); ]]) + test_do([[ promise->success(14); ]]) + test_do([[ p11->success(11); ]]) + test_do([[ add_constant("p11"); ]]) + test_do([[ add_constant("p12"); ]]) + test_do([[ add_constant("p13"); ]]) + exit_promise(1, ({11, 14, 12, 13}))      dnl - Concurrent.traverse() -  + init_promise() + test_do([[ add_constant("p11", Concurrent.Promise()); ]]) + test_do([[ add_constant("p12", Concurrent.Promise()); ]]) + test_do([[ add_constant("p13", Concurrent.Promise()); ]]) + test_do([[ add_constant("future", +  Concurrent.traverse(({p11, promise, p12, p13}) +  ->future(), lambda(int val) { return val+val;})); ]]) + init_future() + test_do([[ p12->success(12); ]]) + test_do([[ p13->success(13); ]]) + test_do([[ promise->success(14); ]]) + test_do([[ p11->success(11); ]]) + test_do([[ add_constant("p11"); ]]) + test_do([[ add_constant("p12"); ]]) + test_do([[ add_constant("p13"); ]]) + exit_promise(1, ({11+11, 14+14, 12+12, 13+13}))      dnl - Concurrent.fold() -  + init_promise() + test_do([[ add_constant("p11", Concurrent.Promise()); ]]) + test_do([[ add_constant("p12", Concurrent.Promise()); ]]) + test_do([[ add_constant("p13", Concurrent.Promise()); ]]) + test_do([[ add_constant("future", +  Concurrent.fold(({p11, promise, p12, p13}) +  ->future(), 10, lambda(int val, int acc) { return val+acc;})); ]]) + init_future() + test_do([[ p12->success(12); ]]) + test_do([[ p13->success(13); ]]) + test_do([[ promise->success(14); ]]) + test_do([[ p11->success(11); ]]) + test_do([[ add_constant("p11"); ]]) + test_do([[ add_constant("p12"); ]]) + test_do([[ add_constant("p13"); ]]) + exit_promise(1, 10+11+14+12+13)      test_do([[ add_constant("future"); ]])   test_do([[ add_constant("promise"); ]])