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

Function use_future_3_test

test/use_future.cpp:249–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

247}
248
249void use_future_3_test()
250{
251 using boost::asio::use_future;
252 using namespace archetypes;
253
254 std::future<std::tuple<int, double, char>> f;
255
256 f = async_op_3(use_future);
257 try
258 {
259 int i;
260 double d;
261 char c;
262 std::tie(i, d, c) = f.get();
263 BOOST_ASIO_CHECK(i == 42);
264 BOOST_ASIO_CHECK(d == 2.0);
265 BOOST_ASIO_CHECK(c == 'a');
266 }
267 catch (...)
268 {
269 BOOST_ASIO_CHECK(false);
270 }
271
272 f = async_op_ec_3(true, use_future);
273 try
274 {
275 int i;
276 double d;
277 char c;
278 std::tie(i, d, c) = f.get();
279 BOOST_ASIO_CHECK(i == 42);
280 BOOST_ASIO_CHECK(d == 2.0);
281 BOOST_ASIO_CHECK(c == 'a');
282 }
283 catch (...)
284 {
285 BOOST_ASIO_CHECK(false);
286 }
287
288 f = async_op_ec_3(false, use_future);
289 try
290 {
291 std::tuple<int, double, char> t = f.get();
292 BOOST_ASIO_CHECK(false);
293 (void)t;
294 }
295 catch (boost::system::system_error& e)
296 {
297 BOOST_ASIO_CHECK(e.code() == boost::asio::error::operation_aborted);
298 }
299 catch (...)
300 {
301 BOOST_ASIO_CHECK(false);
302 }
303
304 f = async_op_ex_3(true, use_future);
305 try
306 {

Callers

nothing calls this directly

Calls 6

async_op_3Function · 0.85
async_op_ec_3Function · 0.85
async_op_ex_3Function · 0.85
stringFunction · 0.85
codeMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected