MCPcopy Create free account
hub / github.com/Geode-solutions/OpenGeode / test_when_all

Function test_when_all

tests/basic/test-assert.cpp:32–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30#include <geode/tests/common.hpp>
31
32void test_when_all()
33{
34 try
35 {
36 std::vector< async::task< void > > tasks;
37 for( const auto t : geode::Range{ 10 } )
38 {
39 geode_unused( t );
40 tasks.emplace_back( async::spawn( [] {
41 throw std::runtime_error( "Some list error" );
42 } ) );
43 }
44 for( auto& task : async::when_all( tasks ).get() )
45 {
46 task.get();
47 }
48 exit( 1 );
49 }
50 catch( ... )
51 {
52 geode::geode_lippincott();
53 }
54
55 try
56 {
57 std::vector< async::task< int > > tasks;
58 for( const auto t : geode::Range{ 10 } )
59 {
60 geode_unused( t );
61 tasks.emplace_back( async::spawn( [] {
62 throw std::runtime_error( "Some list error 2" );
63 return 42;
64 } ) );
65 }
66 async::when_all( tasks )
67 .then( []( std::vector< async::task< int > > all_tasks ) {
68 for( auto& task : all_tasks )
69 {
70 DEBUG( "toto" );
71 task.get();
72 }
73 } )
74 .get();
75 exit( 1 );
76 }
77 catch( ... )
78 {
79 geode::geode_lippincott();
80 }
81}
82
83void test_parallel()
84{

Callers 1

testFunction · 0.85

Calls 3

geode_unusedFunction · 0.85
geode_lippincottFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected