| 21 | #include "unit_test.hpp" |
| 22 | |
| 23 | void config_from_string_test() |
| 24 | { |
| 25 | boost::asio::io_context ctx1( |
| 26 | boost::asio::config_from_string( |
| 27 | "scheduler.concurrency_hint=123\n" |
| 28 | " scheduler.locking = 1 \n" |
| 29 | "# comment\n" |
| 30 | "garbage\n" |
| 31 | "reactor.registration_locking= 0 # comment\n" |
| 32 | "reactor.io_locking=1")); |
| 33 | |
| 34 | boost::asio::config cfg1(ctx1); |
| 35 | BOOST_ASIO_CHECK(cfg1.get("scheduler", "concurrency_hint", 0) == 123); |
| 36 | BOOST_ASIO_CHECK(cfg1.get("scheduler", "locking", false) == true); |
| 37 | BOOST_ASIO_CHECK(cfg1.get("reactor", "registration_locking", true) == false); |
| 38 | BOOST_ASIO_CHECK(cfg1.get("reactor", "io_locking", false) == true); |
| 39 | |
| 40 | boost::asio::io_context ctx2( |
| 41 | boost::asio::config_from_string( |
| 42 | "prefix.scheduler.concurrency_hint=456\n" |
| 43 | " prefix.scheduler.locking = 1 \n" |
| 44 | "# comment\n" |
| 45 | "garbage\n" |
| 46 | "prefix.reactor.registration_locking= 0 # comment\n" |
| 47 | "prefix.reactor.io_locking=1", |
| 48 | "prefix")); |
| 49 | |
| 50 | boost::asio::config cfg2(ctx2); |
| 51 | BOOST_ASIO_CHECK(cfg2.get("scheduler", "concurrency_hint", 0) == 456); |
| 52 | BOOST_ASIO_CHECK(cfg2.get("scheduler", "locking", false) == true); |
| 53 | BOOST_ASIO_CHECK(cfg2.get("reactor", "registration_locking", true) == false); |
| 54 | BOOST_ASIO_CHECK(cfg2.get("reactor", "io_locking", false) == true); |
| 55 | } |
| 56 | |
| 57 | void config_from_concurrency_hint_test() |
| 58 | { |
nothing calls this directly
no test coverage detected