| 451 | } |
| 452 | |
| 453 | void prefer_only_executor_execute_test() |
| 454 | { |
| 455 | typedef execution::any_executor< |
| 456 | execution::blocking_t, |
| 457 | execution::prefer_only<execution::blocking_t::possibly_t>, |
| 458 | execution::prefer_only<execution::blocking_t::never_t> |
| 459 | > executor_type; |
| 460 | |
| 461 | executor_type ex1 = possibly_blocking_executor(); |
| 462 | |
| 463 | ex1.execute(&do_nothing); |
| 464 | BOOST_ASIO_CHECK(possibly_blocking_count == 1); |
| 465 | BOOST_ASIO_CHECK(never_blocking_count == 0); |
| 466 | |
| 467 | executor_type ex2 = boost::asio::prefer(ex1, execution::blocking.possibly); |
| 468 | |
| 469 | ex2.execute(&do_nothing); |
| 470 | BOOST_ASIO_CHECK(possibly_blocking_count == 2); |
| 471 | BOOST_ASIO_CHECK(never_blocking_count == 0); |
| 472 | |
| 473 | executor_type ex3 = boost::asio::prefer(ex1, execution::blocking.never); |
| 474 | |
| 475 | ex3.execute(&do_nothing); |
| 476 | BOOST_ASIO_CHECK(possibly_blocking_count == 3); |
| 477 | BOOST_ASIO_CHECK(never_blocking_count == 0); |
| 478 | |
| 479 | executor_type ex4 = never_blocking_executor(); |
| 480 | |
| 481 | ex4.execute(&do_nothing); |
| 482 | BOOST_ASIO_CHECK(possibly_blocking_count == 3); |
| 483 | BOOST_ASIO_CHECK(never_blocking_count == 1); |
| 484 | |
| 485 | executor_type ex5 = boost::asio::prefer(ex4, execution::blocking.possibly); |
| 486 | |
| 487 | ex5.execute(&do_nothing); |
| 488 | BOOST_ASIO_CHECK(possibly_blocking_count == 3); |
| 489 | BOOST_ASIO_CHECK(never_blocking_count == 2); |
| 490 | |
| 491 | executor_type ex6 = boost::asio::prefer(ex4, execution::blocking.never); |
| 492 | |
| 493 | ex6.execute(&do_nothing); |
| 494 | BOOST_ASIO_CHECK(possibly_blocking_count == 3); |
| 495 | BOOST_ASIO_CHECK(never_blocking_count == 3); |
| 496 | |
| 497 | executor_type ex7 = either_blocking_executor(execution::blocking.possibly); |
| 498 | |
| 499 | ex7.execute(&do_nothing); |
| 500 | BOOST_ASIO_CHECK(possibly_blocking_count == 4); |
| 501 | BOOST_ASIO_CHECK(never_blocking_count == 3); |
| 502 | |
| 503 | executor_type ex8 = boost::asio::prefer(ex7, execution::blocking.possibly); |
| 504 | |
| 505 | ex8.execute(&do_nothing); |
| 506 | BOOST_ASIO_CHECK(possibly_blocking_count == 5); |
| 507 | BOOST_ASIO_CHECK(never_blocking_count == 3); |
| 508 | |
| 509 | executor_type ex9 = boost::asio::prefer(ex7, execution::blocking.never); |
| 510 |
nothing calls this directly
no test coverage detected