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

Function any_io_executor_assignment_test

test/any_io_executor.cpp:338–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

336}
337
338void any_io_executor_assignment_test()
339{
340 thread_pool pool(1);
341 boost::asio::nullptr_t null_ptr = boost::asio::nullptr_t();
342
343 boost::asio::any_io_executor ex1;
344
345 boost::asio::any_io_executor ex2;
346 ex2 = null_ptr;
347
348 BOOST_ASIO_CHECK(ex2.target<void>() == 0);
349
350 boost::asio::any_io_executor ex3;
351 ex3 = pool.executor();
352
353 BOOST_ASIO_CHECK(ex3.target<void>() != 0);
354
355 boost::asio::any_io_executor ex4;
356 ex4 = ex1;
357
358 BOOST_ASIO_CHECK(ex4.target<void>() == 0);
359 BOOST_ASIO_CHECK(ex4 == ex1);
360
361 ex4 = ex3;
362
363 BOOST_ASIO_CHECK(ex4.target<void>() != 0);
364 BOOST_ASIO_CHECK(ex4 == ex3);
365
366 boost::asio::any_io_executor ex5;
367 ex5 = fat_executor(1);
368
369 BOOST_ASIO_CHECK(ex5.target<void>() != 0);
370 BOOST_ASIO_CHECK(ex5 != null_ptr);
371 BOOST_ASIO_CHECK(ex5 != ex1);
372
373 boost::asio::any_io_executor ex6;
374 ex6 = fat_executor(1);
375
376 BOOST_ASIO_CHECK(ex6.target<void>() != 0);
377 BOOST_ASIO_CHECK(ex6 != null_ptr);
378 BOOST_ASIO_CHECK(ex6 != ex1);
379 BOOST_ASIO_CHECK(ex6 == ex5);
380
381 ex6 = fat_executor(2);
382
383 BOOST_ASIO_CHECK(ex6.target<void>() != 0);
384 BOOST_ASIO_CHECK(ex6 != null_ptr);
385 BOOST_ASIO_CHECK(ex6 != ex1);
386 BOOST_ASIO_CHECK(ex6 != ex5);
387
388 boost::asio::any_io_executor ex7;
389 ex7 = ex5;
390
391 BOOST_ASIO_CHECK(ex7.target<void>() != 0);
392 BOOST_ASIO_CHECK(ex7 != null_ptr);
393 BOOST_ASIO_CHECK(ex7 != ex1);
394 BOOST_ASIO_CHECK(ex7 == ex5);
395 BOOST_ASIO_CHECK(ex7 != ex6);

Callers

nothing calls this directly

Calls 2

fat_executorClass · 0.70
executorMethod · 0.45

Tested by

no test coverage detected