MCPcopy Create free account
hub / github.com/boostorg/asio / run_task_test

Function run_task_test

test/experimental/coro/simple_test.cpp:133–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133void run_task_test()
134{
135 boost::asio::io_context ctx;
136
137 bool tt1 = false;
138 bool tt2 = false;
139 bool tt3 = false;
140 bool tt4 = false;
141 auto tt = task_test(ctx);
142 tt.async_resume(
143 [&](std::exception_ptr pt, int i)
144 {
145 tt1 = true;
146 BOOST_ASIO_CHECK(!pt);
147 BOOST_ASIO_CHECK(i == 42);
148 tt.async_resume(
149 [&](std::exception_ptr pt, int)
150 {
151 tt2 = true;
152 BOOST_ASIO_CHECK(pt);
153 });
154 });
155
156 auto tt_2 = task_throw(ctx);
157
158 tt_2.async_resume(
159 [&](std::exception_ptr pt, int)
160 {
161 tt3 = true;
162 BOOST_ASIO_CHECK(pt);
163 tt.async_resume(
164 [&](std::exception_ptr pt, int)
165 {
166 tt4 = true;
167 BOOST_ASIO_CHECK(pt);
168 });
169 });
170
171 ctx.run();
172
173 BOOST_ASIO_CHECK(tt1);
174 BOOST_ASIO_CHECK(tt2);
175 BOOST_ASIO_CHECK(tt3);
176 BOOST_ASIO_CHECK(tt4);
177}
178
179boost::asio::experimental::coro<char> completion_generator_test_impl(
180 boost::asio::any_io_executor, int limit)

Callers

nothing calls this directly

Calls 4

task_testFunction · 0.85
task_throwFunction · 0.85
async_resumeMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected