repo_name
stringclasses
10 values
file_path
stringlengths
29
222
content
stringlengths
24
926k
extention
stringclasses
5 values
asio
data/projects/asio/test/basic_deadline_timer.cpp
// // basic_deadline_timer.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/basic_deadline_timer.hpp> #include "unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "basic_deadline_timer", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/basic_seq_packet_socket.cpp
// // basic_seq_packet_socket.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/basic_seq_packet_socket.hpp> #include "unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "basic_seq_packet_socket", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/io_context_strand.cpp
// // io_context_strand.cpp // ~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/io_context_strand.hpp> #include <functional> #include <sstream> #include <boost/asio/io_context.hpp> #include <boost/asio/dispatch.hpp> #include <boost/asio/post.hpp> #include <boost/asio/detail/thread.hpp> #include "unit_test.hpp" #if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) # include <boost/asio/deadline_timer.hpp> #else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) # include <boost/asio/steady_timer.hpp> #endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) using namespace boost::asio; namespace bindns = std; #if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) typedef deadline_timer timer; namespace chronons = boost::posix_time; #else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) typedef steady_timer timer; namespace chronons = boost::asio::chrono; #endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) void increment(int* count) { ++(*count); } void increment_without_lock(io_context::strand* s, int* count) { BOOST_ASIO_CHECK(!s->running_in_this_thread()); int original_count = *count; dispatch(*s, bindns::bind(increment, count)); // No other functions are currently executing through the locking dispatcher, // so the previous call to dispatch should have successfully nested. BOOST_ASIO_CHECK(*count == original_count + 1); } void increment_with_lock(io_context::strand* s, int* count) { BOOST_ASIO_CHECK(s->running_in_this_thread()); int original_count = *count; dispatch(*s, bindns::bind(increment, count)); // The current function already holds the strand's lock, so the // previous call to dispatch should have successfully nested. BOOST_ASIO_CHECK(*count == original_count + 1); } void sleep_increment(io_context* ioc, int* count) { timer t(*ioc, chronons::seconds(2)); t.wait(); ++(*count); } void increment_by_a(int* count, int a) { (*count) += a; } void increment_by_a_b(int* count, int a, int b) { (*count) += a + b; } void increment_by_a_b_c(int* count, int a, int b, int c) { (*count) += a + b + c; } void increment_by_a_b_c_d(int* count, int a, int b, int c, int d) { (*count) += a + b + c + d; } void start_sleep_increments(io_context* ioc, io_context::strand* s, int* count) { // Give all threads a chance to start. timer t(*ioc, chronons::seconds(2)); t.wait(); // Start three increments. post(*s, bindns::bind(sleep_increment, ioc, count)); post(*s, bindns::bind(sleep_increment, ioc, count)); post(*s, bindns::bind(sleep_increment, ioc, count)); } void throw_exception() { throw 1; } void io_context_run(io_context* ioc) { ioc->run(); } void strand_test() { io_context ioc; io_context::strand s(ioc); int count = 0; post(ioc, bindns::bind(increment_without_lock, &s, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(count == 1); count = 0; ioc.restart(); post(s, bindns::bind(increment_with_lock, &s, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(count == 1); count = 0; ioc.restart(); post(ioc, bindns::bind(start_sleep_increments, &ioc, &s, &count)); boost::asio::detail::thread thread1(bindns::bind(io_context_run, &ioc)); boost::asio::detail::thread thread2(bindns::bind(io_context_run, &ioc)); // Check all events run one after another even though there are two threads. timer timer1(ioc, chronons::seconds(3)); timer1.wait(); BOOST_ASIO_CHECK(count == 0); #if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) timer1.expires_at(timer1.expires_at() + chronons::seconds(2)); #else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) timer1.expires_at(timer1.expiry() + chronons::seconds(2)); #endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) timer1.wait(); BOOST_ASIO_CHECK(count == 1); #if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) timer1.expires_at(timer1.expires_at() + chronons::seconds(2)); #else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) timer1.expires_at(timer1.expiry() + chronons::seconds(2)); #endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) timer1.wait(); BOOST_ASIO_CHECK(count == 2); thread1.join(); thread2.join(); // The run() calls will not return until all work has finished. BOOST_ASIO_CHECK(count == 3); count = 0; int exception_count = 0; ioc.restart(); post(s, throw_exception); post(s, bindns::bind(increment, &count)); post(s, bindns::bind(increment, &count)); post(s, throw_exception); post(s, bindns::bind(increment, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(count == 0); BOOST_ASIO_CHECK(exception_count == 0); for (;;) { try { ioc.run(); break; } catch (int) { ++exception_count; } } // The run() calls will not return until all work has finished. BOOST_ASIO_CHECK(count == 3); BOOST_ASIO_CHECK(exception_count == 2); count = 0; ioc.restart(); // Check for clean shutdown when handlers posted through an orphaned strand // are abandoned. { io_context::strand s2(ioc); post(s2, bindns::bind(increment, &count)); post(s2, bindns::bind(increment, &count)); post(s2, bindns::bind(increment, &count)); } // No handlers can be called until run() is called. BOOST_ASIO_CHECK(count == 0); } void strand_wrap_test() { #if !defined(BOOST_ASIO_NO_DEPRECATED) io_context ioc; io_context::strand s(ioc); int count = 0; s.wrap(bindns::bind(increment, &count))(); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(count == 0); ioc.restart(); ioc.run(); // The run() calls will not return until all work has finished. BOOST_ASIO_CHECK(count == 1); count = 0; s.wrap(increment)(&count); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(count == 0); ioc.restart(); ioc.run(); // The run() calls will not return until all work has finished. BOOST_ASIO_CHECK(count == 1); count = 0; s.wrap(increment_by_a)(&count, 1); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(count == 0); ioc.restart(); ioc.run(); // The run() calls will not return until all work has finished. BOOST_ASIO_CHECK(count == 1); count = 0; s.wrap(increment_by_a_b)(&count, 1, 2); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(count == 0); ioc.restart(); ioc.run(); // The run() calls will not return until all work has finished. BOOST_ASIO_CHECK(count == 3); count = 0; s.wrap(increment_by_a_b_c)(&count, 1, 2, 3); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(count == 0); ioc.restart(); ioc.run(); // The run() calls will not return until all work has finished. BOOST_ASIO_CHECK(count == 6); count = 0; s.wrap(increment_by_a_b_c_d)(&count, 1, 2, 3, 4); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(count == 0); ioc.restart(); ioc.run(); // The run() calls will not return until all work has finished. BOOST_ASIO_CHECK(count == 10); #endif // !defined(BOOST_ASIO_NO_DEPRECATED) } BOOST_ASIO_TEST_SUITE ( "strand", BOOST_ASIO_TEST_CASE(strand_test) BOOST_ASIO_TEST_CASE(strand_wrap_test) )
cpp
asio
data/projects/asio/test/io_context.cpp
// // io_context.cpp // ~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/io_context.hpp> #include <functional> #include <sstream> #include <boost/asio/bind_executor.hpp> #include <boost/asio/dispatch.hpp> #include <boost/asio/post.hpp> #include <boost/asio/detail/thread.hpp> #include "unit_test.hpp" #if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) # include <boost/asio/deadline_timer.hpp> #else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) # include <boost/asio/steady_timer.hpp> #endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) using namespace boost::asio; namespace bindns = std; #if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) typedef deadline_timer timer; namespace chronons = boost::posix_time; #else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) typedef steady_timer timer; namespace chronons = boost::asio::chrono; #endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) void increment(int* count) { ++(*count); } void decrement_to_zero(io_context* ioc, int* count) { if (*count > 0) { --(*count); int before_value = *count; boost::asio::post(*ioc, bindns::bind(decrement_to_zero, ioc, count)); // Handler execution cannot nest, so count value should remain unchanged. BOOST_ASIO_CHECK(*count == before_value); } } void nested_decrement_to_zero(io_context* ioc, int* count) { if (*count > 0) { --(*count); boost::asio::dispatch(*ioc, bindns::bind(nested_decrement_to_zero, ioc, count)); // Handler execution is nested, so count value should now be zero. BOOST_ASIO_CHECK(*count == 0); } } void sleep_increment(io_context* ioc, int* count) { timer t(*ioc, chronons::seconds(2)); t.wait(); if (++(*count) < 3) boost::asio::post(*ioc, bindns::bind(sleep_increment, ioc, count)); } void start_sleep_increments(io_context* ioc, int* count) { // Give all threads a chance to start. timer t(*ioc, chronons::seconds(2)); t.wait(); // Start the first of three increments. boost::asio::post(*ioc, bindns::bind(sleep_increment, ioc, count)); } void throw_exception() { throw 1; } void io_context_run(io_context* ioc) { ioc->run(); } void io_context_test() { io_context ioc; int count = 0; boost::asio::post(ioc, bindns::bind(increment, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 1); count = 0; ioc.restart(); boost::asio::post(ioc, bindns::bind(increment, &count)); boost::asio::post(ioc, bindns::bind(increment, &count)); boost::asio::post(ioc, bindns::bind(increment, &count)); boost::asio::post(ioc, bindns::bind(increment, &count)); boost::asio::post(ioc, bindns::bind(increment, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 5); count = 0; ioc.restart(); executor_work_guard<io_context::executor_type> w = make_work_guard(ioc); boost::asio::post(ioc, bindns::bind(&io_context::stop, &ioc)); BOOST_ASIO_CHECK(!ioc.stopped()); ioc.run(); // The only operation executed should have been to stop run(). BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 0); ioc.restart(); boost::asio::post(ioc, bindns::bind(increment, &count)); w.reset(); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 1); count = 10; ioc.restart(); boost::asio::post(ioc, bindns::bind(decrement_to_zero, &ioc, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 10); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 0); count = 10; ioc.restart(); boost::asio::post(ioc, bindns::bind(nested_decrement_to_zero, &ioc, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 10); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 0); count = 10; ioc.restart(); boost::asio::dispatch(ioc, bindns::bind(nested_decrement_to_zero, &ioc, &count)); // No handlers can be called until run() is called, even though nested // delivery was specifically allowed in the previous call. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 10); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 0); count = 0; int count2 = 0; ioc.restart(); BOOST_ASIO_CHECK(!ioc.stopped()); boost::asio::post(ioc, bindns::bind(start_sleep_increments, &ioc, &count)); boost::asio::post(ioc, bindns::bind(start_sleep_increments, &ioc, &count2)); boost::asio::detail::thread thread1(bindns::bind(io_context_run, &ioc)); boost::asio::detail::thread thread2(bindns::bind(io_context_run, &ioc)); thread1.join(); thread2.join(); // The run() calls will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 3); BOOST_ASIO_CHECK(count2 == 3); count = 10; io_context ioc2; boost::asio::dispatch(ioc, boost::asio::bind_executor(ioc2, bindns::bind(decrement_to_zero, &ioc2, &count))); ioc.restart(); BOOST_ASIO_CHECK(!ioc.stopped()); ioc.run(); // No decrement_to_zero handlers can be called until run() is called on the // second io_context object. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 10); ioc2.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(count == 0); count = 0; int exception_count = 0; ioc.restart(); boost::asio::post(ioc, &throw_exception); boost::asio::post(ioc, bindns::bind(increment, &count)); boost::asio::post(ioc, bindns::bind(increment, &count)); boost::asio::post(ioc, &throw_exception); boost::asio::post(ioc, bindns::bind(increment, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 0); BOOST_ASIO_CHECK(exception_count == 0); for (;;) { try { ioc.run(); break; } catch (int) { ++exception_count; } } // The run() calls will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 3); BOOST_ASIO_CHECK(exception_count == 2); } class test_service : public boost::asio::io_context::service { public: static boost::asio::io_context::id id; test_service(boost::asio::io_context& s) : boost::asio::io_context::service(s) {} private: virtual void shutdown_service() {} }; boost::asio::io_context::id test_service::id; void io_context_service_test() { boost::asio::io_context ioc1; boost::asio::io_context ioc2; boost::asio::io_context ioc3; // Implicit service registration. boost::asio::use_service<test_service>(ioc1); BOOST_ASIO_CHECK(boost::asio::has_service<test_service>(ioc1)); test_service* svc1 = new test_service(ioc1); try { boost::asio::add_service(ioc1, svc1); BOOST_ASIO_ERROR("add_service did not throw"); } catch (boost::asio::service_already_exists&) { } delete svc1; // Explicit service registration. test_service* svc2 = new test_service(ioc2); boost::asio::add_service(ioc2, svc2); BOOST_ASIO_CHECK(boost::asio::has_service<test_service>(ioc2)); BOOST_ASIO_CHECK(&boost::asio::use_service<test_service>(ioc2) == svc2); test_service* svc3 = new test_service(ioc2); try { boost::asio::add_service(ioc2, svc3); BOOST_ASIO_ERROR("add_service did not throw"); } catch (boost::asio::service_already_exists&) { } delete svc3; // Explicit registration with invalid owner. test_service* svc4 = new test_service(ioc2); try { boost::asio::add_service(ioc3, svc4); BOOST_ASIO_ERROR("add_service did not throw"); } catch (boost::asio::invalid_service_owner&) { } delete svc4; BOOST_ASIO_CHECK(!boost::asio::has_service<test_service>(ioc3)); } void io_context_executor_query_test() { io_context ioc; BOOST_ASIO_CHECK( &boost::asio::query(ioc.get_executor(), boost::asio::execution::context) == &ioc); BOOST_ASIO_CHECK( boost::asio::query(ioc.get_executor(), boost::asio::execution::blocking) == boost::asio::execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ioc.get_executor(), boost::asio::execution::blocking.possibly) == boost::asio::execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ioc.get_executor(), boost::asio::execution::outstanding_work) == boost::asio::execution::outstanding_work.untracked); BOOST_ASIO_CHECK( boost::asio::query(ioc.get_executor(), boost::asio::execution::outstanding_work.untracked) == boost::asio::execution::outstanding_work.untracked); BOOST_ASIO_CHECK( boost::asio::query(ioc.get_executor(), boost::asio::execution::relationship) == boost::asio::execution::relationship.fork); BOOST_ASIO_CHECK( boost::asio::query(ioc.get_executor(), boost::asio::execution::relationship.fork) == boost::asio::execution::relationship.fork); BOOST_ASIO_CHECK( boost::asio::query(ioc.get_executor(), boost::asio::execution::mapping) == boost::asio::execution::mapping.thread); BOOST_ASIO_CHECK( boost::asio::query(ioc.get_executor(), boost::asio::execution::allocator) == std::allocator<void>()); } void io_context_executor_execute_test() { io_context ioc; int count = 0; ioc.get_executor().execute(bindns::bind(increment, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 1); count = 0; ioc.restart(); boost::asio::require(ioc.get_executor(), boost::asio::execution::blocking.possibly ).execute(bindns::bind(increment, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 1); count = 0; ioc.restart(); boost::asio::require(ioc.get_executor(), boost::asio::execution::blocking.never ).execute(bindns::bind(increment, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 1); count = 0; ioc.restart(); BOOST_ASIO_CHECK(!ioc.stopped()); boost::asio::require(ioc.get_executor(), boost::asio::execution::blocking.never, boost::asio::execution::outstanding_work.tracked ).execute(bindns::bind(increment, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 1); count = 0; ioc.restart(); boost::asio::require(ioc.get_executor(), boost::asio::execution::blocking.never, boost::asio::execution::outstanding_work.untracked ).execute(bindns::bind(increment, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 1); count = 0; ioc.restart(); boost::asio::require(ioc.get_executor(), boost::asio::execution::blocking.never, boost::asio::execution::outstanding_work.untracked, boost::asio::execution::relationship.fork ).execute(bindns::bind(increment, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 1); count = 0; ioc.restart(); boost::asio::require(ioc.get_executor(), boost::asio::execution::blocking.never, boost::asio::execution::outstanding_work.untracked, boost::asio::execution::relationship.continuation ).execute(bindns::bind(increment, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 1); count = 0; ioc.restart(); boost::asio::prefer( boost::asio::require(ioc.get_executor(), boost::asio::execution::blocking.never, boost::asio::execution::outstanding_work.untracked, boost::asio::execution::relationship.continuation), boost::asio::execution::allocator(std::allocator<void>()) ).execute(bindns::bind(increment, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 1); count = 0; ioc.restart(); boost::asio::prefer( boost::asio::require(ioc.get_executor(), boost::asio::execution::blocking.never, boost::asio::execution::outstanding_work.untracked, boost::asio::execution::relationship.continuation), boost::asio::execution::allocator ).execute(bindns::bind(increment, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 1); } BOOST_ASIO_TEST_SUITE ( "io_context", BOOST_ASIO_TEST_CASE(io_context_test) BOOST_ASIO_TEST_CASE(io_context_service_test) BOOST_ASIO_TEST_CASE(io_context_executor_query_test) BOOST_ASIO_TEST_CASE(io_context_executor_execute_test) )
cpp
asio
data/projects/asio/test/serial_port.cpp
// // serial_port.cpp // ~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. ([email protected]) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/serial_port.hpp> #include "archetypes/async_result.hpp" #include <boost/asio/io_context.hpp> #include "unit_test.hpp" //------------------------------------------------------------------------------ // serial_port_compile test // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // The following test checks that all public member functions on the class // serial_port compile and link correctly. Runtime failures are ignored. namespace serial_port_compile { struct write_some_handler { write_some_handler() {} void operator()(const boost::system::error_code&, std::size_t) {} write_some_handler(write_some_handler&&) {} private: write_some_handler(const write_some_handler&); }; struct read_some_handler { read_some_handler() {} void operator()(const boost::system::error_code&, std::size_t) {} read_some_handler(read_some_handler&&) {} private: read_some_handler(const read_some_handler&); }; void test() { #if defined(BOOST_ASIO_HAS_SERIAL_PORT) using namespace boost::asio; try { io_context ioc; const io_context::executor_type ioc_ex = ioc.get_executor(); char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; serial_port::baud_rate serial_port_option; archetypes::lazy_handler lazy; boost::system::error_code ec; // basic_serial_port constructors. serial_port port1(ioc); serial_port port2(ioc, "null"); serial_port::native_handle_type native_port1 = port1.native_handle(); #if defined(BOOST_ASIO_MSVC) && (_MSC_VER < 1910) // Skip this on older MSVC due to mysterious ambiguous overload errors. #else serial_port port3(ioc, native_port1); #endif serial_port port4(ioc_ex); serial_port port5(ioc_ex, "null"); serial_port::native_handle_type native_port2 = port1.native_handle(); serial_port port6(ioc_ex, native_port2); serial_port port7(std::move(port6)); basic_serial_port<io_context::executor_type> port8(ioc); serial_port port9(std::move(port8)); // basic_serial_port operators. port1 = serial_port(ioc); port1 = std::move(port2); port1 = std::move(port8); // basic_io_object functions. serial_port::executor_type ex = port1.get_executor(); (void)ex; // basic_serial_port functions. serial_port::lowest_layer_type& lowest_layer = port1.lowest_layer(); (void)lowest_layer; const serial_port& port10 = port1; const serial_port::lowest_layer_type& lowest_layer2 = port10.lowest_layer(); (void)lowest_layer2; port1.open("null"); port1.open("null", ec); serial_port::native_handle_type native_port3 = port1.native_handle(); port1.assign(native_port3); serial_port::native_handle_type native_port4 = port1.native_handle(); port1.assign(native_port4, ec); bool is_open = port1.is_open(); (void)is_open; port1.close(); port1.close(ec); serial_port::native_handle_type native_port5 = port1.native_handle(); (void)native_port5; port1.cancel(); port1.cancel(ec); port1.set_option(serial_port_option); port1.set_option(serial_port_option, ec); port1.get_option(serial_port_option); port1.get_option(serial_port_option, ec); port1.send_break(); port1.send_break(ec); port1.write_some(buffer(mutable_char_buffer)); port1.write_some(buffer(const_char_buffer)); port1.write_some(buffer(mutable_char_buffer), ec); port1.write_some(buffer(const_char_buffer), ec); port1.async_write_some(buffer(mutable_char_buffer), write_some_handler()); port1.async_write_some(buffer(const_char_buffer), write_some_handler()); int i1 = port1.async_write_some(buffer(mutable_char_buffer), lazy); (void)i1; int i2 = port1.async_write_some(buffer(const_char_buffer), lazy); (void)i2; port1.read_some(buffer(mutable_char_buffer)); port1.read_some(buffer(mutable_char_buffer), ec); port1.async_read_some(buffer(mutable_char_buffer), read_some_handler()); int i3 = port1.async_read_some(buffer(mutable_char_buffer), lazy); (void)i3; } catch (std::exception&) { } #endif // defined(BOOST_ASIO_HAS_SERIAL_PORT) } } // namespace serial_port_compile //------------------------------------------------------------------------------ BOOST_ASIO_TEST_SUITE ( "serial_port", BOOST_ASIO_COMPILE_TEST_CASE(serial_port_compile::test) )
cpp
asio
data/projects/asio/test/awaitable.cpp
// // awaitable.cpp // ~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/awaitable.hpp> #include "unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "awaitable", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/strand.cpp
// // strand.cpp // ~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/strand.hpp> #include <functional> #include <sstream> #include <boost/asio/executor.hpp> #include <boost/asio/io_context.hpp> #include <boost/asio/dispatch.hpp> #include <boost/asio/post.hpp> #include <boost/asio/detail/thread.hpp> #include "unit_test.hpp" #if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) # include <boost/asio/deadline_timer.hpp> #else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) # include <boost/asio/steady_timer.hpp> #endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) using namespace boost::asio; namespace bindns = std; #if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) typedef deadline_timer timer; namespace chronons = boost::posix_time; #else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) typedef steady_timer timer; namespace chronons = boost::asio::chrono; #endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) void increment(int* count) { ++(*count); } void increment_without_lock(strand<io_context::executor_type>* s, int* count) { BOOST_ASIO_CHECK(!s->running_in_this_thread()); int original_count = *count; dispatch(*s, bindns::bind(increment, count)); // No other functions are currently executing through the locking dispatcher, // so the previous call to dispatch should have successfully nested. BOOST_ASIO_CHECK(*count == original_count + 1); } void increment_with_lock(strand<io_context::executor_type>* s, int* count) { BOOST_ASIO_CHECK(s->running_in_this_thread()); int original_count = *count; dispatch(*s, bindns::bind(increment, count)); // The current function already holds the strand's lock, so the // previous call to dispatch should have successfully nested. BOOST_ASIO_CHECK(*count == original_count + 1); } void sleep_increment(io_context* ioc, int* count) { timer t(*ioc, chronons::seconds(2)); t.wait(); ++(*count); } void increment_by_a(int* count, int a) { (*count) += a; } void increment_by_a_b(int* count, int a, int b) { (*count) += a + b; } void increment_by_a_b_c(int* count, int a, int b, int c) { (*count) += a + b + c; } void increment_by_a_b_c_d(int* count, int a, int b, int c, int d) { (*count) += a + b + c + d; } void start_sleep_increments(io_context* ioc, strand<io_context::executor_type>* s, int* count) { // Give all threads a chance to start. timer t(*ioc, chronons::seconds(2)); t.wait(); // Start three increments. post(*s, bindns::bind(sleep_increment, ioc, count)); post(*s, bindns::bind(sleep_increment, ioc, count)); post(*s, bindns::bind(sleep_increment, ioc, count)); } void throw_exception() { throw 1; } void io_context_run(io_context* ioc) { ioc->run(); } void strand_test() { io_context ioc; strand<io_context::executor_type> s = make_strand(ioc); int count = 0; post(ioc, bindns::bind(increment_without_lock, &s, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(count == 1); count = 0; ioc.restart(); post(s, bindns::bind(increment_with_lock, &s, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(count == 1); count = 0; ioc.restart(); post(ioc, bindns::bind(start_sleep_increments, &ioc, &s, &count)); boost::asio::detail::thread thread1(bindns::bind(io_context_run, &ioc)); boost::asio::detail::thread thread2(bindns::bind(io_context_run, &ioc)); // Check all events run one after another even though there are two threads. timer timer1(ioc, chronons::seconds(3)); timer1.wait(); BOOST_ASIO_CHECK(count == 0); #if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) timer1.expires_at(timer1.expires_at() + chronons::seconds(2)); #else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) timer1.expires_at(timer1.expiry() + chronons::seconds(2)); #endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) timer1.wait(); BOOST_ASIO_CHECK(count == 1); #if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) timer1.expires_at(timer1.expires_at() + chronons::seconds(2)); #else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) timer1.expires_at(timer1.expiry() + chronons::seconds(2)); #endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) timer1.wait(); BOOST_ASIO_CHECK(count == 2); thread1.join(); thread2.join(); // The run() calls will not return until all work has finished. BOOST_ASIO_CHECK(count == 3); count = 0; int exception_count = 0; ioc.restart(); post(s, throw_exception); post(s, bindns::bind(increment, &count)); post(s, bindns::bind(increment, &count)); post(s, throw_exception); post(s, bindns::bind(increment, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(count == 0); BOOST_ASIO_CHECK(exception_count == 0); for (;;) { try { ioc.run(); break; } catch (int) { ++exception_count; } } // The run() calls will not return until all work has finished. BOOST_ASIO_CHECK(count == 3); BOOST_ASIO_CHECK(exception_count == 2); count = 0; ioc.restart(); // Check for clean shutdown when handlers posted through an orphaned strand // are abandoned. { strand<io_context::executor_type> s2 = make_strand(ioc.get_executor()); post(s2, bindns::bind(increment, &count)); post(s2, bindns::bind(increment, &count)); post(s2, bindns::bind(increment, &count)); } // No handlers can be called until run() is called. BOOST_ASIO_CHECK(count == 0); } void strand_conversion_test() { io_context ioc; strand<io_context::executor_type> s1 = make_strand(ioc); // Converting constructors. strand<executor> s2(s1); strand<executor> s3 = strand<io_context::executor_type>(s1); // Converting assignment. s3 = s1; s3 = strand<io_context::executor_type>(s1); } void strand_query_test() { io_context ioc; strand<io_context::executor_type> s1 = make_strand(ioc); BOOST_ASIO_CHECK( &boost::asio::query(s1, boost::asio::execution::context) == &ioc); BOOST_ASIO_CHECK( boost::asio::query(s1, boost::asio::execution::blocking) == boost::asio::execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(s1, boost::asio::execution::blocking.possibly) == boost::asio::execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(s1, boost::asio::execution::outstanding_work) == boost::asio::execution::outstanding_work.untracked); BOOST_ASIO_CHECK( boost::asio::query(s1, boost::asio::execution::outstanding_work.untracked) == boost::asio::execution::outstanding_work.untracked); BOOST_ASIO_CHECK( boost::asio::query(s1, boost::asio::execution::relationship) == boost::asio::execution::relationship.fork); BOOST_ASIO_CHECK( boost::asio::query(s1, boost::asio::execution::relationship.fork) == boost::asio::execution::relationship.fork); BOOST_ASIO_CHECK( boost::asio::query(s1, boost::asio::execution::mapping) == boost::asio::execution::mapping.thread); BOOST_ASIO_CHECK( boost::asio::query(s1, boost::asio::execution::allocator) == std::allocator<void>()); } void strand_execute_test() { io_context ioc; strand<io_context::executor_type> s1 = make_strand(ioc); int count = 0; s1.execute(bindns::bind(increment, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 1); count = 0; ioc.restart(); boost::asio::require(s1, boost::asio::execution::blocking.possibly).execute( bindns::bind(increment, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 1); count = 0; ioc.restart(); boost::asio::require(s1, boost::asio::execution::blocking.never).execute( bindns::bind(increment, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 1); count = 0; ioc.restart(); BOOST_ASIO_CHECK(!ioc.stopped()); boost::asio::require(s1, boost::asio::execution::blocking.never, boost::asio::execution::outstanding_work.tracked ).execute(bindns::bind(increment, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 1); count = 0; ioc.restart(); boost::asio::require(s1, boost::asio::execution::blocking.never, boost::asio::execution::outstanding_work.untracked ).execute(bindns::bind(increment, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 1); count = 0; ioc.restart(); boost::asio::require(s1, boost::asio::execution::blocking.never, boost::asio::execution::outstanding_work.untracked, boost::asio::execution::relationship.fork ).execute(bindns::bind(increment, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 1); count = 0; ioc.restart(); boost::asio::require(s1, boost::asio::execution::blocking.never, boost::asio::execution::outstanding_work.untracked, boost::asio::execution::relationship.continuation ).execute(bindns::bind(increment, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 1); count = 0; ioc.restart(); boost::asio::prefer( boost::asio::require(s1, boost::asio::execution::blocking.never, boost::asio::execution::outstanding_work.untracked, boost::asio::execution::relationship.continuation), boost::asio::execution::allocator(std::allocator<void>()) ).execute(bindns::bind(increment, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 1); count = 0; ioc.restart(); boost::asio::prefer( boost::asio::require(s1, boost::asio::execution::blocking.never, boost::asio::execution::outstanding_work.untracked, boost::asio::execution::relationship.continuation), boost::asio::execution::allocator ).execute(bindns::bind(increment, &count)); // No handlers can be called until run() is called. BOOST_ASIO_CHECK(!ioc.stopped()); BOOST_ASIO_CHECK(count == 0); ioc.run(); // The run() call will not return until all work has finished. BOOST_ASIO_CHECK(ioc.stopped()); BOOST_ASIO_CHECK(count == 1); } BOOST_ASIO_TEST_SUITE ( "strand", BOOST_ASIO_TEST_CASE(strand_test) BOOST_ASIO_COMPILE_TEST_CASE(strand_conversion_test) BOOST_ASIO_TEST_CASE(strand_query_test) BOOST_ASIO_TEST_CASE(strand_execute_test) )
cpp
asio
data/projects/asio/test/write.cpp
// // write.cpp // ~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/write.hpp> #include <array> #include <cstring> #include <functional> #include <vector> #include "archetypes/async_result.hpp" #include <boost/asio/io_context.hpp> #include <boost/asio/post.hpp> #include <boost/asio/streambuf.hpp> #include "unit_test.hpp" #if defined(BOOST_ASIO_HAS_BOOST_ARRAY) #include <boost/array.hpp> #endif // defined(BOOST_ASIO_HAS_BOOST_ARRAY) using namespace std; // For memcmp, memcpy and memset. class test_stream { public: typedef boost::asio::io_context::executor_type executor_type; test_stream(boost::asio::io_context& io_context) : io_context_(io_context), length_(max_length), position_(0), next_write_length_(max_length) { memset(data_, 0, max_length); } executor_type get_executor() noexcept { return io_context_.get_executor(); } void reset(size_t length = max_length) { BOOST_ASIO_CHECK(length <= max_length); memset(data_, 0, max_length); length_ = length; position_ = 0; next_write_length_ = length; } void next_write_length(size_t length) { next_write_length_ = length; } template <typename Iterator> bool check_buffers(Iterator begin, Iterator end, size_t length) { if (length != position_) return false; Iterator iter = begin; size_t checked_length = 0; for (; iter != end && checked_length < length; ++iter) { size_t buffer_length = boost::asio::buffer_size(*iter); if (buffer_length > length - checked_length) buffer_length = length - checked_length; if (memcmp(data_ + checked_length, iter->data(), buffer_length) != 0) return false; checked_length += buffer_length; } return true; } template <typename Const_Buffers> bool check_buffers(const Const_Buffers& buffers, size_t length) { return check_buffers(boost::asio::buffer_sequence_begin(buffers), boost::asio::buffer_sequence_end(buffers), length); } template <typename Const_Buffers> size_t write_some(const Const_Buffers& buffers) { size_t n = boost::asio::buffer_copy( boost::asio::buffer(data_, length_) + position_, buffers, next_write_length_); position_ += n; return n; } template <typename Const_Buffers> size_t write_some(const Const_Buffers& buffers, boost::system::error_code& ec) { ec = boost::system::error_code(); return write_some(buffers); } template <typename Const_Buffers, typename Handler> void async_write_some(const Const_Buffers& buffers, Handler&& handler) { size_t bytes_transferred = write_some(buffers); boost::asio::post(get_executor(), boost::asio::detail::bind_handler( static_cast<Handler&&>(handler), boost::system::error_code(), bytes_transferred)); } private: boost::asio::io_context& io_context_; enum { max_length = 8192 }; char data_[max_length]; size_t length_; size_t position_; size_t next_write_length_; }; static const char write_data[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; static char mutable_write_data[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; void test_2_arg_zero_buffers_write() { boost::asio::io_context ioc; test_stream s(ioc); std::vector<boost::asio::const_buffer> buffers; size_t bytes_transferred = boost::asio::write(s, buffers); BOOST_ASIO_CHECK(bytes_transferred == 0); } void test_2_arg_const_buffer_write() { boost::asio::io_context ioc; test_stream s(ioc); boost::asio::const_buffer buffers = boost::asio::buffer(write_data, sizeof(write_data)); s.reset(); size_t bytes_transferred = boost::asio::write(s, buffers); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); } void test_2_arg_mutable_buffer_write() { boost::asio::io_context ioc; test_stream s(ioc); boost::asio::mutable_buffer buffers = boost::asio::buffer(mutable_write_data, sizeof(mutable_write_data)); s.reset(); size_t bytes_transferred = boost::asio::write(s, buffers); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); } void test_2_arg_vector_buffers_write() { boost::asio::io_context ioc; test_stream s(ioc); std::vector<boost::asio::const_buffer> buffers; buffers.push_back(boost::asio::buffer(write_data, 32)); buffers.push_back(boost::asio::buffer(write_data, 39) + 32); buffers.push_back(boost::asio::buffer(write_data) + 39); s.reset(); size_t bytes_transferred = boost::asio::write(s, buffers); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); } void test_2_arg_dynamic_string_write() { boost::asio::io_context ioc; test_stream s(ioc); std::string data; boost::asio::dynamic_string_buffer<char, std::string::traits_type, std::string::allocator_type> sb = boost::asio::dynamic_buffer(data, sizeof(write_data)); boost::asio::const_buffer buffers = boost::asio::buffer(write_data, sizeof(write_data)); s.reset(); data.assign(write_data, sizeof(write_data)); size_t bytes_transferred = boost::asio::write(s, sb); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); bytes_transferred = boost::asio::write(s, sb); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); bytes_transferred = boost::asio::write(s, sb); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); } void test_3_arg_nothrow_zero_buffers_write() { boost::asio::io_context ioc; test_stream s(ioc); std::vector<boost::asio::const_buffer> buffers; boost::system::error_code error; size_t bytes_transferred = boost::asio::write(s, buffers, error); BOOST_ASIO_CHECK(bytes_transferred == 0); BOOST_ASIO_CHECK(!error); } void test_3_arg_nothrow_const_buffer_write() { boost::asio::io_context ioc; test_stream s(ioc); boost::asio::const_buffer buffers = boost::asio::buffer(write_data, sizeof(write_data)); s.reset(); boost::system::error_code error; size_t bytes_transferred = boost::asio::write(s, buffers, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); } void test_3_arg_nothrow_mutable_buffer_write() { boost::asio::io_context ioc; test_stream s(ioc); boost::asio::mutable_buffer buffers = boost::asio::buffer(mutable_write_data, sizeof(mutable_write_data)); s.reset(); boost::system::error_code error; size_t bytes_transferred = boost::asio::write(s, buffers, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); BOOST_ASIO_CHECK(!error); } void test_3_arg_nothrow_vector_buffers_write() { boost::asio::io_context ioc; test_stream s(ioc); std::vector<boost::asio::const_buffer> buffers; buffers.push_back(boost::asio::buffer(write_data, 32)); buffers.push_back(boost::asio::buffer(write_data, 39) + 32); buffers.push_back(boost::asio::buffer(write_data) + 39); s.reset(); boost::system::error_code error; size_t bytes_transferred = boost::asio::write(s, buffers, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); } void test_3_arg_nothrow_dynamic_string_write() { boost::asio::io_context ioc; test_stream s(ioc); std::string data; boost::asio::dynamic_string_buffer<char, std::string::traits_type, std::string::allocator_type> sb = boost::asio::dynamic_buffer(data, sizeof(write_data)); boost::asio::const_buffer buffers = boost::asio::buffer(write_data, sizeof(write_data)); s.reset(); data.assign(write_data, sizeof(write_data)); boost::system::error_code error; size_t bytes_transferred = boost::asio::write(s, sb, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); bytes_transferred = boost::asio::write(s, sb, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); bytes_transferred = boost::asio::write(s, sb, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); } bool old_style_transfer_all(const boost::system::error_code& ec, size_t /*bytes_transferred*/) { return !!ec; } struct short_transfer { short_transfer() {} short_transfer(short_transfer&&) {} size_t operator()(const boost::system::error_code& ec, size_t /*bytes_transferred*/) { return !!ec ? 0 : 3; } }; void test_3_arg_const_buffer_write() { boost::asio::io_context ioc; test_stream s(ioc); boost::asio::const_buffer buffers = boost::asio::buffer(write_data, sizeof(write_data)); s.reset(); size_t bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == 50); BOOST_ASIO_CHECK(s.check_buffers(buffers, 50)); s.reset(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); bytes_transferred = boost::asio::write(s, buffers, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); bytes_transferred = boost::asio::write(s, buffers, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); } void test_3_arg_mutable_buffer_write() { boost::asio::io_context ioc; test_stream s(ioc); boost::asio::mutable_buffer buffers = boost::asio::buffer(mutable_write_data, sizeof(mutable_write_data)); s.reset(); size_t bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == 50); BOOST_ASIO_CHECK(s.check_buffers(buffers, 50)); s.reset(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); bytes_transferred = boost::asio::write(s, buffers, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); bytes_transferred = boost::asio::write(s, buffers, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); } void test_3_arg_vector_buffers_write() { boost::asio::io_context ioc; test_stream s(ioc); std::vector<boost::asio::const_buffer> buffers; buffers.push_back(boost::asio::buffer(write_data, 32)); buffers.push_back(boost::asio::buffer(write_data, 39) + 32); buffers.push_back(boost::asio::buffer(write_data) + 39); s.reset(); size_t bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == 50); BOOST_ASIO_CHECK(s.check_buffers(buffers, 50)); s.reset(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); bytes_transferred = boost::asio::write(s, buffers, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); bytes_transferred = boost::asio::write(s, buffers, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); bytes_transferred = boost::asio::write(s, buffers, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(10); bytes_transferred = boost::asio::write(s, buffers, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); } void test_3_arg_dynamic_string_write() { boost::asio::io_context ioc; test_stream s(ioc); std::string data; boost::asio::dynamic_string_buffer<char, std::string::traits_type, std::string::allocator_type> sb = boost::asio::dynamic_buffer(data, sizeof(write_data)); boost::asio::const_buffer buffers = boost::asio::buffer(write_data, sizeof(write_data)); s.reset(); data.assign(write_data, sizeof(write_data)); size_t bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); data.assign(write_data, sizeof(write_data)); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); data.assign(write_data, sizeof(write_data)); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == 50); BOOST_ASIO_CHECK(s.check_buffers(buffers, 50)); s.reset(); data.assign(write_data, sizeof(write_data)); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); data.assign(write_data, sizeof(write_data)); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); data.assign(write_data, sizeof(write_data)); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); data.assign(write_data, sizeof(write_data)); bytes_transferred = boost::asio::write(s, sb, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); bytes_transferred = boost::asio::write(s, sb, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); bytes_transferred = boost::asio::write(s, sb, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); bytes_transferred = boost::asio::write(s, sb, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); bytes_transferred = boost::asio::write(s, sb, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); bytes_transferred = boost::asio::write(s, sb, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); } void test_4_arg_const_buffer_write() { boost::asio::io_context ioc; test_stream s(ioc); boost::asio::const_buffer buffers = boost::asio::buffer(write_data, sizeof(write_data)); s.reset(); boost::system::error_code error; size_t bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == 50); BOOST_ASIO_CHECK(s.check_buffers(buffers, 50)); BOOST_ASIO_CHECK(!error); s.reset(); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(); bytes_transferred = boost::asio::write(s, buffers, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); bytes_transferred = boost::asio::write(s, buffers, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); } void test_4_arg_mutable_buffer_write() { boost::asio::io_context ioc; test_stream s(ioc); boost::asio::mutable_buffer buffers = boost::asio::buffer(mutable_write_data, sizeof(mutable_write_data)); s.reset(); boost::system::error_code error; size_t bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); BOOST_ASIO_CHECK(!error); s.reset(); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == 50); BOOST_ASIO_CHECK(s.check_buffers(buffers, 50)); BOOST_ASIO_CHECK(!error); s.reset(); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(); bytes_transferred = boost::asio::write(s, buffers, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); BOOST_ASIO_CHECK(!error); s.reset(); bytes_transferred = boost::asio::write(s, buffers, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(mutable_write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); BOOST_ASIO_CHECK(!error); } void test_4_arg_vector_buffers_write() { boost::asio::io_context ioc; test_stream s(ioc); std::vector<boost::asio::const_buffer> buffers; buffers.push_back(boost::asio::buffer(write_data, 32)); buffers.push_back(boost::asio::buffer(write_data, 39) + 32); buffers.push_back(boost::asio::buffer(write_data) + 39); s.reset(); boost::system::error_code error; size_t bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == 50); BOOST_ASIO_CHECK(s.check_buffers(buffers, 50)); BOOST_ASIO_CHECK(!error); s.reset(); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(); bytes_transferred = boost::asio::write(s, buffers, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); bytes_transferred = boost::asio::write(s, buffers, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, buffers, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); } void test_4_arg_dynamic_string_write() { boost::asio::io_context ioc; test_stream s(ioc); std::string data; boost::asio::dynamic_string_buffer<char, std::string::traits_type, std::string::allocator_type> sb = boost::asio::dynamic_buffer(data, sizeof(write_data)); boost::asio::const_buffer buffers = boost::asio::buffer(write_data, sizeof(write_data)); s.reset(); data.assign(write_data, sizeof(write_data)); boost::system::error_code error; size_t bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == 50); BOOST_ASIO_CHECK(s.check_buffers(buffers, 50)); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, sb, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); bytes_transferred = boost::asio::write(s, sb, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, sb, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, sb, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); bytes_transferred = boost::asio::write(s, sb, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, sb, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); error = boost::system::error_code(); bytes_transferred = boost::asio::write(s, sb, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(write_data)); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); BOOST_ASIO_CHECK(!error); } void async_write_handler(const boost::system::error_code& e, size_t bytes_transferred, size_t expected_bytes_transferred, bool* called) { *called = true; BOOST_ASIO_CHECK(!e); BOOST_ASIO_CHECK(bytes_transferred == expected_bytes_transferred); } void test_3_arg_const_buffer_async_write() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_stream s(ioc); boost::asio::const_buffer buffers = boost::asio::buffer(write_data, sizeof(write_data)); s.reset(); bool called = false; boost::asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); int i = boost::asio::async_write(s, buffers, archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); } void test_3_arg_mutable_buffer_async_write() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_stream s(ioc); boost::asio::mutable_buffer buffers = boost::asio::buffer(mutable_write_data, sizeof(mutable_write_data)); s.reset(); bool called = false; boost::asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); int i = boost::asio::async_write(s, buffers, archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); } void test_3_arg_boost_array_buffers_async_write() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; #if defined(BOOST_ASIO_HAS_BOOST_ARRAY) boost::asio::io_context ioc; test_stream s(ioc); boost::array<boost::asio::const_buffer, 2> buffers = { { boost::asio::buffer(write_data, 32), boost::asio::buffer(write_data) + 32 } }; s.reset(); bool called = false; boost::asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); int i = boost::asio::async_write(s, buffers, archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); #endif // defined(BOOST_ASIO_HAS_BOOST_ARRAY) } void test_3_arg_std_array_buffers_async_write() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_stream s(ioc); std::array<boost::asio::const_buffer, 2> buffers = { { boost::asio::buffer(write_data, 32), boost::asio::buffer(write_data) + 32 } }; s.reset(); bool called = false; boost::asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); int i = boost::asio::async_write(s, buffers, archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); } void test_3_arg_vector_buffers_async_write() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_stream s(ioc); std::vector<boost::asio::const_buffer> buffers; buffers.push_back(boost::asio::buffer(write_data, 32)); buffers.push_back(boost::asio::buffer(write_data, 39) + 32); buffers.push_back(boost::asio::buffer(write_data) + 39); s.reset(); bool called = false; boost::asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); int i = boost::asio::async_write(s, buffers, archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); } void test_3_arg_dynamic_string_async_write() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_stream s(ioc); std::string data; boost::asio::dynamic_string_buffer<char, std::string::traits_type, std::string::allocator_type> sb = boost::asio::dynamic_buffer(data, sizeof(write_data)); boost::asio::const_buffer buffers = boost::asio::buffer(write_data, sizeof(write_data)); s.reset(); data.assign(write_data, sizeof(write_data)); bool called = false; boost::asio::async_write(s, sb, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); called = false; boost::asio::async_write(s, sb, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); called = false; boost::asio::async_write(s, sb, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); int i = boost::asio::async_write(s, sb, archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); } void test_3_arg_streambuf_async_write() { #if !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_stream s(ioc); boost::asio::streambuf sb; boost::asio::const_buffer buffers = boost::asio::buffer(write_data, sizeof(write_data)); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); bool called = false; boost::asio::async_write(s, sb, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); s.next_write_length(1); called = false; boost::asio::async_write(s, sb, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); s.next_write_length(10); called = false; boost::asio::async_write(s, sb, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); int i = boost::asio::async_write(s, sb, archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); #endif // !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) } void test_4_arg_const_buffer_async_write() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_stream s(ioc); boost::asio::const_buffer buffers = boost::asio::buffer(write_data, sizeof(write_data)); s.reset(); bool called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 50)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); called = false; boost::asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); called = false; boost::asio::async_write(s, buffers, short_transfer(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, short_transfer(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, short_transfer(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); int i = boost::asio::async_write(s, buffers, short_transfer(), archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); } void test_4_arg_mutable_buffer_async_write() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_stream s(ioc); boost::asio::mutable_buffer buffers = boost::asio::buffer(mutable_write_data, sizeof(mutable_write_data)); s.reset(); bool called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 50)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); called = false; boost::asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); called = false; boost::asio::async_write(s, buffers, short_transfer(), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, short_transfer(), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, short_transfer(), bindns::bind(async_write_handler, _1, _2, sizeof(mutable_write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(mutable_write_data))); s.reset(); int i = boost::asio::async_write(s, buffers, short_transfer(), archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); } void test_4_arg_boost_array_buffers_async_write() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; #if defined(BOOST_ASIO_HAS_BOOST_ARRAY) boost::asio::io_context ioc; test_stream s(ioc); boost::array<boost::asio::const_buffer, 2> buffers = { { boost::asio::buffer(write_data, 32), boost::asio::buffer(write_data) + 32 } }; s.reset(); bool called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 50)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); called = false; boost::asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); called = false; boost::asio::async_write(s, buffers, short_transfer(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, short_transfer(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, short_transfer(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); int i = boost::asio::async_write(s, buffers, short_transfer(), archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); #endif // defined(BOOST_ASIO_HAS_BOOST_ARRAY) } void test_4_arg_std_array_buffers_async_write() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_stream s(ioc); std::array<boost::asio::const_buffer, 2> buffers = { { boost::asio::buffer(write_data, 32), boost::asio::buffer(write_data) + 32 } }; s.reset(); bool called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 50)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); called = false; boost::asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); called = false; boost::asio::async_write(s, buffers, short_transfer(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, short_transfer(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, short_transfer(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); int i = boost::asio::async_write(s, buffers, short_transfer(), archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); } void test_4_arg_vector_buffers_async_write() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_stream s(ioc); std::vector<boost::asio::const_buffer> buffers; buffers.push_back(boost::asio::buffer(write_data, 32)); buffers.push_back(boost::asio::buffer(write_data, 39) + 32); buffers.push_back(boost::asio::buffer(write_data) + 39); s.reset(); bool called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 50)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); called = false; boost::asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); called = false; boost::asio::async_write(s, buffers, short_transfer(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(1); called = false; boost::asio::async_write(s, buffers, short_transfer(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); s.next_write_length(10); called = false; boost::asio::async_write(s, buffers, short_transfer(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); int i = boost::asio::async_write(s, buffers, short_transfer(), archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); } void test_4_arg_dynamic_string_async_write() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_stream s(ioc); std::string data; boost::asio::dynamic_string_buffer<char, std::string::traits_type, std::string::allocator_type> sb = boost::asio::dynamic_buffer(data, sizeof(write_data)); boost::asio::const_buffer buffers = boost::asio::buffer(write_data, sizeof(write_data)); s.reset(); data.assign(write_data, sizeof(write_data)); bool called = false; boost::asio::async_write(s, sb, boost::asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); data.assign(write_data, sizeof(write_data)); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); data.assign(write_data, sizeof(write_data)); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 50)); s.reset(); data.assign(write_data, sizeof(write_data)); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); data.assign(write_data, sizeof(write_data)); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); data.assign(write_data, sizeof(write_data)); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); data.assign(write_data, sizeof(write_data)); called = false; boost::asio::async_write(s, sb, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); called = false; boost::asio::async_write(s, sb, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); called = false; boost::asio::async_write(s, sb, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); called = false; boost::asio::async_write(s, sb, short_transfer(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(1); called = false; boost::asio::async_write(s, sb, short_transfer(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); s.next_write_length(10); called = false; boost::asio::async_write(s, sb, short_transfer(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); data.assign(write_data, sizeof(write_data)); int i = boost::asio::async_write(s, sb, short_transfer(), archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); } void test_4_arg_streambuf_async_write() { #if !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_stream s(ioc); boost::asio::streambuf sb; boost::asio::const_buffer buffers = boost::asio::buffer(write_data, sizeof(write_data)); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); bool called = false; boost::asio::async_write(s, sb, boost::asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); s.next_write_length(1); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); s.next_write_length(10); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_all(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); s.next_write_length(1); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); s.next_write_length(10); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_at_least(1), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); s.next_write_length(1); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); s.next_write_length(10); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_at_least(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); s.next_write_length(1); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); s.next_write_length(10); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_at_least(42), bindns::bind(async_write_handler, _1, _2, 50, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 50)); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); s.next_write_length(1); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); s.next_write_length(10); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_exactly(1), bindns::bind(async_write_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 1)); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); s.next_write_length(1); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); s.next_write_length(10); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_exactly(10), bindns::bind(async_write_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 10)); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); s.next_write_length(1); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); s.next_write_length(10); called = false; boost::asio::async_write(s, sb, boost::asio::transfer_exactly(42), bindns::bind(async_write_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, 42)); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); called = false; boost::asio::async_write(s, sb, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); s.next_write_length(1); called = false; boost::asio::async_write(s, sb, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); s.next_write_length(10); called = false; boost::asio::async_write(s, sb, old_style_transfer_all, bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); called = false; boost::asio::async_write(s, sb, short_transfer(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); s.next_write_length(1); called = false; boost::asio::async_write(s, sb, short_transfer(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); s.next_write_length(10); called = false; boost::asio::async_write(s, sb, short_transfer(), bindns::bind(async_write_handler, _1, _2, sizeof(write_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); s.reset(); sb.consume(sb.size()); sb.sputn(write_data, sizeof(write_data)); int i = boost::asio::async_write(s, sb, short_transfer(), archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); #endif // !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) } BOOST_ASIO_TEST_SUITE ( "write", BOOST_ASIO_TEST_CASE(test_2_arg_zero_buffers_write) BOOST_ASIO_TEST_CASE(test_2_arg_const_buffer_write) BOOST_ASIO_TEST_CASE(test_2_arg_mutable_buffer_write) BOOST_ASIO_TEST_CASE(test_2_arg_vector_buffers_write) BOOST_ASIO_TEST_CASE(test_2_arg_dynamic_string_write) BOOST_ASIO_TEST_CASE(test_3_arg_nothrow_zero_buffers_write) BOOST_ASIO_TEST_CASE(test_3_arg_nothrow_const_buffer_write) BOOST_ASIO_TEST_CASE(test_3_arg_nothrow_mutable_buffer_write) BOOST_ASIO_TEST_CASE(test_3_arg_nothrow_vector_buffers_write) BOOST_ASIO_TEST_CASE(test_3_arg_nothrow_dynamic_string_write) BOOST_ASIO_TEST_CASE(test_3_arg_const_buffer_write) BOOST_ASIO_TEST_CASE(test_3_arg_mutable_buffer_write) BOOST_ASIO_TEST_CASE(test_3_arg_vector_buffers_write) BOOST_ASIO_TEST_CASE(test_3_arg_dynamic_string_write) BOOST_ASIO_TEST_CASE(test_4_arg_const_buffer_write) BOOST_ASIO_TEST_CASE(test_4_arg_mutable_buffer_write) BOOST_ASIO_TEST_CASE(test_4_arg_vector_buffers_write) BOOST_ASIO_TEST_CASE(test_4_arg_dynamic_string_write) BOOST_ASIO_TEST_CASE(test_3_arg_const_buffer_async_write) BOOST_ASIO_TEST_CASE(test_3_arg_mutable_buffer_async_write) BOOST_ASIO_TEST_CASE(test_3_arg_boost_array_buffers_async_write) BOOST_ASIO_TEST_CASE(test_3_arg_std_array_buffers_async_write) BOOST_ASIO_TEST_CASE(test_3_arg_vector_buffers_async_write) BOOST_ASIO_TEST_CASE(test_3_arg_dynamic_string_async_write) BOOST_ASIO_TEST_CASE(test_3_arg_streambuf_async_write) BOOST_ASIO_TEST_CASE(test_4_arg_const_buffer_async_write) BOOST_ASIO_TEST_CASE(test_4_arg_mutable_buffer_async_write) BOOST_ASIO_TEST_CASE(test_4_arg_boost_array_buffers_async_write) BOOST_ASIO_TEST_CASE(test_4_arg_std_array_buffers_async_write) BOOST_ASIO_TEST_CASE(test_4_arg_vector_buffers_async_write) BOOST_ASIO_TEST_CASE(test_4_arg_dynamic_string_async_write) BOOST_ASIO_TEST_CASE(test_4_arg_streambuf_async_write) )
cpp
asio
data/projects/asio/test/basic_waitable_timer.cpp
// // basic_waitable_timer.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/basic_waitable_timer.hpp> #include "unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "basic_waitable_timer", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/basic_file.cpp
// // basic_file.cpp // ~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/basic_file.hpp> #include "unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "basic_file", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/any_completion_executor.cpp
// // any_completion_executor.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/any_completion_executor.hpp> #include <cstring> #include <functional> #include <boost/asio/system_executor.hpp> #include <boost/asio/thread_pool.hpp> #include "unit_test.hpp" using namespace boost::asio; namespace bindns = std; static bool next_nothrow_new_fails = false; void* operator new(std::size_t n, const std::nothrow_t&) noexcept { if (next_nothrow_new_fails) { next_nothrow_new_fails = false; return 0; } return ::operator new(n); } struct fat_executor { fat_executor(int id) : id_(id) { std::memset(data_, 0, sizeof(data_)); } template <typename F> void execute(const F&) const { } friend bool operator==(const fat_executor& a, const fat_executor& b) noexcept { return a.id_ == b.id_; } friend bool operator!=(const fat_executor& a, const fat_executor& b) noexcept { return a.id_ != b.id_; } int id_; unsigned char data_[1024]; }; namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) template <typename F> struct execute_member<fat_executor, F> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = false; typedef void result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) template <> struct equality_comparable<fat_executor> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) } // namespace traits } // namespace asio } // namespace boost void increment(int* count) { ++(*count); } void any_completion_executor_construction_test() { thread_pool pool(1); boost::asio::nullptr_t null_ptr = boost::asio::nullptr_t(); boost::asio::any_completion_executor ex1; BOOST_ASIO_CHECK(ex1.target<void>() == 0); BOOST_ASIO_CHECK(ex1 == null_ptr); boost::asio::any_completion_executor ex2(null_ptr); BOOST_ASIO_CHECK(ex2.target<void>() == 0); BOOST_ASIO_CHECK(ex2 == null_ptr); BOOST_ASIO_CHECK(ex2 == ex1); boost::asio::any_completion_executor ex3(pool.executor()); BOOST_ASIO_CHECK(ex3.target<void>() != 0); BOOST_ASIO_CHECK(ex3 != null_ptr); BOOST_ASIO_CHECK(ex3 != ex1); boost::asio::any_completion_executor ex4(ex1); BOOST_ASIO_CHECK(ex4.target<void>() == 0); BOOST_ASIO_CHECK(ex4 == null_ptr); BOOST_ASIO_CHECK(ex4 == ex1); boost::asio::any_completion_executor ex5(ex3); BOOST_ASIO_CHECK(ex5.target<void>() != 0); BOOST_ASIO_CHECK(ex5 != null_ptr); BOOST_ASIO_CHECK(ex5 == ex3); boost::asio::any_completion_executor ex6 = fat_executor(1); BOOST_ASIO_CHECK(ex6.target<void>() != 0); BOOST_ASIO_CHECK(ex6 != null_ptr); BOOST_ASIO_CHECK(ex6 != ex1); boost::asio::any_completion_executor ex7 = fat_executor(1); BOOST_ASIO_CHECK(ex7.target<void>() != 0); BOOST_ASIO_CHECK(ex7 != null_ptr); BOOST_ASIO_CHECK(ex7 != ex1); BOOST_ASIO_CHECK(ex7 == ex6); boost::asio::any_completion_executor ex8 = fat_executor(2); BOOST_ASIO_CHECK(ex8.target<void>() != 0); BOOST_ASIO_CHECK(ex8 != null_ptr); BOOST_ASIO_CHECK(ex8 != ex1); BOOST_ASIO_CHECK(ex8 != ex6); BOOST_ASIO_CHECK(ex8 != ex7); boost::asio::any_completion_executor ex9(ex6); BOOST_ASIO_CHECK(ex9.target<void>() != 0); BOOST_ASIO_CHECK(ex9 != null_ptr); BOOST_ASIO_CHECK(ex9 != ex1); BOOST_ASIO_CHECK(ex9 == ex6); BOOST_ASIO_CHECK(ex9 == ex7); BOOST_ASIO_CHECK(ex9 != ex8); boost::asio::any_completion_executor ex10(std::move(ex1)); BOOST_ASIO_CHECK(ex10.target<void>() == 0); BOOST_ASIO_CHECK(ex10 == null_ptr); BOOST_ASIO_CHECK(ex1.target<void>() == 0); BOOST_ASIO_CHECK(ex1 == null_ptr); boost::asio::any_completion_executor ex11(std::move(ex3)); BOOST_ASIO_CHECK(ex11.target<void>() != 0); BOOST_ASIO_CHECK(ex11 != null_ptr); BOOST_ASIO_CHECK(ex3.target<void>() == 0); BOOST_ASIO_CHECK(ex3 == null_ptr); BOOST_ASIO_CHECK(ex11 == ex5); boost::asio::any_completion_executor ex12(std::move(ex7)); BOOST_ASIO_CHECK(ex12.target<void>() != 0); BOOST_ASIO_CHECK(ex12 != null_ptr); BOOST_ASIO_CHECK(ex7.target<void>() == 0); BOOST_ASIO_CHECK(ex7 == null_ptr); BOOST_ASIO_CHECK(ex12 == ex6); BOOST_ASIO_CHECK(ex12 != ex8); } void any_completion_executor_nothrow_construction_test() { thread_pool pool(1); boost::asio::nullptr_t null_ptr = boost::asio::nullptr_t(); boost::asio::any_completion_executor ex1; BOOST_ASIO_CHECK(ex1.target<void>() == 0); BOOST_ASIO_CHECK(ex1 == null_ptr); boost::asio::any_completion_executor ex2(null_ptr); BOOST_ASIO_CHECK(ex2.target<void>() == 0); BOOST_ASIO_CHECK(ex2 == null_ptr); BOOST_ASIO_CHECK(ex2 == ex1); boost::asio::any_completion_executor ex3(std::nothrow, pool.executor()); BOOST_ASIO_CHECK(ex3.target<void>() != 0); BOOST_ASIO_CHECK(ex3 != null_ptr); BOOST_ASIO_CHECK(ex3 != ex1); boost::asio::any_completion_executor ex4(std::nothrow, ex1); BOOST_ASIO_CHECK(ex4.target<void>() == 0); BOOST_ASIO_CHECK(ex4 == null_ptr); BOOST_ASIO_CHECK(ex4 == ex1); boost::asio::any_completion_executor ex5(std::nothrow, ex3); BOOST_ASIO_CHECK(ex5.target<void>() != 0); BOOST_ASIO_CHECK(ex5 != null_ptr); BOOST_ASIO_CHECK(ex5 == ex3); boost::asio::any_completion_executor ex6(std::nothrow, fat_executor(1)); BOOST_ASIO_CHECK(ex6.target<void>() != 0); BOOST_ASIO_CHECK(ex6 != null_ptr); BOOST_ASIO_CHECK(ex6 != ex1); boost::asio::any_completion_executor ex7(std::nothrow, fat_executor(1)); BOOST_ASIO_CHECK(ex7.target<void>() != 0); BOOST_ASIO_CHECK(ex7 != null_ptr); BOOST_ASIO_CHECK(ex7 != ex1); BOOST_ASIO_CHECK(ex7 == ex6); boost::asio::any_completion_executor ex8(std::nothrow, fat_executor(2)); BOOST_ASIO_CHECK(ex8.target<void>() != 0); BOOST_ASIO_CHECK(ex8 != null_ptr); BOOST_ASIO_CHECK(ex8 != ex1); BOOST_ASIO_CHECK(ex8 != ex6); BOOST_ASIO_CHECK(ex8 != ex7); boost::asio::any_completion_executor ex9(std::nothrow, ex6); BOOST_ASIO_CHECK(ex9.target<void>() != 0); BOOST_ASIO_CHECK(ex9 != null_ptr); BOOST_ASIO_CHECK(ex9 != ex1); BOOST_ASIO_CHECK(ex9 == ex6); BOOST_ASIO_CHECK(ex9 == ex7); BOOST_ASIO_CHECK(ex9 != ex8); boost::asio::any_completion_executor ex10(std::nothrow, std::move(ex1)); BOOST_ASIO_CHECK(ex10.target<void>() == 0); BOOST_ASIO_CHECK(ex10 == null_ptr); BOOST_ASIO_CHECK(ex1.target<void>() == 0); BOOST_ASIO_CHECK(ex1 == null_ptr); boost::asio::any_completion_executor ex11(std::nothrow, std::move(ex3)); BOOST_ASIO_CHECK(ex11.target<void>() != 0); BOOST_ASIO_CHECK(ex11 != null_ptr); BOOST_ASIO_CHECK(ex3.target<void>() == 0); BOOST_ASIO_CHECK(ex3 == null_ptr); BOOST_ASIO_CHECK(ex11 == ex5); boost::asio::any_completion_executor ex12(std::nothrow, std::move(ex7)); BOOST_ASIO_CHECK(ex12.target<void>() != 0); BOOST_ASIO_CHECK(ex12 != null_ptr); BOOST_ASIO_CHECK(ex7.target<void>() == 0); BOOST_ASIO_CHECK(ex7 == null_ptr); BOOST_ASIO_CHECK(ex12 == ex6); BOOST_ASIO_CHECK(ex12 != ex8); next_nothrow_new_fails = true; boost::asio::any_completion_executor ex13(std::nothrow, fat_executor(3)); BOOST_ASIO_CHECK(ex13.target<void>() == 0); BOOST_ASIO_CHECK(ex13 == null_ptr); BOOST_ASIO_CHECK(ex13 == ex1); } void any_completion_executor_assignment_test() { thread_pool pool(1); boost::asio::nullptr_t null_ptr = boost::asio::nullptr_t(); boost::asio::any_completion_executor ex1; boost::asio::any_completion_executor ex2; ex2 = null_ptr; BOOST_ASIO_CHECK(ex2.target<void>() == 0); boost::asio::any_completion_executor ex3; ex3 = pool.executor(); BOOST_ASIO_CHECK(ex3.target<void>() != 0); boost::asio::any_completion_executor ex4; ex4 = ex1; BOOST_ASIO_CHECK(ex4.target<void>() == 0); BOOST_ASIO_CHECK(ex4 == ex1); ex4 = ex3; BOOST_ASIO_CHECK(ex4.target<void>() != 0); BOOST_ASIO_CHECK(ex4 == ex3); boost::asio::any_completion_executor ex5; ex5 = fat_executor(1); BOOST_ASIO_CHECK(ex5.target<void>() != 0); BOOST_ASIO_CHECK(ex5 != null_ptr); BOOST_ASIO_CHECK(ex5 != ex1); boost::asio::any_completion_executor ex6; ex6 = fat_executor(1); BOOST_ASIO_CHECK(ex6.target<void>() != 0); BOOST_ASIO_CHECK(ex6 != null_ptr); BOOST_ASIO_CHECK(ex6 != ex1); BOOST_ASIO_CHECK(ex6 == ex5); ex6 = fat_executor(2); BOOST_ASIO_CHECK(ex6.target<void>() != 0); BOOST_ASIO_CHECK(ex6 != null_ptr); BOOST_ASIO_CHECK(ex6 != ex1); BOOST_ASIO_CHECK(ex6 != ex5); boost::asio::any_completion_executor ex7; ex7 = ex5; BOOST_ASIO_CHECK(ex7.target<void>() != 0); BOOST_ASIO_CHECK(ex7 != null_ptr); BOOST_ASIO_CHECK(ex7 != ex1); BOOST_ASIO_CHECK(ex7 == ex5); BOOST_ASIO_CHECK(ex7 != ex6); boost::asio::any_completion_executor ex8; ex8 = std::move(ex1); BOOST_ASIO_CHECK(ex8.target<void>() == 0); BOOST_ASIO_CHECK(ex1.target<void>() == 0); ex8 = std::move(ex3); BOOST_ASIO_CHECK(ex8.target<void>() != 0); BOOST_ASIO_CHECK(ex3.target<void>() == 0); BOOST_ASIO_CHECK(ex8 == ex4); ex8 = std::move(ex5); BOOST_ASIO_CHECK(ex8.target<void>() != 0); BOOST_ASIO_CHECK(ex5.target<void>() == 0); BOOST_ASIO_CHECK(ex8 == ex7); } void any_completion_executor_swap_test() { thread_pool pool1(1); thread_pool pool2(1); boost::asio::any_completion_executor ex1(pool1.executor()); boost::asio::any_completion_executor ex2(pool2.executor()); boost::asio::any_completion_executor ex3(ex1); boost::asio::any_completion_executor ex4(ex2); BOOST_ASIO_CHECK(ex3 == ex1); BOOST_ASIO_CHECK(ex4 == ex2); ex3.swap(ex4); BOOST_ASIO_CHECK(ex3 == ex2); BOOST_ASIO_CHECK(ex4 == ex1); execution::swap(ex3, ex4); BOOST_ASIO_CHECK(ex3 == ex1); BOOST_ASIO_CHECK(ex4 == ex2); } void any_completion_executor_query_test() { thread_pool pool(1); boost::asio::any_completion_executor ex(pool.executor()); BOOST_ASIO_CHECK( boost::asio::query(ex, boost::asio::execution::blocking) == boost::asio::execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ex, boost::asio::execution::blocking.possibly) == boost::asio::execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ex, boost::asio::execution::outstanding_work) == boost::asio::execution::outstanding_work.untracked); BOOST_ASIO_CHECK( boost::asio::query(ex, boost::asio::execution::outstanding_work.untracked) == boost::asio::execution::outstanding_work.untracked); BOOST_ASIO_CHECK( boost::asio::query(ex, boost::asio::execution::relationship) == boost::asio::execution::relationship.fork); BOOST_ASIO_CHECK( boost::asio::query(ex, boost::asio::execution::relationship.fork) == boost::asio::execution::relationship.fork); } void any_completion_executor_execute_test() { int count = 0; thread_pool pool(1); boost::asio::any_completion_executor ex(pool.executor()); ex.execute(bindns::bind(increment, &count)); boost::asio::prefer(ex, boost::asio::execution::blocking.possibly).execute( bindns::bind(increment, &count)); boost::asio::prefer(ex, boost::asio::execution::blocking.possibly, boost::asio::execution::outstanding_work.tracked ).execute(bindns::bind(increment, &count)); boost::asio::prefer(ex, boost::asio::execution::blocking.possibly, boost::asio::execution::outstanding_work.untracked ).execute(bindns::bind(increment, &count)); boost::asio::prefer(ex, boost::asio::execution::blocking.possibly, boost::asio::execution::outstanding_work.untracked, boost::asio::execution::relationship.continuation ).execute(bindns::bind(increment, &count)); pool.wait(); BOOST_ASIO_CHECK(count == 5); } BOOST_ASIO_TEST_SUITE ( "any_completion_executor", BOOST_ASIO_TEST_CASE(any_completion_executor_construction_test) BOOST_ASIO_TEST_CASE(any_completion_executor_nothrow_construction_test) BOOST_ASIO_TEST_CASE(any_completion_executor_assignment_test) BOOST_ASIO_TEST_CASE(any_completion_executor_swap_test) BOOST_ASIO_TEST_CASE(any_completion_executor_query_test) BOOST_ASIO_TEST_CASE(any_completion_executor_execute_test) )
cpp
asio
data/projects/asio/test/bind_allocator.cpp
// // bind_allocator.cpp // ~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/bind_allocator.hpp> #include <functional> #include <boost/asio/io_context.hpp> #include <boost/asio/steady_timer.hpp> #include "unit_test.hpp" #if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) # include <boost/asio/deadline_timer.hpp> #else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) # include <boost/asio/steady_timer.hpp> #endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) using namespace boost::asio; namespace bindns = std; #if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) typedef deadline_timer timer; namespace chronons = boost::posix_time; #else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) typedef steady_timer timer; namespace chronons = boost::asio::chrono; #endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME) template <typename T> class test_allocator { public: typedef T value_type; explicit test_allocator(int* allocations) : allocations_(allocations) { } template <typename U> test_allocator(const test_allocator<U>& other) : allocations_(other.allocations_) { } template <typename U> struct rebind { typedef test_allocator<U> other; }; bool operator==(const test_allocator&) const { return true; } bool operator!=(const test_allocator&) const { return false; } T* allocate(std::size_t n) const { ++(*allocations_); return static_cast<T*>(::operator new(sizeof(T) * n)); } void deallocate(T* p, std::size_t /*n*/) const { --(*allocations_); ::operator delete(p); } //private: int* allocations_; }; void increment(int* count) { ++(*count); } void bind_allocator_to_function_object_test() { io_context ioc; int count = 0; int allocations = 0; timer t(ioc, chronons::seconds(1)); t.async_wait( bind_allocator( test_allocator<int>(&allocations), bindns::bind(&increment, &count))); BOOST_ASIO_CHECK(count == 0); BOOST_ASIO_CHECK(allocations == 1); ioc.run(); BOOST_ASIO_CHECK(count == 1); BOOST_ASIO_CHECK(allocations == 0); t.async_wait( bind_allocator( test_allocator<int>(&allocations), bind_allocator( std::allocator<void>(), bindns::bind(&increment, &count)))); BOOST_ASIO_CHECK(count == 1); BOOST_ASIO_CHECK(allocations == 1); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(count == 2); BOOST_ASIO_CHECK(allocations == 0); } struct incrementer_token_v1 { explicit incrementer_token_v1(int* c) : count(c) {} int* count; }; struct incrementer_handler_v1 { explicit incrementer_handler_v1(incrementer_token_v1 t) : count(t.count) {} void operator()(boost::system::error_code){ increment(count); } int* count; }; namespace boost { namespace asio { template <> class async_result<incrementer_token_v1, void(boost::system::error_code)> { public: typedef incrementer_handler_v1 completion_handler_type; typedef void return_type; explicit async_result(completion_handler_type&) {} return_type get() {} }; } // namespace asio } // namespace boost void bind_allocator_to_completion_token_v1_test() { io_context ioc; int count = 0; int allocations = 0; timer t(ioc, chronons::seconds(1)); t.async_wait( bind_allocator( test_allocator<int>(&allocations), incrementer_token_v1(&count))); BOOST_ASIO_CHECK(count == 0); BOOST_ASIO_CHECK(allocations == 1); ioc.run(); BOOST_ASIO_CHECK(count == 1); BOOST_ASIO_CHECK(allocations == 0); } struct incrementer_token_v2 { explicit incrementer_token_v2(int* c) : count(c) {} int* count; }; namespace boost { namespace asio { template <> class async_result<incrementer_token_v2, void(boost::system::error_code)> { public: #if !defined(BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION) typedef void return_type; #endif // !defined(BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION) template <typename Initiation, typename... Args> static void initiate(Initiation initiation, incrementer_token_v2 token, Args&&... args) { initiation(bindns::bind(&increment, token.count), static_cast<Args&&>(args)...); } }; } // namespace asio } // namespace boost void bind_allocator_to_completion_token_v2_test() { io_context ioc; int count = 0; int allocations = 0; timer t(ioc, chronons::seconds(1)); t.async_wait( bind_allocator( test_allocator<int>(&allocations), incrementer_token_v2(&count))); BOOST_ASIO_CHECK(count == 0); BOOST_ASIO_CHECK(allocations == 1); ioc.run(); BOOST_ASIO_CHECK(count == 1); BOOST_ASIO_CHECK(allocations == 0); } BOOST_ASIO_TEST_SUITE ( "bind_allocator", BOOST_ASIO_TEST_CASE(bind_allocator_to_function_object_test) BOOST_ASIO_TEST_CASE(bind_allocator_to_completion_token_v1_test) BOOST_ASIO_TEST_CASE(bind_allocator_to_completion_token_v2_test) )
cpp
asio
data/projects/asio/test/basic_streambuf.cpp
// // basic_streambuf.cpp // ~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/basic_streambuf.hpp> #include "unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "basic_streambuf", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/error.cpp
// // error.cpp // ~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/error.hpp> #include <sstream> #include "unit_test.hpp" void test_error_code(const boost::system::error_code& code) { boost::system::error_code error(code); BOOST_ASIO_CHECK(code == error); BOOST_ASIO_CHECK(!code || error); BOOST_ASIO_CHECK(!code || !!error); boost::system::error_code error2(error); BOOST_ASIO_CHECK(error == error2); BOOST_ASIO_CHECK(!(error != error2)); boost::system::error_code error3; error3 = error; BOOST_ASIO_CHECK(error == error3); BOOST_ASIO_CHECK(!(error != error3)); std::ostringstream os; os << error; BOOST_ASIO_CHECK(!os.str().empty()); } void error_test() { test_error_code(boost::asio::error::access_denied); test_error_code(boost::asio::error::address_family_not_supported); test_error_code(boost::asio::error::address_in_use); test_error_code(boost::asio::error::already_connected); test_error_code(boost::asio::error::already_started); test_error_code(boost::asio::error::connection_aborted); test_error_code(boost::asio::error::connection_refused); test_error_code(boost::asio::error::connection_reset); test_error_code(boost::asio::error::bad_descriptor); test_error_code(boost::asio::error::eof); test_error_code(boost::asio::error::fault); test_error_code(boost::asio::error::host_not_found); test_error_code(boost::asio::error::host_not_found_try_again); test_error_code(boost::asio::error::host_unreachable); test_error_code(boost::asio::error::in_progress); test_error_code(boost::asio::error::interrupted); test_error_code(boost::asio::error::invalid_argument); test_error_code(boost::asio::error::message_size); test_error_code(boost::asio::error::network_down); test_error_code(boost::asio::error::network_reset); test_error_code(boost::asio::error::network_unreachable); test_error_code(boost::asio::error::no_descriptors); test_error_code(boost::asio::error::no_buffer_space); test_error_code(boost::asio::error::no_data); test_error_code(boost::asio::error::no_memory); test_error_code(boost::asio::error::no_permission); test_error_code(boost::asio::error::no_protocol_option); test_error_code(boost::asio::error::no_recovery); test_error_code(boost::asio::error::not_connected); test_error_code(boost::asio::error::not_socket); test_error_code(boost::asio::error::operation_aborted); test_error_code(boost::asio::error::operation_not_supported); test_error_code(boost::asio::error::service_not_found); test_error_code(boost::asio::error::shut_down); test_error_code(boost::asio::error::timed_out); test_error_code(boost::asio::error::try_again); test_error_code(boost::asio::error::would_block); } BOOST_ASIO_TEST_SUITE ( "error", BOOST_ASIO_TEST_CASE(error_test) )
cpp
asio
data/projects/asio/test/basic_raw_socket.cpp
// // basic_raw_socket.cpp // ~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/basic_raw_socket.hpp> #include "unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "basic_raw_socket", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/writable_pipe.cpp
// // writable_pipe.cpp // ~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header pipe is self-contained. #include <boost/asio/writable_pipe.hpp> #include "archetypes/async_result.hpp" #include <boost/asio/io_context.hpp> #include "unit_test.hpp" // writable_pipe_compile test // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // The following test checks that all public member functions on the class // writable_pipe compile and link correctly. Runtime failures are ignored. namespace writable_pipe_compile { struct write_some_handler { write_some_handler() {} void operator()(const boost::system::error_code&, std::size_t) {} write_some_handler(write_some_handler&&) {} private: write_some_handler(const write_some_handler&); }; struct read_some_handler { read_some_handler() {} void operator()(const boost::system::error_code&, std::size_t) {} read_some_handler(read_some_handler&&) {} private: read_some_handler(const read_some_handler&); }; void test() { #if defined(BOOST_ASIO_HAS_PIPE) using namespace boost::asio; try { io_context ioc; const io_context::executor_type ioc_ex = ioc.get_executor(); char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; archetypes::lazy_handler lazy; boost::system::error_code ec; // basic_writable_pipe constructors. writable_pipe pipe1(ioc); writable_pipe::native_handle_type native_pipe1 = pipe1.native_handle(); writable_pipe pipe2(ioc, native_pipe1); writable_pipe pipe3(ioc_ex); writable_pipe::native_handle_type native_pipe2 = pipe1.native_handle(); writable_pipe pipe4(ioc_ex, native_pipe2); writable_pipe pipe5(std::move(pipe4)); basic_writable_pipe<io_context::executor_type> pipe6(ioc); writable_pipe pipe7(std::move(pipe6)); // basic_writable_pipe operators. pipe1 = writable_pipe(ioc); pipe1 = std::move(pipe2); pipe1 = std::move(pipe6); // basic_io_object functions. writable_pipe::executor_type ex = pipe1.get_executor(); (void)ex; // basic_writable_pipe functions. writable_pipe::native_handle_type native_pipe3 = pipe1.native_handle(); pipe1.assign(native_pipe3); writable_pipe::native_handle_type native_pipe4 = pipe1.native_handle(); pipe1.assign(native_pipe4, ec); bool is_open = pipe1.is_open(); (void)is_open; pipe1.close(); pipe1.close(ec); writable_pipe::native_handle_type native_pipe5 = pipe1.release(); (void)native_pipe5; writable_pipe::native_handle_type native_pipe6 = pipe1.release(ec); (void)native_pipe6; writable_pipe::native_handle_type native_pipe7 = pipe1.native_handle(); (void)native_pipe7; pipe1.cancel(); pipe1.cancel(ec); pipe1.write_some(buffer(mutable_char_buffer)); pipe1.write_some(buffer(const_char_buffer)); pipe1.write_some(buffer(mutable_char_buffer), ec); pipe1.write_some(buffer(const_char_buffer), ec); pipe1.async_write_some(buffer(mutable_char_buffer), write_some_handler()); pipe1.async_write_some(buffer(const_char_buffer), write_some_handler()); int i1 = pipe1.async_write_some(buffer(mutable_char_buffer), lazy); (void)i1; int i2 = pipe1.async_write_some(buffer(const_char_buffer), lazy); (void)i2; } catch (std::exception&) { } #endif // defined(BOOST_ASIO_HAS_PIPE) } } // namespace writable_pipe_compile BOOST_ASIO_TEST_SUITE ( "writable_pipe", BOOST_ASIO_COMPILE_TEST_CASE(writable_pipe_compile::test) )
cpp
asio
data/projects/asio/test/steady_timer.cpp
// // steady_timer.cpp // ~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Prevent link dependency on the Boost.System library. #if !defined(BOOST_SYSTEM_NO_DEPRECATED) #define BOOST_SYSTEM_NO_DEPRECATED #endif // !defined(BOOST_SYSTEM_NO_DEPRECATED) // Test that header file is self-contained. #include <boost/asio/steady_timer.hpp> #include "unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "steady_timer", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/read_until.cpp
// // read_until.cpp // ~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/read_until.hpp> #include <cstring> #include <functional> #include "archetypes/async_result.hpp" #include <boost/asio/io_context.hpp> #include <boost/asio/post.hpp> #include <boost/asio/streambuf.hpp> #include "unit_test.hpp" class test_stream { public: typedef boost::asio::io_context::executor_type executor_type; test_stream(boost::asio::io_context& io_context) : io_context_(io_context), length_(0), position_(0), next_read_length_(0) { } executor_type get_executor() noexcept { return io_context_.get_executor(); } void reset(const void* data, size_t length) { using namespace std; // For memcpy. BOOST_ASIO_CHECK(length <= max_length); memcpy(data_, data, length); length_ = length; position_ = 0; next_read_length_ = length; } void next_read_length(size_t length) { next_read_length_ = length; } template <typename Mutable_Buffers> size_t read_some(const Mutable_Buffers& buffers) { size_t n = boost::asio::buffer_copy(buffers, boost::asio::buffer(data_, length_) + position_, next_read_length_); position_ += n; return n; } template <typename Mutable_Buffers> size_t read_some(const Mutable_Buffers& buffers, boost::system::error_code& ec) { ec = boost::system::error_code(); return read_some(buffers); } template <typename Mutable_Buffers, typename Handler> void async_read_some(const Mutable_Buffers& buffers, Handler handler) { size_t bytes_transferred = read_some(buffers); boost::asio::post(get_executor(), boost::asio::detail::bind_handler( static_cast<Handler&&>(handler), boost::system::error_code(), bytes_transferred)); } private: boost::asio::io_context& io_context_; enum { max_length = 8192 }; char data_[max_length]; size_t length_; size_t position_; size_t next_read_length_; }; static const char read_data[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; void test_dynamic_string_read_until_char() { boost::asio::io_context ioc; test_stream s(ioc); std::string data1, data2; boost::asio::dynamic_string_buffer<char, std::string::traits_type, std::string::allocator_type> sb1 = boost::asio::dynamic_buffer(data1); boost::asio::dynamic_string_buffer<char, std::string::traits_type, std::string::allocator_type> sb2 = boost::asio::dynamic_buffer(data2, 25); boost::system::error_code ec; s.reset(read_data, sizeof(read_data)); sb1.consume(sb1.size()); std::size_t length = boost::asio::read_until(s, sb1, 'Z'); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, 'Z'); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, 'Z'); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, 'Z', ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, 'Z', ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, 'Z', ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, 'Z', ec); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, 'Z', ec); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, 'Z', ec); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, 'Y', ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, 'Y', ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, 'Y', ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); } void test_streambuf_read_until_char() { #if !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) boost::asio::io_context ioc; test_stream s(ioc); boost::asio::streambuf sb1; boost::asio::streambuf sb2(25); boost::system::error_code ec; s.reset(read_data, sizeof(read_data)); sb1.consume(sb1.size()); std::size_t length = boost::asio::read_until(s, sb1, 'Z'); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, 'Z'); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, 'Z'); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, 'Z', ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, 'Z', ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, 'Z', ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, 'Z', ec); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, 'Z', ec); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, 'Z', ec); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, 'Y', ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, 'Y', ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, 'Y', ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); #endif // !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) } void test_dynamic_string_read_until_string() { boost::asio::io_context ioc; test_stream s(ioc); std::string data1, data2; boost::asio::dynamic_string_buffer<char, std::string::traits_type, std::string::allocator_type> sb1 = boost::asio::dynamic_buffer(data1); boost::asio::dynamic_string_buffer<char, std::string::traits_type, std::string::allocator_type> sb2 = boost::asio::dynamic_buffer(data2, 25); boost::system::error_code ec; s.reset(read_data, sizeof(read_data)); sb1.consume(sb1.size()); std::size_t length = boost::asio::read_until(s, sb1, "XYZ"); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, "XYZ"); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, "XYZ"); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, "XYZ", ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, "XYZ", ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, "XYZ", ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, "XYZ", ec); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, "XYZ", ec); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, "XYZ", ec); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, "WXY", ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, "WXY", ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, "WXY", ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); } void test_streambuf_read_until_string() { #if !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) boost::asio::io_context ioc; test_stream s(ioc); boost::asio::streambuf sb1; boost::asio::streambuf sb2(25); boost::system::error_code ec; s.reset(read_data, sizeof(read_data)); sb1.consume(sb1.size()); std::size_t length = boost::asio::read_until(s, sb1, "XYZ"); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, "XYZ"); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, "XYZ"); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, "XYZ", ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, "XYZ", ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, "XYZ", ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, "XYZ", ec); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, "XYZ", ec); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, "XYZ", ec); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, "WXY", ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, "WXY", ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, "WXY", ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); #endif // !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) } class match_char { public: explicit match_char(char c) : c_(c) {} template <typename Iterator> std::pair<Iterator, bool> operator()( Iterator begin, Iterator end) const { Iterator i = begin; while (i != end) if (c_ == *i++) return std::make_pair(i, true); return std::make_pair(i, false); } private: char c_; }; namespace boost { namespace asio { template <> struct is_match_condition<match_char> { enum { value = true }; }; } // namespace asio } // namespace boost void test_dynamic_string_read_until_match_condition() { boost::asio::io_context ioc; test_stream s(ioc); std::string data1, data2; boost::asio::dynamic_string_buffer<char, std::string::traits_type, std::string::allocator_type> sb1 = boost::asio::dynamic_buffer(data1); boost::asio::dynamic_string_buffer<char, std::string::traits_type, std::string::allocator_type> sb2 = boost::asio::dynamic_buffer(data2, 25); boost::system::error_code ec; s.reset(read_data, sizeof(read_data)); sb1.consume(sb1.size()); std::size_t length = boost::asio::read_until(s, sb1, match_char('Z')); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, match_char('Z')); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, match_char('Z')); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, match_char('Z'), ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, match_char('Z'), ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, match_char('Z'), ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, match_char('Z'), ec); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, match_char('Z'), ec); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, match_char('Z'), ec); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, match_char('Y'), ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, match_char('Y'), ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, match_char('Y'), ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); } void test_streambuf_read_until_match_condition() { #if !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) boost::asio::io_context ioc; test_stream s(ioc); boost::asio::streambuf sb1; boost::asio::streambuf sb2(25); boost::system::error_code ec; s.reset(read_data, sizeof(read_data)); sb1.consume(sb1.size()); std::size_t length = boost::asio::read_until(s, sb1, match_char('Z')); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, match_char('Z')); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, match_char('Z')); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, match_char('Z'), ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, match_char('Z'), ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb1.consume(sb1.size()); length = boost::asio::read_until(s, sb1, match_char('Z'), ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, match_char('Z'), ec); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, match_char('Z'), ec); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, match_char('Z'), ec); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, match_char('Y'), ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, match_char('Y'), ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb2.consume(sb2.size()); length = boost::asio::read_until(s, sb2, match_char('Y'), ec); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); #endif // !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) } void async_read_handler( const boost::system::error_code& err, boost::system::error_code* err_out, std::size_t bytes_transferred, std::size_t* bytes_out, bool* called) { *err_out = err; *bytes_out = bytes_transferred; *called = true; } void test_dynamic_string_async_read_until_char() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_stream s(ioc); std::string data1, data2; boost::asio::dynamic_string_buffer<char, std::string::traits_type, std::string::allocator_type> sb1 = boost::asio::dynamic_buffer(data1); boost::asio::dynamic_string_buffer<char, std::string::traits_type, std::string::allocator_type> sb2 = boost::asio::dynamic_buffer(data2, 25); boost::system::error_code ec; std::size_t length; bool called; s.reset(read_data, sizeof(read_data)); ec = boost::system::error_code(); length = 0; called = false; sb1.consume(sb1.size()); boost::asio::async_read_until(s, sb1, 'Z', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); ec = boost::system::error_code(); length = 0; called = false; sb1.consume(sb1.size()); boost::asio::async_read_until(s, sb1, 'Z', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); ec = boost::system::error_code(); length = 0; called = false; sb1.consume(sb1.size()); boost::asio::async_read_until(s, sb1, 'Z', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, 'Z', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, 'Z', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, 'Z', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, 'Y', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, 'Y', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, 'Y', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); sb2.consume(sb2.size()); int i = boost::asio::async_read_until(s, sb2, 'Y', archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); } void test_streambuf_async_read_until_char() { #if !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_stream s(ioc); boost::asio::streambuf sb1; boost::asio::streambuf sb2(25); boost::system::error_code ec; std::size_t length; bool called; s.reset(read_data, sizeof(read_data)); ec = boost::system::error_code(); length = 0; called = false; sb1.consume(sb1.size()); boost::asio::async_read_until(s, sb1, 'Z', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); ec = boost::system::error_code(); length = 0; called = false; sb1.consume(sb1.size()); boost::asio::async_read_until(s, sb1, 'Z', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); ec = boost::system::error_code(); length = 0; called = false; sb1.consume(sb1.size()); boost::asio::async_read_until(s, sb1, 'Z', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, 'Z', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, 'Z', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, 'Z', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, 'Y', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, 'Y', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, 'Y', bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); sb2.consume(sb2.size()); int i = boost::asio::async_read_until(s, sb2, 'Y', archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); #endif // !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) } void test_dynamic_string_async_read_until_string() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_stream s(ioc); std::string data1, data2; boost::asio::dynamic_string_buffer<char, std::string::traits_type, std::string::allocator_type> sb1 = boost::asio::dynamic_buffer(data1); boost::asio::dynamic_string_buffer<char, std::string::traits_type, std::string::allocator_type> sb2 = boost::asio::dynamic_buffer(data2, 25); boost::system::error_code ec; std::size_t length; bool called; s.reset(read_data, sizeof(read_data)); ec = boost::system::error_code(); length = 0; called = false; sb1.consume(sb1.size()); boost::asio::async_read_until(s, sb1, "XYZ", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); ec = boost::system::error_code(); length = 0; called = false; sb1.consume(sb1.size()); boost::asio::async_read_until(s, sb1, "XYZ", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); ec = boost::system::error_code(); length = 0; called = false; sb1.consume(sb1.size()); boost::asio::async_read_until(s, sb1, "XYZ", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, "XYZ", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, "XYZ", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, "XYZ", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, "WXY", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, "WXY", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, "WXY", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); sb2.consume(sb2.size()); int i = boost::asio::async_read_until(s, sb2, "WXY", archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); } void test_streambuf_async_read_until_string() { #if !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_stream s(ioc); boost::asio::streambuf sb1; boost::asio::streambuf sb2(25); boost::system::error_code ec; std::size_t length; bool called; s.reset(read_data, sizeof(read_data)); ec = boost::system::error_code(); length = 0; called = false; sb1.consume(sb1.size()); boost::asio::async_read_until(s, sb1, "XYZ", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); ec = boost::system::error_code(); length = 0; called = false; sb1.consume(sb1.size()); boost::asio::async_read_until(s, sb1, "XYZ", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); ec = boost::system::error_code(); length = 0; called = false; sb1.consume(sb1.size()); boost::asio::async_read_until(s, sb1, "XYZ", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, "XYZ", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, "XYZ", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, "XYZ", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, "WXY", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, "WXY", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, "WXY", bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); sb2.consume(sb2.size()); int i = boost::asio::async_read_until(s, sb2, "WXY", archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); #endif // !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) } void test_dynamic_string_async_read_until_match_condition() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_stream s(ioc); std::string data1, data2; boost::asio::dynamic_string_buffer<char, std::string::traits_type, std::string::allocator_type> sb1 = boost::asio::dynamic_buffer(data1); boost::asio::dynamic_string_buffer<char, std::string::traits_type, std::string::allocator_type> sb2 = boost::asio::dynamic_buffer(data2, 25); boost::system::error_code ec; std::size_t length; bool called; s.reset(read_data, sizeof(read_data)); ec = boost::system::error_code(); length = 0; called = false; sb1.consume(sb1.size()); boost::asio::async_read_until(s, sb1, match_char('Z'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); ec = boost::system::error_code(); length = 0; called = false; sb1.consume(sb1.size()); boost::asio::async_read_until(s, sb1, match_char('Z'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); ec = boost::system::error_code(); length = 0; called = false; sb1.consume(sb1.size()); boost::asio::async_read_until(s, sb1, match_char('Z'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, match_char('Z'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, match_char('Z'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, match_char('Z'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, match_char('Y'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, match_char('Y'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, match_char('Y'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); sb2.consume(sb2.size()); int i = boost::asio::async_read_until(s, sb2, match_char('Y'), archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); } void test_streambuf_async_read_until_match_condition() { #if !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_stream s(ioc); boost::asio::streambuf sb1; boost::asio::streambuf sb2(25); boost::system::error_code ec; std::size_t length; bool called; s.reset(read_data, sizeof(read_data)); ec = boost::system::error_code(); length = 0; called = false; sb1.consume(sb1.size()); boost::asio::async_read_until(s, sb1, match_char('Z'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); ec = boost::system::error_code(); length = 0; called = false; sb1.consume(sb1.size()); boost::asio::async_read_until(s, sb1, match_char('Z'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); ec = boost::system::error_code(); length = 0; called = false; sb1.consume(sb1.size()); boost::asio::async_read_until(s, sb1, match_char('Z'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 26); s.reset(read_data, sizeof(read_data)); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, match_char('Z'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, match_char('Z'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, match_char('Z'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(ec == boost::asio::error::not_found); BOOST_ASIO_CHECK(length == 0); s.reset(read_data, sizeof(read_data)); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, match_char('Y'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, match_char('Y'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); ec = boost::system::error_code(); length = 0; called = false; sb2.consume(sb2.size()); boost::asio::async_read_until(s, sb2, match_char('Y'), bindns::bind(async_read_handler, _1, &ec, _2, &length, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(length == 25); s.reset(read_data, sizeof(read_data)); sb2.consume(sb2.size()); int i = boost::asio::async_read_until(s, sb2, match_char('Y'), archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); #endif // !defined(BOOST_ASIO_NO_DYNAMIC_BUFFER_V1) } BOOST_ASIO_TEST_SUITE ( "read_until", BOOST_ASIO_TEST_CASE(test_dynamic_string_read_until_char) BOOST_ASIO_TEST_CASE(test_streambuf_read_until_char) BOOST_ASIO_TEST_CASE(test_dynamic_string_read_until_string) BOOST_ASIO_TEST_CASE(test_streambuf_read_until_string) BOOST_ASIO_TEST_CASE(test_dynamic_string_read_until_match_condition) BOOST_ASIO_TEST_CASE(test_streambuf_read_until_match_condition) BOOST_ASIO_TEST_CASE(test_dynamic_string_async_read_until_char) BOOST_ASIO_TEST_CASE(test_streambuf_async_read_until_char) BOOST_ASIO_TEST_CASE(test_dynamic_string_async_read_until_string) BOOST_ASIO_TEST_CASE(test_streambuf_async_read_until_string) BOOST_ASIO_TEST_CASE(test_dynamic_string_async_read_until_match_condition) BOOST_ASIO_TEST_CASE(test_streambuf_async_read_until_match_condition) )
cpp
asio
data/projects/asio/test/any_completion_handler.cpp
// // any_completion_handler.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/any_completion_handler.hpp> #include "unit_test.hpp" #include <functional> #include <boost/asio/bind_allocator.hpp> #include <boost/asio/bind_cancellation_slot.hpp> #include <boost/asio/bind_executor.hpp> #include <boost/asio/bind_immediate_executor.hpp> #include <boost/asio/error.hpp> #include <boost/asio/thread_pool.hpp> namespace bindns = std; void increment(int* count) { ++(*count); } void any_completion_handler_construction_test() { int count = 0; boost::asio::nullptr_t null_ptr = boost::asio::nullptr_t(); boost::asio::any_completion_handler<void()> h1; BOOST_ASIO_CHECK(!h1); BOOST_ASIO_CHECK(h1 == null_ptr); boost::asio::any_completion_handler<void()> h2(null_ptr); BOOST_ASIO_CHECK(!h2); BOOST_ASIO_CHECK(h2 == null_ptr); boost::asio::any_completion_handler<void()> h3( bindns::bind(&increment, &count)); BOOST_ASIO_CHECK(!!h3); BOOST_ASIO_CHECK(h3 != null_ptr); boost::asio::any_completion_handler<void()> h4(std::move(h1)); BOOST_ASIO_CHECK(!h4); BOOST_ASIO_CHECK(h4 == null_ptr); BOOST_ASIO_CHECK(!h1); BOOST_ASIO_CHECK(h1 == null_ptr); boost::asio::any_completion_handler<void()> h5(std::move(h3)); BOOST_ASIO_CHECK(!!h5); BOOST_ASIO_CHECK(h5 != null_ptr); BOOST_ASIO_CHECK(!h3); BOOST_ASIO_CHECK(h3 == null_ptr); boost::asio::any_completion_handler<void()> h6(std::move(h5)); BOOST_ASIO_CHECK(!!h6); BOOST_ASIO_CHECK(h6 != null_ptr); BOOST_ASIO_CHECK(!h5); BOOST_ASIO_CHECK(h5 == null_ptr); } void any_completion_handler_assignment_test() { int count = 0; boost::asio::nullptr_t null_ptr = boost::asio::nullptr_t(); boost::asio::any_completion_handler<void()> h1; boost::asio::any_completion_handler<void()> h2; h2 = null_ptr; BOOST_ASIO_CHECK(!h2); boost::asio::any_completion_handler<void()> h3; h3 = bindns::bind(&increment, &count); BOOST_ASIO_CHECK(!!h3); boost::asio::any_completion_handler<void()> h4; h4 = std::move(h1); BOOST_ASIO_CHECK(!h4); BOOST_ASIO_CHECK(!h1); h4 = std::move(h3); BOOST_ASIO_CHECK(!!h4); BOOST_ASIO_CHECK(!h3); } template <typename T> class handler_allocator { public: using value_type = T; explicit handler_allocator(int* count) : count_(count) { } template <typename U> handler_allocator(const handler_allocator<U>& other) noexcept : count_(other.count_) { } bool operator==(const handler_allocator& other) const noexcept { return &count_ == &other.count_; } bool operator!=(const handler_allocator& other) const noexcept { return &count_ != &other.count_; } T* allocate(std::size_t n) const { ++(*count_); return static_cast<T*>(::operator new(sizeof(T) * n)); } void deallocate(T* p, std::size_t /*n*/) const { ::operator delete(p); } private: template <typename> friend class handler_allocator; int* count_; }; class cancel_handler { public: explicit cancel_handler(int* count) : count_(count) { } void operator()(boost::asio::cancellation_type_t) { ++(*count_); } private: int* count_; }; void any_completion_handler_associator_test() { typedef boost::asio::any_completion_handler<void()> handler_type; int count = 0; int alloc_count = 0; int cancel_count = 0; boost::asio::thread_pool pool(1); boost::asio::cancellation_signal sig; boost::asio::any_completion_handler<void()> h1( boost::asio::bind_allocator(handler_allocator<char>(&alloc_count), boost::asio::bind_cancellation_slot(sig.slot(), boost::asio::bind_executor(pool.get_executor(), boost::asio::bind_immediate_executor(boost::asio::system_executor(), bindns::bind(&increment, &count)))))); BOOST_ASIO_CHECK(alloc_count == 1); BOOST_ASIO_REBIND_ALLOC(boost::asio::associated_allocator<handler_type>::type, char) alloc1(boost::asio::get_associated_allocator(h1)); alloc1.deallocate(alloc1.allocate(1), 1); BOOST_ASIO_CHECK(alloc_count == 2); boost::asio::associated_cancellation_slot<handler_type>::type slot1 = boost::asio::get_associated_cancellation_slot(h1); BOOST_ASIO_CHECK(slot1.is_connected()); slot1.emplace<cancel_handler>(&cancel_count); BOOST_ASIO_CHECK(cancel_count == 0); sig.emit(boost::asio::cancellation_type::terminal); BOOST_ASIO_CHECK(cancel_count == 1); boost::asio::associated_executor<handler_type>::type ex1 = boost::asio::get_associated_executor(h1); BOOST_ASIO_CHECK(ex1 == pool.get_executor()); boost::asio::associated_immediate_executor< handler_type, boost::asio::thread_pool::executor_type>::type ex2 = boost::asio::get_associated_immediate_executor(h1, pool.get_executor()); BOOST_ASIO_CHECK(ex2 == boost::asio::system_executor()); } void increment_with_error(boost::system::error_code ec, boost::system::error_code* out_ec, int* count) { *out_ec = ec; ++(*count); } void any_completion_handler_invocation_test() { int count = 0; boost::system::error_code ec; boost::asio::any_completion_handler<void()> h1( bindns::bind(&increment, &count)); BOOST_ASIO_CHECK(count == 0); std::move(h1)(); BOOST_ASIO_CHECK(count == 1); boost::asio::any_completion_handler<void(boost::system::error_code)> h2( bindns::bind(&increment_with_error, bindns::placeholders::_1, &ec, &count)); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(count == 1); std::move(h2)(boost::asio::error::eof); BOOST_ASIO_CHECK(ec == boost::asio::error::eof); BOOST_ASIO_CHECK(count == 2); } BOOST_ASIO_TEST_SUITE ( "any_completion_handler", BOOST_ASIO_TEST_CASE(any_completion_handler_construction_test) BOOST_ASIO_TEST_CASE(any_completion_handler_assignment_test) BOOST_ASIO_TEST_CASE(any_completion_handler_associator_test) BOOST_ASIO_TEST_CASE(any_completion_handler_invocation_test) )
cpp
asio
data/projects/asio/test/basic_socket_acceptor.cpp
// // basic_socket_acceptor.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/basic_socket_acceptor.hpp> #include "unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "basic_socket_acceptor", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/packaged_task.cpp
// // packaged_task.cpp // ~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/packaged_task.hpp> #include "unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "packaged_task", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/executor_work_guard.cpp
// // executor_work_guard.cpp // ~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/executor_work_guard.hpp> #include "unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "executor_work_guard", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/is_read_buffered.cpp
// // is_read_buffered.cpp // ~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/is_read_buffered.hpp> #include <boost/asio/buffered_read_stream.hpp> #include <boost/asio/buffered_write_stream.hpp> #include <boost/asio/io_context.hpp> #include <boost/asio/ip/tcp.hpp> #include "unit_test.hpp" using namespace std; // For memcmp, memcpy and memset. class test_stream { public: typedef boost::asio::io_context io_context_type; typedef test_stream lowest_layer_type; typedef io_context_type::executor_type executor_type; test_stream(boost::asio::io_context& io_context) : io_context_(io_context) { } io_context_type& io_context() { return io_context_; } lowest_layer_type& lowest_layer() { return *this; } template <typename Const_Buffers> size_t write(const Const_Buffers&) { return 0; } template <typename Const_Buffers> size_t write(const Const_Buffers&, boost::system::error_code& ec) { ec = boost::system::error_code(); return 0; } template <typename Const_Buffers, typename Handler> void async_write(const Const_Buffers&, Handler handler) { boost::system::error_code error; boost::asio::post(io_context_, boost::asio::detail::bind_handler(handler, error, 0)); } template <typename Mutable_Buffers> size_t read(const Mutable_Buffers&) { return 0; } template <typename Mutable_Buffers> size_t read(const Mutable_Buffers&, boost::system::error_code& ec) { ec = boost::system::error_code(); return 0; } template <typename Mutable_Buffers, typename Handler> void async_read(const Mutable_Buffers&, Handler handler) { boost::system::error_code error; boost::asio::post(io_context_, boost::asio::detail::bind_handler(handler, error, 0)); } private: io_context_type& io_context_; }; void is_read_buffered_test() { BOOST_ASIO_CHECK(!boost::asio::is_read_buffered< boost::asio::ip::tcp::socket>::value); BOOST_ASIO_CHECK(!!boost::asio::is_read_buffered< boost::asio::buffered_read_stream< boost::asio::ip::tcp::socket> >::value); BOOST_ASIO_CHECK(!boost::asio::is_read_buffered< boost::asio::buffered_write_stream< boost::asio::ip::tcp::socket> >::value); BOOST_ASIO_CHECK(!!boost::asio::is_read_buffered< boost::asio::buffered_stream<boost::asio::ip::tcp::socket> >::value); BOOST_ASIO_CHECK(!boost::asio::is_read_buffered<test_stream>::value); BOOST_ASIO_CHECK(!!boost::asio::is_read_buffered< boost::asio::buffered_read_stream<test_stream> >::value); BOOST_ASIO_CHECK(!boost::asio::is_read_buffered< boost::asio::buffered_write_stream<test_stream> >::value); BOOST_ASIO_CHECK(!!boost::asio::is_read_buffered< boost::asio::buffered_stream<test_stream> >::value); } BOOST_ASIO_TEST_SUITE ( "is_read_buffered", BOOST_ASIO_TEST_CASE(is_read_buffered_test) )
cpp
asio
data/projects/asio/test/buffers_iterator.cpp
// // buffers_iterator.cpp // ~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/buffers_iterator.hpp> #include <array> #include <boost/asio/buffer.hpp> #include "unit_test.hpp" //------------------------------------------------------------------------------ // buffers_iterator_compile test // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // The following test checks that all operations on the buffers_iterator compile // and link correctly. Runtime failures are ignored. namespace buffers_iterator_compile { using std::array; using std::vector; using namespace boost::asio; void test() { try { char data1[16], data2[16]; const char cdata1[16] = "", cdata2[16] = ""; mutable_buffer mb1 = buffer(data1); array<mutable_buffer, 2> mb2 = {{ buffer(data1), buffer(data2) }}; std::vector<mutable_buffer> mb3; mb3.push_back(buffer(data1)); const_buffer cb1 = buffer(cdata1); array<const_buffer, 2> cb2 = {{ buffer(cdata1), buffer(cdata2) }}; vector<const_buffer> cb3; cb3.push_back(buffer(cdata1)); // buffers_iterator constructors. buffers_iterator<mutable_buffer, char> bi1; buffers_iterator<mutable_buffer, const char> bi2; buffers_iterator<array<mutable_buffer, 2>, char> bi3; buffers_iterator<array<mutable_buffer, 2>, const char> bi4; buffers_iterator<vector<mutable_buffer>, char> bi5; buffers_iterator<vector<mutable_buffer>, const char> bi6; buffers_iterator<const_buffer, char> bi7; buffers_iterator<const_buffer, const char> bi8; buffers_iterator<array<const_buffer, 2>, char> bi9; buffers_iterator<array<const_buffer, 2>, const char> bi10; buffers_iterator<vector<const_buffer>, char> bi11; buffers_iterator<vector<const_buffer>, const char> bi12; buffers_iterator<mutable_buffer, char> bi13( buffers_iterator<mutable_buffer, char>::begin(mb1)); buffers_iterator<mutable_buffer, const char> bi14( buffers_iterator<mutable_buffer, const char>::begin(mb1)); buffers_iterator<array<mutable_buffer, 2>, char> bi15( buffers_iterator<array<mutable_buffer, 2>, char>::begin(mb2)); buffers_iterator<array<mutable_buffer, 2>, const char> bi16( buffers_iterator<array<mutable_buffer, 2>, const char>::begin(mb2)); buffers_iterator<vector<mutable_buffer>, char> bi17( buffers_iterator<vector<mutable_buffer>, char>::begin(mb3)); buffers_iterator<vector<mutable_buffer>, const char> bi18( buffers_iterator<vector<mutable_buffer>, const char>::begin(mb3)); buffers_iterator<const_buffer, char> bi19( buffers_iterator<const_buffer, char>::begin(cb1)); buffers_iterator<const_buffer, const char> bi20( buffers_iterator<const_buffer, const char>::begin(cb1)); buffers_iterator<array<const_buffer, 2>, char> bi21( buffers_iterator<array<const_buffer, 2>, char>::begin(cb2)); buffers_iterator<array<const_buffer, 2>, const char> bi22( buffers_iterator<array<const_buffer, 2>, const char>::begin(cb2)); buffers_iterator<vector<const_buffer>, char> bi23( buffers_iterator<vector<const_buffer>, char>::begin(cb3)); buffers_iterator<vector<const_buffer>, const char> bi24( buffers_iterator<vector<const_buffer>, const char>::begin(cb3)); // buffers_iterator member functions. bi1 = buffers_iterator<mutable_buffer, char>::begin(mb1); bi2 = buffers_iterator<mutable_buffer, const char>::begin(mb1); bi3 = buffers_iterator<array<mutable_buffer, 2>, char>::begin(mb2); bi4 = buffers_iterator<array<mutable_buffer, 2>, const char>::begin(mb2); bi5 = buffers_iterator<vector<mutable_buffer>, char>::begin(mb3); bi6 = buffers_iterator<vector<mutable_buffer>, const char>::begin(mb3); bi7 = buffers_iterator<const_buffer, char>::begin(cb1); bi8 = buffers_iterator<const_buffer, const char>::begin(cb1); bi9 = buffers_iterator<array<const_buffer, 2>, char>::begin(cb2); bi10 = buffers_iterator<array<const_buffer, 2>, const char>::begin(cb2); bi11 = buffers_iterator<vector<const_buffer>, char>::begin(cb3); bi12 = buffers_iterator<vector<const_buffer>, const char>::begin(cb3); bi1 = buffers_iterator<mutable_buffer, char>::end(mb1); bi2 = buffers_iterator<mutable_buffer, const char>::end(mb1); bi3 = buffers_iterator<array<mutable_buffer, 2>, char>::end(mb2); bi4 = buffers_iterator<array<mutable_buffer, 2>, const char>::end(mb2); bi5 = buffers_iterator<vector<mutable_buffer>, char>::end(mb3); bi6 = buffers_iterator<vector<mutable_buffer>, const char>::end(mb3); bi7 = buffers_iterator<const_buffer, char>::end(cb1); bi8 = buffers_iterator<const_buffer, const char>::end(cb1); bi9 = buffers_iterator<array<const_buffer, 2>, char>::end(cb2); bi10 = buffers_iterator<array<const_buffer, 2>, const char>::end(cb2); bi11 = buffers_iterator<vector<const_buffer>, char>::end(cb3); bi12 = buffers_iterator<vector<const_buffer>, const char>::end(cb3); // buffers_iterator related functions. bi1 = buffers_begin(mb1); bi3 = buffers_begin(mb2); bi5 = buffers_begin(mb3); bi7 = buffers_begin(cb1); bi9 = buffers_begin(cb2); bi11 = buffers_begin(cb3); bi1 = buffers_end(mb1); bi3 = buffers_end(mb2); bi5 = buffers_end(mb3); bi7 = buffers_end(cb1); bi9 = buffers_end(cb2); bi11 = buffers_end(cb3); // RandomAccessIterator operations. --bi1; --bi2; --bi3; --bi4; --bi5; --bi6; --bi7; --bi8; --bi9; --bi10; --bi11; --bi12; ++bi1; ++bi2; ++bi3; ++bi4; ++bi5; ++bi6; ++bi7; ++bi8; ++bi9; ++bi10; ++bi11; ++bi12; bi1--; bi2--; bi3--; bi4--; bi5--; bi6--; bi7--; bi8--; bi9--; bi10--; bi11--; bi12--; bi1++; bi2++; bi3++; bi4++; bi5++; bi6++; bi7++; bi8++; bi9++; bi10++; bi11++; bi12++; bi1 -= 1; bi2 -= 1; bi3 -= 1; bi4 -= 1; bi5 -= 1; bi6 -= 1; bi7 -= 1; bi8 -= 1; bi9 -= 1; bi10 -= 1; bi11 -= 1; bi12 -= 1; bi1 += 1; bi2 += 1; bi3 += 1; bi4 += 1; bi5 += 1; bi6 += 1; bi7 += 1; bi8 += 1; bi9 += 1; bi10 += 1; bi11 += 1; bi12 += 1; bi1 = bi1 - 1; bi2 = bi2 - 1; bi3 = bi3 - 1; bi4 = bi4 - 1; bi5 = bi5 - 1; bi6 = bi6 - 1; bi7 = bi7 - 1; bi8 = bi8 - 1; bi9 = bi9 - 1; bi10 = bi10 - 1; bi11 = bi11 - 1; bi12 = bi12 - 1; bi1 = bi1 + 1; bi2 = bi2 + 1; bi3 = bi3 + 1; bi4 = bi4 + 1; bi5 = bi5 + 1; bi6 = bi6 + 1; bi7 = bi7 + 1; bi8 = bi8 + 1; bi9 = bi9 + 1; bi10 = bi10 + 1; bi11 = bi11 + 1; bi12 = bi12 + 1; bi1 = (-1) + bi1; bi2 = (-1) + bi2; bi3 = (-1) + bi3; bi4 = (-1) + bi4; bi5 = (-1) + bi5; bi6 = (-1) + bi6; bi7 = (-1) + bi7; bi8 = (-1) + bi8; bi9 = (-1) + bi9; bi10 = (-1) + bi10; bi11 = (-1) + bi11; bi12 = (-1) + bi12; (void)static_cast<std::ptrdiff_t>(bi13 - bi1); (void)static_cast<std::ptrdiff_t>(bi14 - bi2); (void)static_cast<std::ptrdiff_t>(bi15 - bi3); (void)static_cast<std::ptrdiff_t>(bi16 - bi4); (void)static_cast<std::ptrdiff_t>(bi17 - bi5); (void)static_cast<std::ptrdiff_t>(bi18 - bi6); (void)static_cast<std::ptrdiff_t>(bi19 - bi7); (void)static_cast<std::ptrdiff_t>(bi20 - bi8); (void)static_cast<std::ptrdiff_t>(bi21 - bi9); (void)static_cast<std::ptrdiff_t>(bi22 - bi10); (void)static_cast<std::ptrdiff_t>(bi23 - bi11); (void)static_cast<std::ptrdiff_t>(bi24 - bi12); } catch (std::exception&) { } } } // namespace buffers_iterator_compile //------------------------------------------------------------------------------ BOOST_ASIO_TEST_SUITE ( "buffers_iterator", BOOST_ASIO_COMPILE_TEST_CASE(buffers_iterator_compile::test) )
cpp
asio
data/projects/asio/test/read_at.cpp
// // read_at.cpp // ~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/read_at.hpp> #include <array> #include <cstring> #include <functional> #include "archetypes/async_result.hpp" #include <boost/asio/io_context.hpp> #include <boost/asio/post.hpp> #include <boost/asio/streambuf.hpp> #include "unit_test.hpp" #if defined(BOOST_ASIO_HAS_BOOST_ARRAY) #include <boost/array.hpp> #endif // defined(BOOST_ASIO_HAS_BOOST_ARRAY) using namespace std; // For memcmp, memcpy and memset. class test_random_access_device { public: typedef boost::asio::io_context::executor_type executor_type; test_random_access_device(boost::asio::io_context& io_context) : io_context_(io_context), length_(0), next_read_length_(0) { } executor_type get_executor() noexcept { return io_context_.get_executor(); } void reset(const void* data, size_t length) { BOOST_ASIO_CHECK(length <= max_length); length_ = 0; while (length_ + length < max_length) { memcpy(data_ + length_, data, length); length_ += length; } next_read_length_ = length; } void next_read_length(size_t length) { next_read_length_ = length; } template <typename Iterator> bool check_buffers(boost::asio::uint64_t offset, Iterator begin, Iterator end, size_t length) { if (offset + length > max_length) return false; Iterator iter = begin; size_t checked_length = 0; for (; iter != end && checked_length < length; ++iter) { size_t buffer_length = boost::asio::buffer_size(*iter); if (buffer_length > length - checked_length) buffer_length = length - checked_length; if (memcmp(data_ + offset + checked_length, iter->data(), buffer_length) != 0) return false; checked_length += buffer_length; } return true; } template <typename Const_Buffers> bool check_buffers(boost::asio::uint64_t offset, const Const_Buffers& buffers, size_t length) { return check_buffers(offset, boost::asio::buffer_sequence_begin(buffers), boost::asio::buffer_sequence_end(buffers), length); } template <typename Mutable_Buffers> size_t read_some_at(boost::asio::uint64_t offset, const Mutable_Buffers& buffers) { return boost::asio::buffer_copy(buffers, boost::asio::buffer(data_, length_) + offset, next_read_length_); } template <typename Mutable_Buffers> size_t read_some_at(boost::asio::uint64_t offset, const Mutable_Buffers& buffers, boost::system::error_code& ec) { ec = boost::system::error_code(); return read_some_at(offset, buffers); } template <typename Mutable_Buffers, typename Handler> void async_read_some_at(boost::asio::uint64_t offset, const Mutable_Buffers& buffers, Handler&& handler) { size_t bytes_transferred = read_some_at(offset, buffers); boost::asio::post(get_executor(), boost::asio::detail::bind_handler( static_cast<Handler&&>(handler), boost::system::error_code(), bytes_transferred)); } private: boost::asio::io_context& io_context_; enum { max_length = 8192 }; char data_[max_length]; size_t length_; size_t next_read_length_; }; static const char read_data[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; void test_3_arg_mutable_buffer_read_at() { boost::asio::io_context ioc; test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; boost::asio::mutable_buffer buffers = boost::asio::buffer(read_buf, sizeof(read_buf)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); size_t bytes_transferred = boost::asio::read_at(s, 0, buffers); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); } void test_3_arg_vector_buffers_read_at() { boost::asio::io_context ioc; test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; std::vector<boost::asio::mutable_buffer> buffers; buffers.push_back(boost::asio::buffer(read_buf, 32)); buffers.push_back(boost::asio::buffer(read_buf) + 32); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); size_t bytes_transferred = boost::asio::read_at(s, 0, buffers); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); } void test_3_arg_streambuf_read_at() { boost::asio::io_context ioc; test_random_access_device s(ioc); boost::asio::streambuf sb(sizeof(read_data)); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); size_t bytes_transferred = boost::asio::read_at(s, 0, sb); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); } void test_4_arg_nothrow_mutable_buffer_read_at() { boost::asio::io_context ioc; test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; boost::asio::mutable_buffer buffers = boost::asio::buffer(read_buf, sizeof(read_buf)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); boost::system::error_code error; size_t bytes_transferred = boost::asio::read_at(s, 0, buffers, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); } void test_4_arg_nothrow_vector_buffers_read_at() { boost::asio::io_context ioc; test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; std::vector<boost::asio::mutable_buffer> buffers; buffers.push_back(boost::asio::buffer(read_buf, 32)); buffers.push_back(boost::asio::buffer(read_buf) + 32); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); boost::system::error_code error; size_t bytes_transferred = boost::asio::read_at(s, 0, buffers, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); } void test_4_arg_nothrow_streambuf_read_at() { boost::asio::io_context ioc; test_random_access_device s(ioc); boost::asio::streambuf sb(sizeof(read_data)); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); boost::system::error_code error; size_t bytes_transferred = boost::asio::read_at(s, 0, sb, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); } bool old_style_transfer_all(const boost::system::error_code& ec, size_t /*bytes_transferred*/) { return !!ec; } struct short_transfer { short_transfer() {} short_transfer(short_transfer&&) {} size_t operator()(const boost::system::error_code& ec, size_t /*bytes_transferred*/) { return !!ec ? 0 : 3; } }; void test_4_arg_mutable_buffer_read_at() { boost::asio::io_context ioc; test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; boost::asio::mutable_buffer buffers = boost::asio::buffer(read_buf, sizeof(read_buf)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); size_t bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == 50); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 50)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == 50); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 50)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); } void test_4_arg_vector_buffers_read_at() { boost::asio::io_context ioc; test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; std::vector<boost::asio::mutable_buffer> buffers; buffers.push_back(boost::asio::buffer(read_buf, 32)); buffers.push_back(boost::asio::buffer(read_buf) + 32); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); size_t bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == 50); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 50)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == 50); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 50)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); } void test_4_arg_streambuf_read_at() { boost::asio::io_context ioc; test_random_access_device s(ioc); boost::asio::streambuf sb(sizeof(read_data)); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); size_t bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_all()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(sb.size() == 1); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(sb.size() == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_at_least(1)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 10)); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_at_least(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 10)); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(sb.size() == 42); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(sb.size() == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == 50); BOOST_ASIO_CHECK(sb.size() == 50); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 50)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_at_least(42)); BOOST_ASIO_CHECK(bytes_transferred == 50); BOOST_ASIO_CHECK(sb.size() == 50); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 50)); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(sb.size() == 1); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 1)); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(sb.size() == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(sb.size() == 1); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(sb.size() == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(sb.size() == 1); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_exactly(1)); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(sb.size() == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 1)); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 10)); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_exactly(10)); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 10)); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(sb.size() == 42); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 42)); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(sb.size() == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(sb.size() == 42); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(sb.size() == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(sb.size() == 42); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_exactly(42)); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(sb.size() == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 42)); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, old_style_transfer_all); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, short_transfer()); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); } void test_5_arg_mutable_buffer_read_at() { boost::asio::io_context ioc; test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; boost::asio::mutable_buffer buffers = boost::asio::buffer(read_buf, sizeof(read_buf)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); boost::system::error_code error; size_t bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == 50); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 50)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == 50); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 50)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); } void test_5_arg_vector_buffers_read_at() { boost::asio::io_context ioc; test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; std::vector<boost::asio::mutable_buffer> buffers; buffers.push_back(boost::asio::buffer(read_buf, 32)); buffers.push_back(boost::asio::buffer(read_buf) + 32); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); boost::system::error_code error; size_t bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == 50); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 50)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == 50); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 50)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 0, buffers, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bytes_transferred = boost::asio::read_at(s, 1234, buffers, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, buffers, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, buffers, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); BOOST_ASIO_CHECK(!error); } void test_5_arg_streambuf_read_at() { boost::asio::io_context ioc; test_random_access_device s(ioc); boost::asio::streambuf sb(sizeof(read_data)); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); boost::system::error_code error; size_t bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_all(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(sb.size() == 1); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 1)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(sb.size() == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 1)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_at_least(1), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_at_least(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(sb.size() == 42); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 42)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(sb.size() == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 42)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == 50); BOOST_ASIO_CHECK(sb.size() == 50); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 50)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_at_least(42), error); BOOST_ASIO_CHECK(bytes_transferred == 50); BOOST_ASIO_CHECK(sb.size() == 50); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 50)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(sb.size() == 1); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 1)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(sb.size() == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 1)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(sb.size() == 1); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 1)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(sb.size() == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 1)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(sb.size() == 1); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 1)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_exactly(1), error); BOOST_ASIO_CHECK(bytes_transferred == 1); BOOST_ASIO_CHECK(sb.size() == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 1)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_exactly(10), error); BOOST_ASIO_CHECK(bytes_transferred == 10); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 10)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(sb.size() == 42); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 42)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(sb.size() == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 42)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(sb.size() == 42); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 42)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(sb.size() == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 42)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, sb, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(sb.size() == 42); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 42)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, sb, boost::asio::transfer_exactly(42), error); BOOST_ASIO_CHECK(bytes_transferred == 42); BOOST_ASIO_CHECK(sb.size() == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 42)); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, sb, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, sb, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, sb, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, sb, old_style_transfer_all, error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 0, sb, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bytes_transferred = boost::asio::read_at(s, 1234, sb, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, sb, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, sb, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 0, sb, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); error = boost::system::error_code(); bytes_transferred = boost::asio::read_at(s, 1234, sb, short_transfer(), error); BOOST_ASIO_CHECK(bytes_transferred == sizeof(read_data)); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); BOOST_ASIO_CHECK(!error); } void async_read_handler(const boost::system::error_code& e, size_t bytes_transferred, size_t expected_bytes_transferred, bool* called) { *called = true; BOOST_ASIO_CHECK(!e); BOOST_ASIO_CHECK(bytes_transferred == expected_bytes_transferred); } void test_4_arg_mutable_buffer_async_read_at() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; boost::asio::mutable_buffer buffers = boost::asio::buffer(read_buf, sizeof(read_buf)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bool called = false; boost::asio::async_read_at(s, 0, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); int i = boost::asio::async_read_at(s, 1234, buffers, archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); } void test_4_arg_boost_array_buffers_async_read_at() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; #if defined(BOOST_ASIO_HAS_BOOST_ARRAY) boost::asio::io_context ioc; test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; boost::array<boost::asio::mutable_buffer, 2> buffers = { { boost::asio::buffer(read_buf, 32), boost::asio::buffer(read_buf) + 32 } }; s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bool called = false; boost::asio::async_read_at(s, 0, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); int i = boost::asio::async_read_at(s, 1234, buffers, archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); #endif // defined(BOOST_ASIO_HAS_BOOST_ARRAY) } void test_4_arg_std_array_buffers_async_read_at() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; std::array<boost::asio::mutable_buffer, 2> buffers = { { boost::asio::buffer(read_buf, 32), boost::asio::buffer(read_buf) + 32 } }; s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bool called = false; boost::asio::async_read_at(s, 0, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); int i = boost::asio::async_read_at(s, 1234, buffers, archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); } void test_4_arg_vector_buffers_async_read_at() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; std::vector<boost::asio::mutable_buffer> buffers; buffers.push_back(boost::asio::buffer(read_buf, 32)); buffers.push_back(boost::asio::buffer(read_buf) + 32); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bool called = false; boost::asio::async_read_at(s, 0, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); int i = boost::asio::async_read_at(s, 1234, buffers, archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); } void test_4_arg_streambuf_async_read_at() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_random_access_device s(ioc); boost::asio::streambuf sb(sizeof(read_data)); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bool called = false; boost::asio::async_read_at(s, 0, sb, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); int i = boost::asio::async_read_at(s, 1234, sb, archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); } void test_5_arg_mutable_buffer_async_read_at() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; boost::asio::mutable_buffer buffers = boost::asio::buffer(read_buf, sizeof(read_buf)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bool called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 50)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 50)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); int i = boost::asio::async_read_at(s, 1234, buffers, short_transfer(), archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); } void test_5_arg_boost_array_buffers_async_read_at() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; #if defined(BOOST_ASIO_HAS_BOOST_ARRAY) boost::asio::io_context ioc; test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; boost::array<boost::asio::mutable_buffer, 2> buffers = { { boost::asio::buffer(read_buf, 32), boost::asio::buffer(read_buf) + 32 } }; s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bool called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 50)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 50)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); int i = boost::asio::async_read_at(s, 1234, buffers, short_transfer(), archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); #endif // defined(BOOST_ASIO_HAS_BOOST_ARRAY) } void test_5_arg_std_array_buffers_async_read_at() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; std::array<boost::asio::mutable_buffer, 2> buffers = { { boost::asio::buffer(read_buf, 32), boost::asio::buffer(read_buf) + 32 } }; s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bool called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 50)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 50)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); int i = boost::asio::async_read_at(s, 1234, buffers, short_transfer(), archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); } void test_5_arg_vector_buffers_async_read_at() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_random_access_device s(ioc); char read_buf[sizeof(read_data)]; std::vector<boost::asio::mutable_buffer> buffers; buffers.push_back(boost::asio::buffer(read_buf, 32)); buffers.push_back(boost::asio::buffer(read_buf) + 32); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); bool called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 50)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 50)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 1)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 10)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, 42)); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 0, buffers, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(0, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); memset(read_buf, 0, sizeof(read_buf)); called = false; boost::asio::async_read_at(s, 1234, buffers, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); s.reset(read_data, sizeof(read_data)); memset(read_buf, 0, sizeof(read_buf)); int i = boost::asio::async_read_at(s, 1234, buffers, short_transfer(), archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(s.check_buffers(1234, buffers, sizeof(read_data))); } void test_5_arg_streambuf_async_read_at() { namespace bindns = std; using bindns::placeholders::_1; using bindns::placeholders::_2; boost::asio::io_context ioc; test_random_access_device s(ioc); boost::asio::streambuf sb(sizeof(read_data)); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); bool called = false; boost::asio::async_read_at(s, 0, sb, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, boost::asio::transfer_all(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 1); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, boost::asio::transfer_at_least(1), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 10)); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, boost::asio::transfer_at_least(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 10)); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 42); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 50); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 50)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, boost::asio::transfer_at_least(42), bindns::bind(async_read_handler, _1, _2, 50, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 50); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 50)); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 1); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 1)); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 1); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 1); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 1)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, boost::asio::transfer_exactly(1), bindns::bind(async_read_handler, _1, _2, 1, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 1); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 1)); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 10)); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 10)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, boost::asio::transfer_exactly(10), bindns::bind(async_read_handler, _1, _2, 10, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 10); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 10)); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 42); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 42)); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 42); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 42); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), 42)); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, boost::asio::transfer_exactly(42), bindns::bind(async_read_handler, _1, _2, 42, &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == 42); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), 42)); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, old_style_transfer_all, bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(1); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 0, sb, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(0, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); s.next_read_length(10); sb.consume(sb.size()); called = false; boost::asio::async_read_at(s, 1234, sb, short_transfer(), bindns::bind(async_read_handler, _1, _2, sizeof(read_data), &called)); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(sb.size() == sizeof(read_data)); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); s.reset(read_data, sizeof(read_data)); sb.consume(sb.size()); int i = boost::asio::async_read_at(s, 1234, sb, short_transfer(), archetypes::lazy_handler()); BOOST_ASIO_CHECK(i == 42); ioc.restart(); ioc.run(); BOOST_ASIO_CHECK(s.check_buffers(1234, sb.data(), sizeof(read_data))); } BOOST_ASIO_TEST_SUITE ( "read_at", BOOST_ASIO_TEST_CASE(test_3_arg_mutable_buffer_read_at) BOOST_ASIO_TEST_CASE(test_3_arg_vector_buffers_read_at) BOOST_ASIO_TEST_CASE(test_3_arg_streambuf_read_at) BOOST_ASIO_TEST_CASE(test_4_arg_nothrow_mutable_buffer_read_at) BOOST_ASIO_TEST_CASE(test_4_arg_nothrow_vector_buffers_read_at) BOOST_ASIO_TEST_CASE(test_4_arg_nothrow_streambuf_read_at) BOOST_ASIO_TEST_CASE(test_4_arg_mutable_buffer_read_at) BOOST_ASIO_TEST_CASE(test_4_arg_vector_buffers_read_at) BOOST_ASIO_TEST_CASE(test_4_arg_streambuf_read_at) BOOST_ASIO_TEST_CASE(test_5_arg_mutable_buffer_read_at) BOOST_ASIO_TEST_CASE(test_5_arg_vector_buffers_read_at) BOOST_ASIO_TEST_CASE(test_5_arg_streambuf_read_at) BOOST_ASIO_TEST_CASE(test_4_arg_mutable_buffer_async_read_at) BOOST_ASIO_TEST_CASE(test_4_arg_boost_array_buffers_async_read_at) BOOST_ASIO_TEST_CASE(test_4_arg_std_array_buffers_async_read_at) BOOST_ASIO_TEST_CASE(test_4_arg_vector_buffers_async_read_at) BOOST_ASIO_TEST_CASE(test_4_arg_streambuf_async_read_at) BOOST_ASIO_TEST_CASE(test_5_arg_mutable_buffer_async_read_at) BOOST_ASIO_TEST_CASE(test_5_arg_boost_array_buffers_async_read_at) BOOST_ASIO_TEST_CASE(test_5_arg_std_array_buffers_async_read_at) BOOST_ASIO_TEST_CASE(test_5_arg_vector_buffers_async_read_at) BOOST_ASIO_TEST_CASE(test_5_arg_streambuf_async_read_at) )
cpp
asio
data/projects/asio/test/any_io_executor.cpp
// // any_io_executor.cpp // ~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/any_io_executor.hpp> #include <cstring> #include <functional> #include <boost/asio/system_executor.hpp> #include <boost/asio/thread_pool.hpp> #include "unit_test.hpp" using namespace boost::asio; namespace bindns = std; static bool next_nothrow_new_fails = false; void* operator new(std::size_t n, const std::nothrow_t&) noexcept { if (next_nothrow_new_fails) { next_nothrow_new_fails = false; return 0; } return ::operator new(n); } struct fat_executor { fat_executor(int id) : id_(id) { std::memset(data_, 0, sizeof(data_)); } template <typename F> void execute(const F&) const { } execution_context& query(execution::context_t) const noexcept { return boost::asio::query(system_executor(), execution::context); } constexpr static execution::blocking_t::never_t query( execution::blocking_t) noexcept { return execution::blocking.never; } friend bool operator==(const fat_executor& a, const fat_executor& b) noexcept { return a.id_ == b.id_; } friend bool operator!=(const fat_executor& a, const fat_executor& b) noexcept { return a.id_ != b.id_; } int id_; unsigned char data_[1024]; }; namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) template <typename F> struct execute_member<fat_executor, F> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = false; typedef void result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) template <> struct query_member<fat_executor, execution::context_t> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef execution_context& result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT) template <typename Property> struct query_static_constexpr_member<fat_executor, Property, typename boost::asio::enable_if< boost::asio::is_convertible< Property, boost::asio::execution::blocking_t >::value >::type > { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef execution::blocking_t::never_t result_type; static constexpr result_type value() noexcept { return result_type(); } }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) template <> struct equality_comparable<fat_executor> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) } // namespace traits } // namespace asio } // namespace boost void increment(int* count) { ++(*count); } void any_io_executor_construction_test() { thread_pool pool(1); boost::asio::nullptr_t null_ptr = boost::asio::nullptr_t(); boost::asio::any_io_executor ex1; BOOST_ASIO_CHECK(ex1.target<void>() == 0); BOOST_ASIO_CHECK(ex1 == null_ptr); boost::asio::any_io_executor ex2(null_ptr); BOOST_ASIO_CHECK(ex2.target<void>() == 0); BOOST_ASIO_CHECK(ex2 == null_ptr); BOOST_ASIO_CHECK(ex2 == ex1); boost::asio::any_io_executor ex3(pool.executor()); BOOST_ASIO_CHECK(ex3.target<void>() != 0); BOOST_ASIO_CHECK(ex3 != null_ptr); BOOST_ASIO_CHECK(ex3 != ex1); boost::asio::any_io_executor ex4(ex1); BOOST_ASIO_CHECK(ex4.target<void>() == 0); BOOST_ASIO_CHECK(ex4 == null_ptr); BOOST_ASIO_CHECK(ex4 == ex1); boost::asio::any_io_executor ex5(ex3); BOOST_ASIO_CHECK(ex5.target<void>() != 0); BOOST_ASIO_CHECK(ex5 != null_ptr); BOOST_ASIO_CHECK(ex5 == ex3); boost::asio::any_io_executor ex6 = fat_executor(1); BOOST_ASIO_CHECK(ex6.target<void>() != 0); BOOST_ASIO_CHECK(ex6 != null_ptr); BOOST_ASIO_CHECK(ex6 != ex1); boost::asio::any_io_executor ex7 = fat_executor(1); BOOST_ASIO_CHECK(ex7.target<void>() != 0); BOOST_ASIO_CHECK(ex7 != null_ptr); BOOST_ASIO_CHECK(ex7 != ex1); BOOST_ASIO_CHECK(ex7 == ex6); boost::asio::any_io_executor ex8 = fat_executor(2); BOOST_ASIO_CHECK(ex8.target<void>() != 0); BOOST_ASIO_CHECK(ex8 != null_ptr); BOOST_ASIO_CHECK(ex8 != ex1); BOOST_ASIO_CHECK(ex8 != ex6); BOOST_ASIO_CHECK(ex8 != ex7); boost::asio::any_io_executor ex9(ex6); BOOST_ASIO_CHECK(ex9.target<void>() != 0); BOOST_ASIO_CHECK(ex9 != null_ptr); BOOST_ASIO_CHECK(ex9 != ex1); BOOST_ASIO_CHECK(ex9 == ex6); BOOST_ASIO_CHECK(ex9 == ex7); BOOST_ASIO_CHECK(ex9 != ex8); boost::asio::any_io_executor ex10(std::move(ex1)); BOOST_ASIO_CHECK(ex10.target<void>() == 0); BOOST_ASIO_CHECK(ex10 == null_ptr); BOOST_ASIO_CHECK(ex1.target<void>() == 0); BOOST_ASIO_CHECK(ex1 == null_ptr); boost::asio::any_io_executor ex11(std::move(ex3)); BOOST_ASIO_CHECK(ex11.target<void>() != 0); BOOST_ASIO_CHECK(ex11 != null_ptr); BOOST_ASIO_CHECK(ex3.target<void>() == 0); BOOST_ASIO_CHECK(ex3 == null_ptr); BOOST_ASIO_CHECK(ex11 == ex5); boost::asio::any_io_executor ex12(std::move(ex7)); BOOST_ASIO_CHECK(ex12.target<void>() != 0); BOOST_ASIO_CHECK(ex12 != null_ptr); BOOST_ASIO_CHECK(ex7.target<void>() == 0); BOOST_ASIO_CHECK(ex7 == null_ptr); BOOST_ASIO_CHECK(ex12 == ex6); BOOST_ASIO_CHECK(ex12 != ex8); } void any_io_executor_nothrow_construction_test() { thread_pool pool(1); boost::asio::nullptr_t null_ptr = boost::asio::nullptr_t(); boost::asio::any_io_executor ex1; BOOST_ASIO_CHECK(ex1.target<void>() == 0); BOOST_ASIO_CHECK(ex1 == null_ptr); boost::asio::any_io_executor ex2(null_ptr); BOOST_ASIO_CHECK(ex2.target<void>() == 0); BOOST_ASIO_CHECK(ex2 == null_ptr); BOOST_ASIO_CHECK(ex2 == ex1); boost::asio::any_io_executor ex3(std::nothrow, pool.executor()); BOOST_ASIO_CHECK(ex3.target<void>() != 0); BOOST_ASIO_CHECK(ex3 != null_ptr); BOOST_ASIO_CHECK(ex3 != ex1); boost::asio::any_io_executor ex4(std::nothrow, ex1); BOOST_ASIO_CHECK(ex4.target<void>() == 0); BOOST_ASIO_CHECK(ex4 == null_ptr); BOOST_ASIO_CHECK(ex4 == ex1); boost::asio::any_io_executor ex5(std::nothrow, ex3); BOOST_ASIO_CHECK(ex5.target<void>() != 0); BOOST_ASIO_CHECK(ex5 != null_ptr); BOOST_ASIO_CHECK(ex5 == ex3); boost::asio::any_io_executor ex6(std::nothrow, fat_executor(1)); BOOST_ASIO_CHECK(ex6.target<void>() != 0); BOOST_ASIO_CHECK(ex6 != null_ptr); BOOST_ASIO_CHECK(ex6 != ex1); boost::asio::any_io_executor ex7(std::nothrow, fat_executor(1)); BOOST_ASIO_CHECK(ex7.target<void>() != 0); BOOST_ASIO_CHECK(ex7 != null_ptr); BOOST_ASIO_CHECK(ex7 != ex1); BOOST_ASIO_CHECK(ex7 == ex6); boost::asio::any_io_executor ex8(std::nothrow, fat_executor(2)); BOOST_ASIO_CHECK(ex8.target<void>() != 0); BOOST_ASIO_CHECK(ex8 != null_ptr); BOOST_ASIO_CHECK(ex8 != ex1); BOOST_ASIO_CHECK(ex8 != ex6); BOOST_ASIO_CHECK(ex8 != ex7); boost::asio::any_io_executor ex9(std::nothrow, ex6); BOOST_ASIO_CHECK(ex9.target<void>() != 0); BOOST_ASIO_CHECK(ex9 != null_ptr); BOOST_ASIO_CHECK(ex9 != ex1); BOOST_ASIO_CHECK(ex9 == ex6); BOOST_ASIO_CHECK(ex9 == ex7); BOOST_ASIO_CHECK(ex9 != ex8); boost::asio::any_io_executor ex10(std::nothrow, std::move(ex1)); BOOST_ASIO_CHECK(ex10.target<void>() == 0); BOOST_ASIO_CHECK(ex10 == null_ptr); BOOST_ASIO_CHECK(ex1.target<void>() == 0); BOOST_ASIO_CHECK(ex1 == null_ptr); boost::asio::any_io_executor ex11(std::nothrow, std::move(ex3)); BOOST_ASIO_CHECK(ex11.target<void>() != 0); BOOST_ASIO_CHECK(ex11 != null_ptr); BOOST_ASIO_CHECK(ex3.target<void>() == 0); BOOST_ASIO_CHECK(ex3 == null_ptr); BOOST_ASIO_CHECK(ex11 == ex5); boost::asio::any_io_executor ex12(std::nothrow, std::move(ex7)); BOOST_ASIO_CHECK(ex12.target<void>() != 0); BOOST_ASIO_CHECK(ex12 != null_ptr); BOOST_ASIO_CHECK(ex7.target<void>() == 0); BOOST_ASIO_CHECK(ex7 == null_ptr); BOOST_ASIO_CHECK(ex12 == ex6); BOOST_ASIO_CHECK(ex12 != ex8); next_nothrow_new_fails = true; boost::asio::any_io_executor ex13(std::nothrow, fat_executor(3)); BOOST_ASIO_CHECK(ex13.target<void>() == 0); BOOST_ASIO_CHECK(ex13 == null_ptr); BOOST_ASIO_CHECK(ex13 == ex1); } void any_io_executor_assignment_test() { thread_pool pool(1); boost::asio::nullptr_t null_ptr = boost::asio::nullptr_t(); boost::asio::any_io_executor ex1; boost::asio::any_io_executor ex2; ex2 = null_ptr; BOOST_ASIO_CHECK(ex2.target<void>() == 0); boost::asio::any_io_executor ex3; ex3 = pool.executor(); BOOST_ASIO_CHECK(ex3.target<void>() != 0); boost::asio::any_io_executor ex4; ex4 = ex1; BOOST_ASIO_CHECK(ex4.target<void>() == 0); BOOST_ASIO_CHECK(ex4 == ex1); ex4 = ex3; BOOST_ASIO_CHECK(ex4.target<void>() != 0); BOOST_ASIO_CHECK(ex4 == ex3); boost::asio::any_io_executor ex5; ex5 = fat_executor(1); BOOST_ASIO_CHECK(ex5.target<void>() != 0); BOOST_ASIO_CHECK(ex5 != null_ptr); BOOST_ASIO_CHECK(ex5 != ex1); boost::asio::any_io_executor ex6; ex6 = fat_executor(1); BOOST_ASIO_CHECK(ex6.target<void>() != 0); BOOST_ASIO_CHECK(ex6 != null_ptr); BOOST_ASIO_CHECK(ex6 != ex1); BOOST_ASIO_CHECK(ex6 == ex5); ex6 = fat_executor(2); BOOST_ASIO_CHECK(ex6.target<void>() != 0); BOOST_ASIO_CHECK(ex6 != null_ptr); BOOST_ASIO_CHECK(ex6 != ex1); BOOST_ASIO_CHECK(ex6 != ex5); boost::asio::any_io_executor ex7; ex7 = ex5; BOOST_ASIO_CHECK(ex7.target<void>() != 0); BOOST_ASIO_CHECK(ex7 != null_ptr); BOOST_ASIO_CHECK(ex7 != ex1); BOOST_ASIO_CHECK(ex7 == ex5); BOOST_ASIO_CHECK(ex7 != ex6); boost::asio::any_io_executor ex8; ex8 = std::move(ex1); BOOST_ASIO_CHECK(ex8.target<void>() == 0); BOOST_ASIO_CHECK(ex1.target<void>() == 0); ex8 = std::move(ex3); BOOST_ASIO_CHECK(ex8.target<void>() != 0); BOOST_ASIO_CHECK(ex3.target<void>() == 0); BOOST_ASIO_CHECK(ex8 == ex4); ex8 = std::move(ex5); BOOST_ASIO_CHECK(ex8.target<void>() != 0); BOOST_ASIO_CHECK(ex5.target<void>() == 0); BOOST_ASIO_CHECK(ex8 == ex7); } void any_io_executor_swap_test() { thread_pool pool1(1); thread_pool pool2(1); boost::asio::any_io_executor ex1(pool1.executor()); boost::asio::any_io_executor ex2(pool2.executor()); boost::asio::any_io_executor ex3(ex1); boost::asio::any_io_executor ex4(ex2); BOOST_ASIO_CHECK(ex3 == ex1); BOOST_ASIO_CHECK(ex4 == ex2); ex3.swap(ex4); BOOST_ASIO_CHECK(ex3 == ex2); BOOST_ASIO_CHECK(ex4 == ex1); execution::swap(ex3, ex4); BOOST_ASIO_CHECK(ex3 == ex1); BOOST_ASIO_CHECK(ex4 == ex2); } void any_io_executor_query_test() { thread_pool pool(1); boost::asio::any_io_executor ex(pool.executor()); BOOST_ASIO_CHECK( boost::asio::query(ex, boost::asio::execution::blocking) == boost::asio::execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ex, boost::asio::execution::blocking.possibly) == boost::asio::execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ex, boost::asio::execution::outstanding_work) == boost::asio::execution::outstanding_work.untracked); BOOST_ASIO_CHECK( boost::asio::query(ex, boost::asio::execution::outstanding_work.untracked) == boost::asio::execution::outstanding_work.untracked); BOOST_ASIO_CHECK( boost::asio::query(ex, boost::asio::execution::relationship) == boost::asio::execution::relationship.fork); BOOST_ASIO_CHECK( boost::asio::query(ex, boost::asio::execution::relationship.fork) == boost::asio::execution::relationship.fork); } void any_io_executor_execute_test() { int count = 0; thread_pool pool(1); boost::asio::any_io_executor ex(pool.executor()); ex.execute(bindns::bind(increment, &count)); boost::asio::prefer(ex, boost::asio::execution::blocking.possibly).execute( bindns::bind(increment, &count)); boost::asio::require(ex, boost::asio::execution::blocking.never).execute( bindns::bind(increment, &count)); boost::asio::require( boost::asio::prefer(ex, boost::asio::execution::outstanding_work.tracked), boost::asio::execution::blocking.never ).execute(bindns::bind(increment, &count)); boost::asio::require( boost::asio::prefer(ex, boost::asio::execution::outstanding_work.untracked), boost::asio::execution::blocking.never ).execute(bindns::bind(increment, &count)); boost::asio::require( boost::asio::prefer(ex, boost::asio::execution::outstanding_work.untracked, boost::asio::execution::relationship.continuation), boost::asio::execution::blocking.never ).execute(bindns::bind(increment, &count)); pool.wait(); BOOST_ASIO_CHECK(count == 6); } BOOST_ASIO_TEST_SUITE ( "any_io_executor", BOOST_ASIO_TEST_CASE(any_io_executor_construction_test) BOOST_ASIO_TEST_CASE(any_io_executor_nothrow_construction_test) BOOST_ASIO_TEST_CASE(any_io_executor_assignment_test) BOOST_ASIO_TEST_CASE(any_io_executor_swap_test) BOOST_ASIO_TEST_CASE(any_io_executor_query_test) BOOST_ASIO_TEST_CASE(any_io_executor_execute_test) )
cpp
asio
data/projects/asio/test/signal_set_base.cpp
// // signal_set_base.cpp // ~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Prevent link dependency on the Boost.System library. #if !defined(BOOST_SYSTEM_NO_DEPRECATED) #define BOOST_SYSTEM_NO_DEPRECATED #endif // !defined(BOOST_SYSTEM_NO_DEPRECATED) // Test that header file is self-contained. #include <boost/asio/signal_set_base.hpp> #include "unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "signal_set_base", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/async_result.cpp
// // async_result.cpp // ~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/async_result.hpp> #include "unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "async_result", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/defer.cpp
// // defer.cpp // ~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/defer.hpp> #include "unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "defer", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/ssl/stream.cpp
// // stream.cpp // ~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/ssl/stream.hpp> #include <boost/asio.hpp> #include <boost/asio/ssl.hpp> #include "../archetypes/async_result.hpp" #include "../unit_test.hpp" //------------------------------------------------------------------------------ // ssl_stream_compile test // ~~~~~~~~~~~~~~~~~~~~~~~ // The following test checks that all public member functions on the class // ssl::stream::socket compile and link correctly. Runtime failures are ignored. namespace ssl_stream_compile { bool verify_callback(bool, boost::asio::ssl::verify_context&) { return false; } void handshake_handler(const boost::system::error_code&) { } void buffered_handshake_handler(const boost::system::error_code&, std::size_t) { } void shutdown_handler(const boost::system::error_code&) { } void write_some_handler(const boost::system::error_code&, std::size_t) { } void read_some_handler(const boost::system::error_code&, std::size_t) { } void test() { using namespace boost::asio; namespace ip = boost::asio::ip; try { io_context ioc; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; boost::asio::ssl::context context(boost::asio::ssl::context::sslv23); archetypes::lazy_handler lazy; boost::system::error_code ec; // ssl::stream constructors. ssl::stream<ip::tcp::socket> stream1(ioc, context); ip::tcp::socket socket1(ioc, ip::tcp::v4()); ssl::stream<ip::tcp::socket&> stream2(socket1, context); ssl::stream<ip::tcp::socket> stream3 = ssl::stream<ip::tcp::socket>(ioc, context); ssl::stream<ip::tcp::socket> stream4(std::move(stream3)); // ssl::stream assignment. stream3 = std::move(stream4); // basic_io_object functions. ssl::stream<ip::tcp::socket>::executor_type ex = stream1.get_executor(); (void)ex; // ssl::stream functions. SSL* ssl1 = stream1.native_handle(); (void)ssl1; ssl::stream<ip::tcp::socket>::lowest_layer_type& lowest_layer = stream1.lowest_layer(); (void)lowest_layer; const ssl::stream<ip::tcp::socket>& stream5 = stream1; const ssl::stream<ip::tcp::socket>::lowest_layer_type& lowest_layer2 = stream5.lowest_layer(); (void)lowest_layer2; stream1.set_verify_mode(ssl::verify_none); stream1.set_verify_mode(ssl::verify_none, ec); stream1.set_verify_depth(1); stream1.set_verify_depth(1, ec); stream1.set_verify_callback(verify_callback); stream1.set_verify_callback(verify_callback, ec); stream1.handshake(ssl::stream_base::client); stream1.handshake(ssl::stream_base::server); stream1.handshake(ssl::stream_base::client, ec); stream1.handshake(ssl::stream_base::server, ec); stream1.handshake(ssl::stream_base::client, buffer(mutable_char_buffer)); stream1.handshake(ssl::stream_base::server, buffer(mutable_char_buffer)); stream1.handshake(ssl::stream_base::client, buffer(const_char_buffer)); stream1.handshake(ssl::stream_base::server, buffer(const_char_buffer)); stream1.handshake(ssl::stream_base::client, buffer(mutable_char_buffer), ec); stream1.handshake(ssl::stream_base::server, buffer(mutable_char_buffer), ec); stream1.handshake(ssl::stream_base::client, buffer(const_char_buffer), ec); stream1.handshake(ssl::stream_base::server, buffer(const_char_buffer), ec); stream1.async_handshake(ssl::stream_base::client, handshake_handler); stream1.async_handshake(ssl::stream_base::server, handshake_handler); int i1 = stream1.async_handshake(ssl::stream_base::client, lazy); (void)i1; int i2 = stream1.async_handshake(ssl::stream_base::server, lazy); (void)i2; stream1.async_handshake(ssl::stream_base::client, buffer(mutable_char_buffer), buffered_handshake_handler); stream1.async_handshake(ssl::stream_base::server, buffer(mutable_char_buffer), buffered_handshake_handler); stream1.async_handshake(ssl::stream_base::client, buffer(const_char_buffer), buffered_handshake_handler); stream1.async_handshake(ssl::stream_base::server, buffer(const_char_buffer), buffered_handshake_handler); int i3 = stream1.async_handshake(ssl::stream_base::client, buffer(mutable_char_buffer), lazy); (void)i3; int i4 = stream1.async_handshake(ssl::stream_base::server, buffer(mutable_char_buffer), lazy); (void)i4; int i5 = stream1.async_handshake(ssl::stream_base::client, buffer(const_char_buffer), lazy); (void)i5; int i6 = stream1.async_handshake(ssl::stream_base::server, buffer(const_char_buffer), lazy); (void)i6; stream1.shutdown(); stream1.shutdown(ec); stream1.async_shutdown(shutdown_handler); int i7 = stream1.async_shutdown(lazy); (void)i7; stream1.write_some(buffer(mutable_char_buffer)); stream1.write_some(buffer(const_char_buffer)); stream1.write_some(buffer(mutable_char_buffer), ec); stream1.write_some(buffer(const_char_buffer), ec); stream1.async_write_some(buffer(mutable_char_buffer), write_some_handler); stream1.async_write_some(buffer(const_char_buffer), write_some_handler); int i8 = stream1.async_write_some(buffer(mutable_char_buffer), lazy); (void)i8; int i9 = stream1.async_write_some(buffer(const_char_buffer), lazy); (void)i9; stream1.read_some(buffer(mutable_char_buffer)); stream1.read_some(buffer(mutable_char_buffer), ec); stream1.async_read_some(buffer(mutable_char_buffer), read_some_handler); int i10 = stream1.async_read_some(buffer(mutable_char_buffer), lazy); (void)i10; } catch (std::exception&) { } } } // namespace ssl_stream_compile //------------------------------------------------------------------------------ BOOST_ASIO_TEST_SUITE ( "ssl/stream", BOOST_ASIO_COMPILE_TEST_CASE(ssl_stream_compile::test) )
cpp
asio
data/projects/asio/test/ssl/context.cpp
// // context.cpp // ~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/ssl/context.hpp> #include "../unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "ssl/context", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/ssl/host_name_verification.cpp
// // host_name_verification.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/ssl/host_name_verification.hpp> #include "../unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "ssl/host_name_verification", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/ssl/rfc2818_verification.cpp
// // rfc2818_verification.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/ssl/rfc2818_verification.hpp> #include "../unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "ssl/rfc2818_verification", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/ssl/stream_base.cpp
// // stream_base.cpp // ~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/ssl/stream_base.hpp> #include "../unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "ssl/stream_base", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/ssl/context_base.cpp
// // context_base.cpp // ~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/ssl/context_base.hpp> #include "../unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "ssl/context_base", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/ssl/error.cpp
// // error.cpp // ~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/ssl/error.hpp> #include "../unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "ssl/error", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/generic/raw_protocol.cpp
// // generic/raw_protocol.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/generic/raw_protocol.hpp> #include <cstring> #include <boost/asio/io_context.hpp> #include <boost/asio/ip/icmp.hpp> #include "../unit_test.hpp" #include "../archetypes/async_result.hpp" #if defined(__cplusplus_cli) || defined(__cplusplus_winrt) # define generic cpp_generic #endif //------------------------------------------------------------------------------ // generic_raw_protocol_socket_compile test // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // The following test checks that all public member functions on the class // generic::raw_socket::socket compile and link correctly. Runtime failures // are ignored. namespace generic_raw_protocol_socket_compile { void connect_handler(const boost::system::error_code&) { } void send_handler(const boost::system::error_code&, std::size_t) { } void receive_handler(const boost::system::error_code&, std::size_t) { } void test() { using namespace boost::asio; namespace generic = boost::asio::generic; typedef generic::raw_protocol rp; const int af_inet = BOOST_ASIO_OS_DEF(AF_INET); const int ipproto_icmp = BOOST_ASIO_OS_DEF(IPPROTO_ICMP); const int sock_raw = BOOST_ASIO_OS_DEF(SOCK_RAW); try { io_context ioc; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; socket_base::message_flags in_flags = 0; socket_base::send_buffer_size socket_option; socket_base::bytes_readable io_control_command; archetypes::immediate_handler immediate; boost::system::error_code ec; // basic_raw_socket constructors. rp::socket socket1(ioc); rp::socket socket2(ioc, rp(af_inet, ipproto_icmp)); rp::socket socket3(ioc, rp::endpoint()); #if !defined(BOOST_ASIO_WINDOWS_RUNTIME) rp::socket::native_handle_type native_socket1 = ::socket(af_inet, sock_raw, 0); rp::socket socket4(ioc, rp(af_inet, ipproto_icmp), native_socket1); #endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME) rp::socket socket5(std::move(socket4)); boost::asio::ip::icmp::socket icmp_socket(ioc); rp::socket socket6(std::move(icmp_socket)); // basic_datagram_socket operators. socket1 = rp::socket(ioc); socket1 = std::move(socket2); socket1 = boost::asio::ip::icmp::socket(ioc); // basic_io_object functions. rp::socket::executor_type ex = socket1.get_executor(); (void)ex; // basic_socket functions. rp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer(); (void)lowest_layer; socket1.open(rp(af_inet, ipproto_icmp)); socket1.open(rp(af_inet, ipproto_icmp), ec); #if !defined(BOOST_ASIO_WINDOWS_RUNTIME) rp::socket::native_handle_type native_socket2 = ::socket(af_inet, sock_raw, 0); socket1.assign(rp(af_inet, ipproto_icmp), native_socket2); rp::socket::native_handle_type native_socket3 = ::socket(af_inet, sock_raw, 0); socket1.assign(rp(af_inet, ipproto_icmp), native_socket3, ec); #endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME) bool is_open = socket1.is_open(); (void)is_open; socket1.close(); socket1.close(ec); rp::socket::native_handle_type native_socket4 = socket1.native_handle(); (void)native_socket4; socket1.cancel(); socket1.cancel(ec); bool at_mark1 = socket1.at_mark(); (void)at_mark1; bool at_mark2 = socket1.at_mark(ec); (void)at_mark2; std::size_t available1 = socket1.available(); (void)available1; std::size_t available2 = socket1.available(ec); (void)available2; socket1.bind(rp::endpoint()); socket1.bind(rp::endpoint(), ec); socket1.connect(rp::endpoint()); socket1.connect(rp::endpoint(), ec); socket1.async_connect(rp::endpoint(), connect_handler); socket1.async_connect(rp::endpoint(), immediate); socket1.set_option(socket_option); socket1.set_option(socket_option, ec); socket1.get_option(socket_option); socket1.get_option(socket_option, ec); socket1.io_control(io_control_command); socket1.io_control(io_control_command, ec); rp::endpoint endpoint1 = socket1.local_endpoint(); (void)endpoint1; rp::endpoint endpoint2 = socket1.local_endpoint(ec); (void)endpoint2; rp::endpoint endpoint3 = socket1.remote_endpoint(); (void)endpoint3; rp::endpoint endpoint4 = socket1.remote_endpoint(ec); (void)endpoint4; socket1.shutdown(socket_base::shutdown_both); socket1.shutdown(socket_base::shutdown_both, ec); // basic_raw_socket functions. socket1.send(buffer(mutable_char_buffer)); socket1.send(buffer(const_char_buffer)); socket1.send(null_buffers()); socket1.send(buffer(mutable_char_buffer), in_flags); socket1.send(buffer(const_char_buffer), in_flags); socket1.send(null_buffers(), in_flags); socket1.send(buffer(mutable_char_buffer), in_flags, ec); socket1.send(buffer(const_char_buffer), in_flags, ec); socket1.send(null_buffers(), in_flags, ec); socket1.async_send(buffer(mutable_char_buffer), send_handler); socket1.async_send(buffer(const_char_buffer), send_handler); socket1.async_send(null_buffers(), send_handler); socket1.async_send(buffer(mutable_char_buffer), in_flags, send_handler); socket1.async_send(buffer(const_char_buffer), in_flags, send_handler); socket1.async_send(null_buffers(), in_flags, send_handler); socket1.async_send(buffer(mutable_char_buffer), immediate); socket1.async_send(buffer(const_char_buffer), immediate); socket1.async_send(null_buffers(), immediate); socket1.async_send(buffer(mutable_char_buffer), in_flags, immediate); socket1.async_send(buffer(const_char_buffer), in_flags, immediate); socket1.async_send(null_buffers(), in_flags, immediate); socket1.send_to(buffer(mutable_char_buffer), rp::endpoint()); socket1.send_to(buffer(const_char_buffer), rp::endpoint()); socket1.send_to(null_buffers(), rp::endpoint()); socket1.send_to(buffer(mutable_char_buffer), rp::endpoint(), in_flags); socket1.send_to(buffer(const_char_buffer), rp::endpoint(), in_flags); socket1.send_to(null_buffers(), rp::endpoint(), in_flags); socket1.send_to(buffer(mutable_char_buffer), rp::endpoint(), in_flags, ec); socket1.send_to(buffer(const_char_buffer), rp::endpoint(), in_flags, ec); socket1.send_to(null_buffers(), rp::endpoint(), in_flags, ec); socket1.async_send_to(buffer(mutable_char_buffer), rp::endpoint(), send_handler); socket1.async_send_to(buffer(const_char_buffer), rp::endpoint(), send_handler); socket1.async_send_to(null_buffers(), rp::endpoint(), send_handler); socket1.async_send_to(buffer(mutable_char_buffer), rp::endpoint(), in_flags, send_handler); socket1.async_send_to(buffer(const_char_buffer), rp::endpoint(), in_flags, send_handler); socket1.async_send_to(null_buffers(), rp::endpoint(), in_flags, send_handler); socket1.async_send_to(buffer(mutable_char_buffer), rp::endpoint(), immediate); socket1.async_send_to(buffer(const_char_buffer), rp::endpoint(), immediate); socket1.async_send_to(null_buffers(), rp::endpoint(), immediate); socket1.async_send_to(buffer(mutable_char_buffer), rp::endpoint(), in_flags, immediate); socket1.async_send_to(buffer(const_char_buffer), rp::endpoint(), in_flags, immediate); socket1.async_send_to(null_buffers(), rp::endpoint(), in_flags, immediate); socket1.receive(buffer(mutable_char_buffer)); socket1.receive(null_buffers()); socket1.receive(buffer(mutable_char_buffer), in_flags); socket1.receive(null_buffers(), in_flags); socket1.receive(buffer(mutable_char_buffer), in_flags, ec); socket1.receive(null_buffers(), in_flags, ec); socket1.async_receive(buffer(mutable_char_buffer), receive_handler); socket1.async_receive(null_buffers(), receive_handler); socket1.async_receive(buffer(mutable_char_buffer), in_flags, receive_handler); socket1.async_receive(null_buffers(), in_flags, receive_handler); socket1.async_receive(buffer(mutable_char_buffer), immediate); socket1.async_receive(null_buffers(), immediate); socket1.async_receive(buffer(mutable_char_buffer), in_flags, immediate); socket1.async_receive(null_buffers(), in_flags, immediate); rp::endpoint endpoint; socket1.receive_from(buffer(mutable_char_buffer), endpoint); socket1.receive_from(null_buffers(), endpoint); socket1.receive_from(buffer(mutable_char_buffer), endpoint, in_flags); socket1.receive_from(null_buffers(), endpoint, in_flags); socket1.receive_from(buffer(mutable_char_buffer), endpoint, in_flags, ec); socket1.receive_from(null_buffers(), endpoint, in_flags, ec); socket1.async_receive_from(buffer(mutable_char_buffer), endpoint, receive_handler); socket1.async_receive_from(null_buffers(), endpoint, receive_handler); socket1.async_receive_from(buffer(mutable_char_buffer), endpoint, in_flags, receive_handler); socket1.async_receive_from(null_buffers(), endpoint, in_flags, receive_handler); socket1.async_receive_from(buffer(mutable_char_buffer), endpoint, immediate); socket1.async_receive_from(null_buffers(), endpoint, immediate); socket1.async_receive_from(buffer(mutable_char_buffer), endpoint, in_flags, immediate); socket1.async_receive_from(null_buffers(), endpoint, in_flags, immediate); } catch (std::exception&) { } } } // namespace generic_raw_protocol_socket_compile //------------------------------------------------------------------------------ BOOST_ASIO_TEST_SUITE ( "generic/raw_protocol", BOOST_ASIO_COMPILE_TEST_CASE(generic_raw_protocol_socket_compile::test) )
cpp
asio
data/projects/asio/test/generic/datagram_protocol.cpp
// // generic/datagram_protocol.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/generic/datagram_protocol.hpp> #include <cstring> #include <boost/asio/io_context.hpp> #include <boost/asio/ip/udp.hpp> #include "../unit_test.hpp" #include "../archetypes/async_result.hpp" #if defined(__cplusplus_cli) || defined(__cplusplus_winrt) # define generic cpp_generic #endif //------------------------------------------------------------------------------ // generic_datagram_protocol_socket_compile test // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // The following test checks that all public member functions on the class // generic::datagram_socket::socket compile and link correctly. Runtime // failures are ignored. namespace generic_datagram_protocol_socket_compile { void connect_handler(const boost::system::error_code&) { } void send_handler(const boost::system::error_code&, std::size_t) { } void receive_handler(const boost::system::error_code&, std::size_t) { } void test() { using namespace boost::asio; namespace generic = boost::asio::generic; typedef generic::datagram_protocol dp; const int af_inet = BOOST_ASIO_OS_DEF(AF_INET); const int ipproto_udp = BOOST_ASIO_OS_DEF(IPPROTO_UDP); const int sock_dgram = BOOST_ASIO_OS_DEF(SOCK_DGRAM); try { io_context ioc; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; socket_base::message_flags in_flags = 0; socket_base::send_buffer_size socket_option; socket_base::bytes_readable io_control_command; archetypes::immediate_handler immediate; boost::system::error_code ec; // basic_datagram_socket constructors. dp::socket socket1(ioc); dp::socket socket2(ioc, dp(af_inet, ipproto_udp)); dp::socket socket3(ioc, dp::endpoint()); #if !defined(BOOST_ASIO_WINDOWS_RUNTIME) dp::socket::native_handle_type native_socket1 = ::socket(af_inet, sock_dgram, 0); dp::socket socket4(ioc, dp(af_inet, ipproto_udp), native_socket1); #endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME) dp::socket socket5(std::move(socket4)); boost::asio::ip::udp::socket udp_socket(ioc); dp::socket socket6(std::move(udp_socket)); // basic_datagram_socket operators. socket1 = dp::socket(ioc); socket1 = std::move(socket2); socket1 = boost::asio::ip::udp::socket(ioc); // basic_io_object functions. dp::socket::executor_type ex = socket1.get_executor(); (void)ex; // basic_socket functions. dp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer(); (void)lowest_layer; socket1.open(dp(af_inet, ipproto_udp)); socket1.open(dp(af_inet, ipproto_udp), ec); #if !defined(BOOST_ASIO_WINDOWS_RUNTIME) dp::socket::native_handle_type native_socket2 = ::socket(af_inet, sock_dgram, 0); socket1.assign(dp(af_inet, ipproto_udp), native_socket2); dp::socket::native_handle_type native_socket3 = ::socket(af_inet, sock_dgram, 0); socket1.assign(dp(af_inet, ipproto_udp), native_socket3, ec); #endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME) bool is_open = socket1.is_open(); (void)is_open; socket1.close(); socket1.close(ec); dp::socket::native_handle_type native_socket4 = socket1.native_handle(); (void)native_socket4; socket1.cancel(); socket1.cancel(ec); bool at_mark1 = socket1.at_mark(); (void)at_mark1; bool at_mark2 = socket1.at_mark(ec); (void)at_mark2; std::size_t available1 = socket1.available(); (void)available1; std::size_t available2 = socket1.available(ec); (void)available2; socket1.bind(dp::endpoint()); socket1.bind(dp::endpoint(), ec); socket1.connect(dp::endpoint()); socket1.connect(dp::endpoint(), ec); socket1.async_connect(dp::endpoint(), connect_handler); socket1.async_connect(dp::endpoint(), immediate); socket1.set_option(socket_option); socket1.set_option(socket_option, ec); socket1.get_option(socket_option); socket1.get_option(socket_option, ec); socket1.io_control(io_control_command); socket1.io_control(io_control_command, ec); dp::endpoint endpoint1 = socket1.local_endpoint(); (void)endpoint1; dp::endpoint endpoint2 = socket1.local_endpoint(ec); (void)endpoint2; dp::endpoint endpoint3 = socket1.remote_endpoint(); (void)endpoint3; dp::endpoint endpoint4 = socket1.remote_endpoint(ec); (void)endpoint4; socket1.shutdown(socket_base::shutdown_both); socket1.shutdown(socket_base::shutdown_both, ec); // basic_datagram_socket functions. socket1.send(buffer(mutable_char_buffer)); socket1.send(buffer(const_char_buffer)); socket1.send(null_buffers()); socket1.send(buffer(mutable_char_buffer), in_flags); socket1.send(buffer(const_char_buffer), in_flags); socket1.send(null_buffers(), in_flags); socket1.send(buffer(mutable_char_buffer), in_flags, ec); socket1.send(buffer(const_char_buffer), in_flags, ec); socket1.send(null_buffers(), in_flags, ec); socket1.async_send(buffer(mutable_char_buffer), send_handler); socket1.async_send(buffer(const_char_buffer), send_handler); socket1.async_send(null_buffers(), send_handler); socket1.async_send(buffer(mutable_char_buffer), in_flags, send_handler); socket1.async_send(buffer(const_char_buffer), in_flags, send_handler); socket1.async_send(null_buffers(), in_flags, send_handler); socket1.async_send(buffer(mutable_char_buffer), immediate); socket1.async_send(buffer(const_char_buffer), immediate); socket1.async_send(null_buffers(), immediate); socket1.async_send(buffer(mutable_char_buffer), in_flags, immediate); socket1.async_send(buffer(const_char_buffer), in_flags, immediate); socket1.async_send(null_buffers(), in_flags, immediate); socket1.send_to(buffer(mutable_char_buffer), dp::endpoint()); socket1.send_to(buffer(const_char_buffer), dp::endpoint()); socket1.send_to(null_buffers(), dp::endpoint()); socket1.send_to(buffer(mutable_char_buffer), dp::endpoint(), in_flags); socket1.send_to(buffer(const_char_buffer), dp::endpoint(), in_flags); socket1.send_to(null_buffers(), dp::endpoint(), in_flags); socket1.send_to(buffer(mutable_char_buffer), dp::endpoint(), in_flags, ec); socket1.send_to(buffer(const_char_buffer), dp::endpoint(), in_flags, ec); socket1.send_to(null_buffers(), dp::endpoint(), in_flags, ec); socket1.async_send_to(buffer(mutable_char_buffer), dp::endpoint(), send_handler); socket1.async_send_to(buffer(const_char_buffer), dp::endpoint(), send_handler); socket1.async_send_to(null_buffers(), dp::endpoint(), send_handler); socket1.async_send_to(buffer(mutable_char_buffer), dp::endpoint(), in_flags, send_handler); socket1.async_send_to(buffer(const_char_buffer), dp::endpoint(), in_flags, send_handler); socket1.async_send_to(null_buffers(), dp::endpoint(), in_flags, send_handler); socket1.async_send_to(buffer(mutable_char_buffer), dp::endpoint(), immediate); socket1.async_send_to(buffer(const_char_buffer), dp::endpoint(), immediate); socket1.async_send_to(null_buffers(), dp::endpoint(), immediate); socket1.async_send_to(buffer(mutable_char_buffer), dp::endpoint(), in_flags, immediate); socket1.async_send_to(buffer(const_char_buffer), dp::endpoint(), in_flags, immediate); socket1.async_send_to(null_buffers(), dp::endpoint(), in_flags, immediate); socket1.receive(buffer(mutable_char_buffer)); socket1.receive(null_buffers()); socket1.receive(buffer(mutable_char_buffer), in_flags); socket1.receive(null_buffers(), in_flags); socket1.receive(buffer(mutable_char_buffer), in_flags, ec); socket1.receive(null_buffers(), in_flags, ec); socket1.async_receive(buffer(mutable_char_buffer), receive_handler); socket1.async_receive(null_buffers(), receive_handler); socket1.async_receive(buffer(mutable_char_buffer), in_flags, receive_handler); socket1.async_receive(null_buffers(), in_flags, receive_handler); socket1.async_receive(buffer(mutable_char_buffer), immediate); socket1.async_receive(null_buffers(), immediate); socket1.async_receive(buffer(mutable_char_buffer), in_flags, immediate); socket1.async_receive(null_buffers(), in_flags, immediate); dp::endpoint endpoint; socket1.receive_from(buffer(mutable_char_buffer), endpoint); socket1.receive_from(null_buffers(), endpoint); socket1.receive_from(buffer(mutable_char_buffer), endpoint, in_flags); socket1.receive_from(null_buffers(), endpoint, in_flags); socket1.receive_from(buffer(mutable_char_buffer), endpoint, in_flags, ec); socket1.receive_from(null_buffers(), endpoint, in_flags, ec); socket1.async_receive_from(buffer(mutable_char_buffer), endpoint, receive_handler); socket1.async_receive_from(null_buffers(), endpoint, receive_handler); socket1.async_receive_from(buffer(mutable_char_buffer), endpoint, in_flags, receive_handler); socket1.async_receive_from(null_buffers(), endpoint, in_flags, receive_handler); socket1.async_receive_from(buffer(mutable_char_buffer), endpoint, immediate); socket1.async_receive_from(null_buffers(), endpoint, immediate); socket1.async_receive_from(buffer(mutable_char_buffer), endpoint, in_flags, immediate); socket1.async_receive_from(null_buffers(), endpoint, in_flags, immediate); } catch (std::exception&) { } } } // namespace generic_datagram_protocol_socket_compile //------------------------------------------------------------------------------ BOOST_ASIO_TEST_SUITE ( "generic/datagram_protocol", BOOST_ASIO_COMPILE_TEST_CASE(generic_datagram_protocol_socket_compile::test) )
cpp
asio
data/projects/asio/test/generic/basic_endpoint.cpp
// // generic/basic_endpoint.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/generic/basic_endpoint.hpp> #include "../unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "generic/basic_endpoint", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/generic/stream_protocol.cpp
// // generic/stream_protocol.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/generic/stream_protocol.hpp> #include <cstring> #include <boost/asio/io_context.hpp> #include <boost/asio/ip/tcp.hpp> #include "../unit_test.hpp" #include "../archetypes/async_result.hpp" #if defined(__cplusplus_cli) || defined(__cplusplus_winrt) # define generic cpp_generic #endif //------------------------------------------------------------------------------ // generic_stream_protocol_socket_compile test // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // The following test checks that all public member functions on the class // generic::stream_protocol::socket compile and link correctly. Runtime // failures are ignored. namespace generic_stream_protocol_socket_compile { void connect_handler(const boost::system::error_code&) { } void send_handler(const boost::system::error_code&, std::size_t) { } void receive_handler(const boost::system::error_code&, std::size_t) { } void write_some_handler(const boost::system::error_code&, std::size_t) { } void read_some_handler(const boost::system::error_code&, std::size_t) { } void test() { using namespace boost::asio; namespace generic = boost::asio::generic; typedef generic::stream_protocol sp; const int af_inet = BOOST_ASIO_OS_DEF(AF_INET); const int ipproto_tcp = BOOST_ASIO_OS_DEF(IPPROTO_TCP); const int sock_stream = BOOST_ASIO_OS_DEF(SOCK_STREAM); try { io_context ioc; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; socket_base::message_flags in_flags = 0; socket_base::keep_alive socket_option; socket_base::bytes_readable io_control_command; archetypes::immediate_handler immediate; boost::system::error_code ec; // basic_stream_socket constructors. sp::socket socket1(ioc); sp::socket socket2(ioc, sp(af_inet, ipproto_tcp)); sp::socket socket3(ioc, sp::endpoint()); #if defined(BOOST_ASIO_WINDOWS_RUNTIME) Windows::Networking::Sockets::StreamSocket^ native_socket1 = nullptr; #else // defined(BOOST_ASIO_WINDOWS_RUNTIME) sp::socket::native_handle_type native_socket1 = ::socket(af_inet, sock_stream, 0); #endif // defined(BOOST_ASIO_WINDOWS_RUNTIME) sp::socket socket4(ioc, sp(af_inet, ipproto_tcp), native_socket1); sp::socket socket5(std::move(socket4)); boost::asio::ip::tcp::socket tcp_socket(ioc); sp::socket socket6(std::move(tcp_socket)); // basic_stream_socket operators. socket1 = sp::socket(ioc); socket1 = std::move(socket2); socket1 = boost::asio::ip::tcp::socket(ioc); // basic_io_object functions. sp::socket::executor_type ex = socket1.get_executor(); (void)ex; // basic_socket functions. sp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer(); (void)lowest_layer; socket1.open(sp(af_inet, ipproto_tcp)); socket1.open(sp(af_inet, ipproto_tcp), ec); #if defined(BOOST_ASIO_WINDOWS_RUNTIME) Windows::Networking::Sockets::StreamSocket^ native_socket2 = nullptr; #else // defined(BOOST_ASIO_WINDOWS_RUNTIME) sp::socket::native_handle_type native_socket2 = ::socket(af_inet, sock_stream, 0); #endif // defined(BOOST_ASIO_WINDOWS_RUNTIME) socket1.assign(sp(af_inet, ipproto_tcp), native_socket2); #if defined(BOOST_ASIO_WINDOWS_RUNTIME) Windows::Networking::Sockets::StreamSocket^ native_socket3 = nullptr; #else // defined(BOOST_ASIO_WINDOWS_RUNTIME) sp::socket::native_handle_type native_socket3 = ::socket(af_inet, sock_stream, 0); #endif // defined(BOOST_ASIO_WINDOWS_RUNTIME) socket1.assign(sp(af_inet, ipproto_tcp), native_socket3, ec); bool is_open = socket1.is_open(); (void)is_open; socket1.close(); socket1.close(ec); sp::socket::native_handle_type native_socket4 = socket1.native_handle(); (void)native_socket4; socket1.cancel(); socket1.cancel(ec); bool at_mark1 = socket1.at_mark(); (void)at_mark1; bool at_mark2 = socket1.at_mark(ec); (void)at_mark2; std::size_t available1 = socket1.available(); (void)available1; std::size_t available2 = socket1.available(ec); (void)available2; socket1.bind(sp::endpoint()); socket1.bind(sp::endpoint(), ec); socket1.connect(sp::endpoint()); socket1.connect(sp::endpoint(), ec); socket1.async_connect(sp::endpoint(), connect_handler); socket1.async_connect(sp::endpoint(), immediate); socket1.set_option(socket_option); socket1.set_option(socket_option, ec); socket1.get_option(socket_option); socket1.get_option(socket_option, ec); socket1.io_control(io_control_command); socket1.io_control(io_control_command, ec); sp::endpoint endpoint1 = socket1.local_endpoint(); (void)endpoint1; sp::endpoint endpoint2 = socket1.local_endpoint(ec); (void)endpoint2; sp::endpoint endpoint3 = socket1.remote_endpoint(); (void)endpoint3; sp::endpoint endpoint4 = socket1.remote_endpoint(ec); (void)endpoint4; socket1.shutdown(socket_base::shutdown_both); socket1.shutdown(socket_base::shutdown_both, ec); // basic_stream_socket functions. socket1.send(buffer(mutable_char_buffer)); socket1.send(buffer(const_char_buffer)); socket1.send(null_buffers()); socket1.send(buffer(mutable_char_buffer), in_flags); socket1.send(buffer(const_char_buffer), in_flags); socket1.send(null_buffers(), in_flags); socket1.send(buffer(mutable_char_buffer), in_flags, ec); socket1.send(buffer(const_char_buffer), in_flags, ec); socket1.send(null_buffers(), in_flags, ec); socket1.async_send(buffer(mutable_char_buffer), send_handler); socket1.async_send(buffer(const_char_buffer), send_handler); socket1.async_send(null_buffers(), send_handler); socket1.async_send(buffer(mutable_char_buffer), in_flags, send_handler); socket1.async_send(buffer(const_char_buffer), in_flags, send_handler); socket1.async_send(null_buffers(), in_flags, send_handler); socket1.async_send(buffer(mutable_char_buffer), immediate); socket1.async_send(buffer(const_char_buffer), immediate); socket1.async_send(null_buffers(), immediate); socket1.async_send(buffer(mutable_char_buffer), in_flags, immediate); socket1.async_send(buffer(const_char_buffer), in_flags, immediate); socket1.async_send(null_buffers(), in_flags, immediate); socket1.receive(buffer(mutable_char_buffer)); socket1.receive(null_buffers()); socket1.receive(buffer(mutable_char_buffer), in_flags); socket1.receive(null_buffers(), in_flags); socket1.receive(buffer(mutable_char_buffer), in_flags, ec); socket1.receive(null_buffers(), in_flags, ec); socket1.async_receive(buffer(mutable_char_buffer), receive_handler); socket1.async_receive(null_buffers(), receive_handler); socket1.async_receive(buffer(mutable_char_buffer), in_flags, receive_handler); socket1.async_receive(null_buffers(), in_flags, receive_handler); socket1.async_receive(buffer(mutable_char_buffer), immediate); socket1.async_receive(null_buffers(), immediate); socket1.async_receive(buffer(mutable_char_buffer), in_flags, immediate); socket1.async_receive(null_buffers(), in_flags, immediate); socket1.write_some(buffer(mutable_char_buffer)); socket1.write_some(buffer(const_char_buffer)); socket1.write_some(null_buffers()); socket1.write_some(buffer(mutable_char_buffer), ec); socket1.write_some(buffer(const_char_buffer), ec); socket1.write_some(null_buffers(), ec); socket1.async_write_some(buffer(mutable_char_buffer), write_some_handler); socket1.async_write_some(buffer(const_char_buffer), write_some_handler); socket1.async_write_some(null_buffers(), write_some_handler); socket1.async_write_some(buffer(mutable_char_buffer), immediate); socket1.async_write_some(buffer(const_char_buffer), immediate); socket1.async_write_some(null_buffers(), immediate); socket1.read_some(buffer(mutable_char_buffer)); socket1.read_some(buffer(mutable_char_buffer), ec); socket1.read_some(null_buffers(), ec); socket1.async_read_some(buffer(mutable_char_buffer), read_some_handler); socket1.async_read_some(null_buffers(), read_some_handler); socket1.async_read_some(buffer(mutable_char_buffer), immediate); socket1.async_read_some(null_buffers(), immediate); } catch (std::exception&) { } } } // namespace generic_stream_protocol_socket_compile //------------------------------------------------------------------------------ BOOST_ASIO_TEST_SUITE ( "generic/stream_protocol", BOOST_ASIO_COMPILE_TEST_CASE(generic_stream_protocol_socket_compile::test) )
cpp
asio
data/projects/asio/test/generic/seq_packet_protocol.cpp
// // generic/seq_packet_protocol.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/generic/seq_packet_protocol.hpp> #include <cstring> #include <boost/asio/io_context.hpp> #include "../unit_test.hpp" #include "../archetypes/async_result.hpp" #if defined(__cplusplus_cli) || defined(__cplusplus_winrt) # define generic cpp_generic #endif //------------------------------------------------------------------------------ // generic_seq_packet_protocol_socket_compile test // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // The following test checks that all public member functions on the class // generic::seq_packet_socket::socket compile and link correctly. Runtime // failures are ignored. namespace generic_seq_packet_protocol_socket_compile { void connect_handler(const boost::system::error_code&) { } void send_handler(const boost::system::error_code&, std::size_t) { } void receive_handler(const boost::system::error_code&, std::size_t) { } void test() { using namespace boost::asio; namespace generic = boost::asio::generic; typedef generic::seq_packet_protocol spp; const int af_inet = BOOST_ASIO_OS_DEF(AF_INET); const int sock_seqpacket = BOOST_ASIO_OS_DEF(SOCK_SEQPACKET); try { io_context ioc; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; const socket_base::message_flags in_flags = 0; socket_base::message_flags out_flags = 0; socket_base::send_buffer_size socket_option; socket_base::bytes_readable io_control_command; archetypes::immediate_handler immediate; boost::system::error_code ec; // basic_seq_packet_socket constructors. spp::socket socket1(ioc); spp::socket socket2(ioc, spp(af_inet, 0)); spp::socket socket3(ioc, spp::endpoint()); #if !defined(BOOST_ASIO_WINDOWS_RUNTIME) spp::socket::native_handle_type native_socket1 = ::socket(af_inet, sock_seqpacket, 0); spp::socket socket4(ioc, spp(af_inet, 0), native_socket1); #endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME) spp::socket socket5(std::move(socket4)); // basic_seq_packet_socket operators. socket1 = spp::socket(ioc); socket1 = std::move(socket2); // basic_io_object functions. spp::socket::executor_type ex = socket1.get_executor(); (void)ex; // basic_socket functions. spp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer(); (void)lowest_layer; socket1.open(spp(af_inet, 0)); socket1.open(spp(af_inet, 0), ec); #if !defined(BOOST_ASIO_WINDOWS_RUNTIME) spp::socket::native_handle_type native_socket2 = ::socket(af_inet, sock_seqpacket, 0); socket1.assign(spp(af_inet, 0), native_socket2); spp::socket::native_handle_type native_socket3 = ::socket(af_inet, sock_seqpacket, 0); socket1.assign(spp(af_inet, 0), native_socket3, ec); #endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME) bool is_open = socket1.is_open(); (void)is_open; socket1.close(); socket1.close(ec); spp::socket::native_handle_type native_socket4 = socket1.native_handle(); (void)native_socket4; socket1.cancel(); socket1.cancel(ec); bool at_mark1 = socket1.at_mark(); (void)at_mark1; bool at_mark2 = socket1.at_mark(ec); (void)at_mark2; std::size_t available1 = socket1.available(); (void)available1; std::size_t available2 = socket1.available(ec); (void)available2; socket1.bind(spp::endpoint()); socket1.bind(spp::endpoint(), ec); socket1.connect(spp::endpoint()); socket1.connect(spp::endpoint(), ec); socket1.async_connect(spp::endpoint(), connect_handler); socket1.async_connect(spp::endpoint(), immediate); socket1.set_option(socket_option); socket1.set_option(socket_option, ec); socket1.get_option(socket_option); socket1.get_option(socket_option, ec); socket1.io_control(io_control_command); socket1.io_control(io_control_command, ec); spp::endpoint endpoint1 = socket1.local_endpoint(); (void)endpoint1; spp::endpoint endpoint2 = socket1.local_endpoint(ec); (void)endpoint2; spp::endpoint endpoint3 = socket1.remote_endpoint(); (void)endpoint3; spp::endpoint endpoint4 = socket1.remote_endpoint(ec); (void)endpoint4; socket1.shutdown(socket_base::shutdown_both); socket1.shutdown(socket_base::shutdown_both, ec); // basic_seq_packet_socket functions. socket1.send(buffer(mutable_char_buffer), in_flags); socket1.send(buffer(const_char_buffer), in_flags); socket1.send(null_buffers(), in_flags); socket1.send(buffer(mutable_char_buffer), in_flags, ec); socket1.send(buffer(const_char_buffer), in_flags, ec); socket1.send(null_buffers(), in_flags, ec); socket1.async_send(buffer(mutable_char_buffer), in_flags, send_handler); socket1.async_send(buffer(const_char_buffer), in_flags, send_handler); socket1.async_send(null_buffers(), in_flags, send_handler); socket1.async_send(buffer(mutable_char_buffer), in_flags, immediate); socket1.async_send(buffer(const_char_buffer), in_flags, immediate); socket1.async_send(null_buffers(), in_flags, immediate); socket1.receive(buffer(mutable_char_buffer), out_flags); socket1.receive(null_buffers(), out_flags); socket1.receive(buffer(mutable_char_buffer), in_flags, out_flags); socket1.receive(null_buffers(), in_flags, out_flags); socket1.receive(buffer(mutable_char_buffer), in_flags, out_flags, ec); socket1.receive(null_buffers(), in_flags, out_flags, ec); socket1.async_receive(buffer(mutable_char_buffer), out_flags, receive_handler); socket1.async_receive(null_buffers(), out_flags, receive_handler); socket1.async_receive(buffer(mutable_char_buffer), in_flags, out_flags, receive_handler); socket1.async_receive(null_buffers(), in_flags, out_flags, receive_handler); socket1.async_receive(buffer(mutable_char_buffer), out_flags, immediate); socket1.async_receive(null_buffers(), out_flags, immediate); socket1.async_receive(buffer(mutable_char_buffer), in_flags, out_flags, immediate); socket1.async_receive(null_buffers(), in_flags, out_flags, immediate); } catch (std::exception&) { } } } // namespace generic_seq_packet_protocol_socket_compile //------------------------------------------------------------------------------ BOOST_ASIO_TEST_SUITE ( "generic/seq_packet_protocol", BOOST_ASIO_COMPILE_TEST_CASE(generic_seq_packet_protocol_socket_compile::test) )
cpp
asio
data/projects/asio/test/archetypes/gettable_socket_option.hpp
// // gettable_socket_option.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #ifndef ARCHETYPES_GETTABLE_SOCKET_OPTION_HPP #define ARCHETYPES_GETTABLE_SOCKET_OPTION_HPP #include <cstddef> namespace archetypes { template <typename PointerType> class gettable_socket_option { public: template <typename Protocol> int level(const Protocol&) const { return 0; } template <typename Protocol> int name(const Protocol&) const { return 0; } template <typename Protocol> PointerType* data(const Protocol&) { return 0; } template <typename Protocol> std::size_t size(const Protocol&) const { return 0; } template <typename Protocol> void resize(const Protocol&, std::size_t) { } }; } // namespace archetypes #endif // ARCHETYPES_GETTABLE_SOCKET_OPTION_HPP
hpp
asio
data/projects/asio/test/archetypes/settable_socket_option.hpp
// // settable_socket_option.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #ifndef ARCHETYPES_SETTABLE_SOCKET_OPTION_HPP #define ARCHETYPES_SETTABLE_SOCKET_OPTION_HPP #include <cstddef> namespace archetypes { template <typename PointerType> class settable_socket_option { public: template <typename Protocol> int level(const Protocol&) const { return 0; } template <typename Protocol> int name(const Protocol&) const { return 0; } template <typename Protocol> const PointerType* data(const Protocol&) const { return 0; } template <typename Protocol> std::size_t size(const Protocol&) const { return 0; } }; } // namespace archetypes #endif // ARCHETYPES_SETTABLE_SOCKET_OPTION_HPP
hpp
asio
data/projects/asio/test/archetypes/async_result.hpp
// // async_result.hpp // ~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #ifndef ARCHETYPES_ASYNC_RESULT_HPP #define ARCHETYPES_ASYNC_RESULT_HPP #include <boost/asio/async_result.hpp> #include <boost/asio/system_executor.hpp> namespace archetypes { struct immediate_handler { }; struct lazy_handler { }; template <typename Signature> struct concrete_handler; template <typename R, typename Arg1> struct concrete_handler<R(Arg1)> { concrete_handler() { } void operator()(typename boost::asio::decay<Arg1>::type) { } concrete_handler(concrete_handler&&) {} private: concrete_handler(const concrete_handler&); }; template <typename R, typename Arg1, typename Arg2> struct concrete_handler<R(Arg1, Arg2)> { concrete_handler() { } void operator()(typename boost::asio::decay<Arg1>::type, typename boost::asio::decay<Arg2>::type) { } }; template <typename Signature> struct immediate_concrete_handler : concrete_handler<Signature> { typedef boost::asio::system_executor immediate_executor_type; immediate_concrete_handler(immediate_handler) { } immediate_executor_type get_immediate_executor() const noexcept { return immediate_executor_type(); } immediate_concrete_handler(immediate_concrete_handler&&) {} private: immediate_concrete_handler(const immediate_concrete_handler&); }; template <typename Signature> struct lazy_concrete_handler : concrete_handler<Signature> { lazy_concrete_handler(lazy_handler) { } lazy_concrete_handler(lazy_concrete_handler&&) {} private: lazy_concrete_handler(const lazy_concrete_handler&); }; } // namespace archetypes namespace boost { namespace asio { template <typename Signature> class async_result<archetypes::immediate_handler, Signature> { public: // The concrete completion handler type. typedef archetypes::immediate_concrete_handler<Signature> completion_handler_type; // The return type of the initiating function. typedef void return_type; // Construct an async_result from a given handler. explicit async_result(completion_handler_type&) { } // Obtain the value to be returned from the initiating function. void get() { } private: // Disallow copying and assignment. async_result(const async_result&) = delete; async_result& operator=(const async_result&) = delete; }; template <typename Signature> class async_result<archetypes::lazy_handler, Signature> { public: // The concrete completion handler type. typedef archetypes::lazy_concrete_handler<Signature> completion_handler_type; // The return type of the initiating function. typedef int return_type; // Construct an async_result from a given handler. explicit async_result(completion_handler_type&) { } // Obtain the value to be returned from the initiating function. return_type get() { return 42; } private: // Disallow copying and assignment. async_result(const async_result&) = delete; async_result& operator=(const async_result&) = delete; }; } // namespace asio } // namespace boost #endif // ARCHETYPES_ASYNC_RESULT_HPP
hpp
asio
data/projects/asio/test/archetypes/io_control_command.hpp
// // io_control_command.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #ifndef ARCHETYPES_IO_CONTROL_COMMAND_HPP #define ARCHETYPES_IO_CONTROL_COMMAND_HPP namespace archetypes { class io_control_command { public: int name() const { return 0; } void* data() { return 0; } }; } // namespace archetypes #endif // ARCHETYPES_IO_CONTROL_COMMAND_HPP
hpp
asio
data/projects/asio/test/archetypes/async_ops.hpp
// // archetypes/async_ops.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #ifndef ARCHETYPES_ASYNC_OPS_HPP #define ARCHETYPES_ASYNC_OPS_HPP #include <functional> #include <boost/asio/associated_allocator.hpp> #include <boost/asio/associated_executor.hpp> #include <boost/asio/async_result.hpp> #include <boost/asio/error.hpp> namespace archetypes { namespace bindns = std; template <typename CompletionToken> typename boost::asio::async_result<boost::asio::decay_t<CompletionToken>, void()>::return_type async_op_0(CompletionToken&& token) { typedef typename boost::asio::async_result<boost::asio::decay_t<CompletionToken>, void()>::completion_handler_type handler_type; boost::asio::async_completion<CompletionToken, void()> completion(token); typename boost::asio::associated_allocator<handler_type>::type a = boost::asio::get_associated_allocator(completion.completion_handler); typename boost::asio::associated_executor<handler_type>::type ex = boost::asio::get_associated_executor(completion.completion_handler); ex.post(static_cast<handler_type&&>(completion.completion_handler), a); return completion.result.get(); } template <typename CompletionToken> typename boost::asio::async_result<boost::asio::decay_t<CompletionToken>, void(boost::system::error_code)>::return_type async_op_ec_0(bool ok, BOOST_ASIO_MOVE_ARG(CompletionToken) token) { typedef typename boost::asio::async_result<boost::asio::decay_t<CompletionToken>, void(boost::system::error_code)>::completion_handler_type handler_type; boost::asio::async_completion<CompletionToken, void(boost::system::error_code)> completion(token); typename boost::asio::associated_allocator<handler_type>::type a = boost::asio::get_associated_allocator(completion.completion_handler); typename boost::asio::associated_executor<handler_type>::type ex = boost::asio::get_associated_executor(completion.completion_handler); if (ok) { ex.post( bindns::bind( static_cast<handler_type&&>(completion.completion_handler), boost::system::error_code()), a); } else { ex.post( bindns::bind( static_cast<handler_type&&>(completion.completion_handler), boost::system::error_code(boost::asio::error::operation_aborted)), a); } return completion.result.get(); } template <typename CompletionToken> typename boost::asio::async_result<boost::asio::decay_t<CompletionToken>, void(std::exception_ptr)>::return_type async_op_ex_0(bool ok, BOOST_ASIO_MOVE_ARG(CompletionToken) token) { typedef typename boost::asio::async_result<boost::asio::decay_t<CompletionToken>, void(std::exception_ptr)>::completion_handler_type handler_type; boost::asio::async_completion<CompletionToken, void(std::exception_ptr)> completion(token); typename boost::asio::associated_allocator<handler_type>::type a = boost::asio::get_associated_allocator(completion.completion_handler); typename boost::asio::associated_executor<handler_type>::type ex = boost::asio::get_associated_executor(completion.completion_handler); if (ok) { ex.post( bindns::bind( static_cast<handler_type&&>(completion.completion_handler), std::exception_ptr()), a); } else { ex.post( bindns::bind( static_cast<handler_type&&>(completion.completion_handler), std::make_exception_ptr(std::runtime_error("blah"))), a); } return completion.result.get(); } template <typename CompletionToken> typename boost::asio::async_result<boost::asio::decay_t<CompletionToken>, void(int)>::return_type async_op_1(BOOST_ASIO_MOVE_ARG(CompletionToken) token) { typedef typename boost::asio::async_result<boost::asio::decay_t<CompletionToken>, void(int)>::completion_handler_type handler_type; boost::asio::async_completion<CompletionToken, void(int)> completion(token); typename boost::asio::associated_allocator<handler_type>::type a = boost::asio::get_associated_allocator(completion.completion_handler); typename boost::asio::associated_executor<handler_type>::type ex = boost::asio::get_associated_executor(completion.completion_handler); ex.post( bindns::bind( static_cast<handler_type&&>(completion.completion_handler), 42), a); return completion.result.get(); } template <typename CompletionToken> typename boost::asio::async_result<boost::asio::decay_t<CompletionToken>, void(boost::system::error_code, int)>::return_type async_op_ec_1(bool ok, BOOST_ASIO_MOVE_ARG(CompletionToken) token) { typedef typename boost::asio::async_result<boost::asio::decay_t<CompletionToken>, void(boost::system::error_code, int)>::completion_handler_type handler_type; boost::asio::async_completion<CompletionToken, void(boost::system::error_code, int)> completion(token); typename boost::asio::associated_allocator<handler_type>::type a = boost::asio::get_associated_allocator(completion.completion_handler); typename boost::asio::associated_executor<handler_type>::type ex = boost::asio::get_associated_executor(completion.completion_handler); if (ok) { ex.post( bindns::bind( static_cast<handler_type&&>(completion.completion_handler), boost::system::error_code(), 42), a); } else { ex.post( bindns::bind( static_cast<handler_type&&>(completion.completion_handler), boost::system::error_code(boost::asio::error::operation_aborted), 0), a); } return completion.result.get(); } template <typename CompletionToken> typename boost::asio::async_result<boost::asio::decay_t<CompletionToken>, void(std::exception_ptr, int)>::return_type async_op_ex_1(bool ok, BOOST_ASIO_MOVE_ARG(CompletionToken) token) { typedef typename boost::asio::async_result<boost::asio::decay_t<CompletionToken>, void(std::exception_ptr, int)>::completion_handler_type handler_type; boost::asio::async_completion<CompletionToken, void(std::exception_ptr, int)> completion(token); typename boost::asio::associated_allocator<handler_type>::type a = boost::asio::get_associated_allocator(completion.completion_handler); typename boost::asio::associated_executor<handler_type>::type ex = boost::asio::get_associated_executor(completion.completion_handler); if (ok) { ex.post( bindns::bind( static_cast<handler_type&&>(completion.completion_handler), std::exception_ptr(), 42), a); } else { ex.post( bindns::bind( static_cast<handler_type&&>(completion.completion_handler), std::make_exception_ptr(std::runtime_error("blah")), 0), a); } return completion.result.get(); } template <typename CompletionToken> typename boost::asio::async_result<boost::asio::decay_t<CompletionToken>, void(int, double)>::return_type async_op_2(BOOST_ASIO_MOVE_ARG(CompletionToken) token) { typedef typename boost::asio::async_result<boost::asio::decay_t<CompletionToken>, void(int, double)>::completion_handler_type handler_type; boost::asio::async_completion<CompletionToken, void(int, double)> completion(token); typename boost::asio::associated_allocator<handler_type>::type a = boost::asio::get_associated_allocator(completion.completion_handler); typename boost::asio::associated_executor<handler_type>::type ex = boost::asio::get_associated_executor(completion.completion_handler); ex.post( bindns::bind( static_cast<handler_type&&>(completion.completion_handler), 42, 2.0), a); return completion.result.get(); } template <typename CompletionToken> typename boost::asio::async_result<boost::asio::decay_t<CompletionToken>, void(boost::system::error_code, int, double)>::return_type async_op_ec_2(bool ok, BOOST_ASIO_MOVE_ARG(CompletionToken) token) { typedef typename boost::asio::async_result<boost::asio::decay_t<CompletionToken>, void(boost::system::error_code, int, double)>::completion_handler_type handler_type; boost::asio::async_completion<CompletionToken, void(boost::system::error_code, int, double)> completion(token); typename boost::asio::associated_allocator<handler_type>::type a = boost::asio::get_associated_allocator(completion.completion_handler); typename boost::asio::associated_executor<handler_type>::type ex = boost::asio::get_associated_executor(completion.completion_handler); if (ok) { ex.post( bindns::bind( static_cast<handler_type&&>(completion.completion_handler), boost::system::error_code(), 42, 2.0), a); } else { ex.post( bindns::bind( static_cast<handler_type&&>(completion.completion_handler), boost::system::error_code(boost::asio::error::operation_aborted), 0, 0.0), a); } return completion.result.get(); } template <typename CompletionToken> typename boost::asio::async_result<boost::asio::decay_t<CompletionToken>, void(std::exception_ptr, int, double)>::return_type async_op_ex_2(bool ok, BOOST_ASIO_MOVE_ARG(CompletionToken) token) { typedef typename boost::asio::async_result<boost::asio::decay_t<CompletionToken>, void(std::exception_ptr, int, double)>::completion_handler_type handler_type; boost::asio::async_completion<CompletionToken, void(std::exception_ptr, int, double)> completion(token); typename boost::asio::associated_allocator<handler_type>::type a = boost::asio::get_associated_allocator(completion.completion_handler); typename boost::asio::associated_executor<handler_type>::type ex = boost::asio::get_associated_executor(completion.completion_handler); if (ok) { ex.post( bindns::bind( static_cast<handler_type&&>(completion.completion_handler), std::exception_ptr(), 42, 2.0), a); } else { ex.post( bindns::bind( static_cast<handler_type&&>(completion.completion_handler), std::make_exception_ptr(std::runtime_error("blah")), 0, 0.0), a); } return completion.result.get(); } template <typename CompletionToken> typename boost::asio::async_result<boost::asio::decay_t<CompletionToken>, void(int, double, char)>::return_type async_op_3(BOOST_ASIO_MOVE_ARG(CompletionToken) token) { typedef typename boost::asio::async_result<boost::asio::decay_t<CompletionToken>, void(int, double, char)>::completion_handler_type handler_type; boost::asio::async_completion<CompletionToken, void(int, double, char)> completion(token); typename boost::asio::associated_allocator<handler_type>::type a = boost::asio::get_associated_allocator(completion.completion_handler); typename boost::asio::associated_executor<handler_type>::type ex = boost::asio::get_associated_executor(completion.completion_handler); ex.post( bindns::bind( static_cast<handler_type&&>(completion.completion_handler), 42, 2.0, 'a'), a); return completion.result.get(); } template <typename CompletionToken> typename boost::asio::async_result<boost::asio::decay_t<CompletionToken>, void(boost::system::error_code, int, double, char)>::return_type async_op_ec_3(bool ok, BOOST_ASIO_MOVE_ARG(CompletionToken) token) { typedef typename boost::asio::async_result<boost::asio::decay_t<CompletionToken>, void(boost::system::error_code, int, double, char)>::completion_handler_type handler_type; boost::asio::async_completion<CompletionToken, void(boost::system::error_code, int, double, char)> completion(token); typename boost::asio::associated_allocator<handler_type>::type a = boost::asio::get_associated_allocator(completion.completion_handler); typename boost::asio::associated_executor<handler_type>::type ex = boost::asio::get_associated_executor(completion.completion_handler); if (ok) { ex.post( bindns::bind( static_cast<handler_type&&>(completion.completion_handler), boost::system::error_code(), 42, 2.0, 'a'), a); } else { ex.post( bindns::bind( static_cast<handler_type&&>(completion.completion_handler), boost::system::error_code(boost::asio::error::operation_aborted), 0, 0.0, 'z'), a); } return completion.result.get(); } template <typename CompletionToken> typename boost::asio::async_result<boost::asio::decay_t<CompletionToken>, void(std::exception_ptr, int, double, char)>::return_type async_op_ex_3(bool ok, BOOST_ASIO_MOVE_ARG(CompletionToken) token) { typedef typename boost::asio::async_result<boost::asio::decay_t<CompletionToken>, void(std::exception_ptr, int, double, char)>::completion_handler_type handler_type; boost::asio::async_completion<CompletionToken, void(std::exception_ptr, int, double, char)> completion(token); typename boost::asio::associated_allocator<handler_type>::type a = boost::asio::get_associated_allocator(completion.completion_handler); typename boost::asio::associated_executor<handler_type>::type ex = boost::asio::get_associated_executor(completion.completion_handler); if (ok) { ex.post( bindns::bind( static_cast<handler_type&&>(completion.completion_handler), std::exception_ptr(), 42, 2.0, 'a'), a); } else { ex.post( bindns::bind( static_cast<handler_type&&>(completion.completion_handler), std::make_exception_ptr(std::runtime_error("blah")), 0, 0.0, 'z'), a); } return completion.result.get(); } } // namespace archetypes #endif // ARCHETYPES_ASYNC_OPS_HPP
hpp
asio
data/projects/asio/test/execution/relationship.cpp
// // relationship.cpp // ~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/execution/relationship.hpp> #include <boost/asio/prefer.hpp> #include <boost/asio/query.hpp> #include <boost/asio/require.hpp> #include "../unit_test.hpp" namespace exec = boost::asio::execution; typedef exec::relationship_t s; typedef exec::relationship_t::fork_t n1; typedef exec::relationship_t::continuation_t n2; struct ex_nq_nr { template <typename F> void execute(const F&) const { } friend bool operator==(const ex_nq_nr&, const ex_nq_nr&) noexcept { return true; } friend bool operator!=(const ex_nq_nr&, const ex_nq_nr&) noexcept { return false; } }; #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace execution { template <> struct is_executor<ex_nq_nr> : boost::asio::true_type { }; } // namespace execution } // namespace asio } // namespace boost #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) template <typename ResultType, typename ParamType, typename Result> struct ex_cq_nr { static constexpr ResultType query(ParamType) noexcept { return Result(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_cq_nr&, const ex_cq_nr&) noexcept { return true; } friend bool operator!=(const ex_cq_nr&, const ex_cq_nr&) noexcept { return false; } }; #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace execution { template <typename ResultType, typename ParamType, typename Result> struct is_executor<ex_cq_nr<ResultType, ParamType, Result> > : boost::asio::true_type { }; } // namespace execution } // namespace asio } // namespace boost #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT) template <typename ResultType, typename ParamType, typename Result, typename Param> struct query_static_constexpr_member< ex_cq_nr<ResultType, ParamType, Result>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, ParamType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef Result result_type; // Must return raw result type. static constexpr result_type value() { return Result(); } }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename ResultType, typename ParamType, typename Result> struct ex_mq_nr { ResultType query(ParamType) const noexcept { return Result(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_mq_nr&, const ex_mq_nr&) noexcept { return true; } friend bool operator!=(const ex_mq_nr&, const ex_mq_nr&) noexcept { return false; } }; #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace execution { template <typename ResultType, typename ParamType, typename Result> struct is_executor<ex_mq_nr<ResultType, ParamType, Result> > : boost::asio::true_type { }; } // namespace execution } // namespace asio } // namespace boost #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) template <typename ResultType, typename ParamType, typename Result, typename Param> struct query_member< ex_mq_nr<ResultType, ParamType, Result>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, ParamType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ResultType result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename ResultType, typename ParamType, typename Result> struct ex_fq_nr { friend ResultType query(const ex_fq_nr&, ParamType) noexcept { return Result(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_fq_nr&, const ex_fq_nr&) noexcept { return true; } friend bool operator!=(const ex_fq_nr&, const ex_fq_nr&) noexcept { return false; } }; #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace execution { template <typename ResultType, typename ParamType, typename Result> struct is_executor<ex_fq_nr<ResultType, ParamType, Result> > : boost::asio::true_type { }; } // namespace execution } // namespace asio } // namespace boost #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) template <typename ResultType, typename ParamType, typename Result, typename Param> struct query_free< ex_fq_nr<ResultType, ParamType, Result>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, ParamType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ResultType result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename CurrentType, typename OtherType> struct ex_mq_mr { CurrentType query(CurrentType) const noexcept { return CurrentType(); } CurrentType query(OtherType) const noexcept { return CurrentType(); } ex_mq_mr<CurrentType, OtherType> require( CurrentType) const noexcept { return ex_mq_mr<CurrentType, OtherType>(); } ex_mq_mr<OtherType, CurrentType> require( OtherType) const noexcept { return ex_mq_mr<OtherType, CurrentType>(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_mq_mr&, const ex_mq_mr&) noexcept { return true; } friend bool operator!=(const ex_mq_mr&, const ex_mq_mr&) noexcept { return false; } }; template <typename CurrentType> struct ex_mq_mr<CurrentType, CurrentType> { CurrentType query(CurrentType) const noexcept { return CurrentType(); } ex_mq_mr<CurrentType, CurrentType> require( CurrentType) const noexcept { return ex_mq_mr<CurrentType, CurrentType>(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_mq_mr&, const ex_mq_mr&) noexcept { return true; } friend bool operator!=(const ex_mq_mr&, const ex_mq_mr&) noexcept { return false; } }; #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace execution { template <typename CurrentType, typename OtherType> struct is_executor<ex_mq_mr<CurrentType, OtherType> > : boost::asio::true_type { }; } // namespace execution } // namespace asio } // namespace boost #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct query_member< ex_mq_mr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value || boost::asio::is_convertible<Param, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef CurrentType result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct require_member< ex_mq_mr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_mq_mr<CurrentType, OtherType> result_type; }; template <typename CurrentType, typename OtherType, typename Param> struct require_member< ex_mq_mr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, OtherType>::value && !boost::asio::is_same<CurrentType, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_mq_mr<OtherType, CurrentType> result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename CurrentType, typename OtherType> struct ex_fq_fr { friend CurrentType query(const ex_fq_fr&, CurrentType) noexcept { return CurrentType(); } friend CurrentType query(const ex_fq_fr&, OtherType) noexcept { return CurrentType(); } friend ex_fq_fr<CurrentType, OtherType> require( const ex_fq_fr&, CurrentType) noexcept { return ex_fq_fr<CurrentType, OtherType>(); } friend ex_fq_fr<OtherType, CurrentType> require( const ex_fq_fr&, OtherType) noexcept { return ex_fq_fr<OtherType, CurrentType>(); } friend ex_fq_fr<CurrentType, OtherType> prefer( const ex_fq_fr&, CurrentType) noexcept { return ex_fq_fr<CurrentType, OtherType>(); } friend ex_fq_fr<OtherType, CurrentType> prefer( const ex_fq_fr&, OtherType) noexcept { return ex_fq_fr<OtherType, CurrentType>(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_fq_fr&, const ex_fq_fr&) noexcept { return true; } friend bool operator!=(const ex_fq_fr&, const ex_fq_fr&) noexcept { return false; } }; template <typename CurrentType> struct ex_fq_fr<CurrentType, CurrentType> { friend CurrentType query(const ex_fq_fr&, CurrentType) noexcept { return CurrentType(); } friend ex_fq_fr<CurrentType, CurrentType> require( const ex_fq_fr&, CurrentType) noexcept { return ex_fq_fr<CurrentType, CurrentType>(); } friend ex_fq_fr<CurrentType, CurrentType> prefer( const ex_fq_fr&, CurrentType) noexcept { return ex_fq_fr<CurrentType, CurrentType>(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_fq_fr&, const ex_fq_fr&) noexcept { return true; } friend bool operator!=(const ex_fq_fr&, const ex_fq_fr&) noexcept { return false; } }; #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace execution { template <typename CurrentType, typename OtherType> struct is_executor<ex_fq_fr<CurrentType, OtherType> > : boost::asio::true_type { }; } // namespace execution } // namespace asio } // namespace boost #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct query_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value || boost::asio::is_convertible<Param, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef CurrentType result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_FREE_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct require_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_fq_fr<CurrentType, OtherType> result_type; }; template <typename CurrentType, typename OtherType, typename Param> struct require_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, OtherType>::value && !boost::asio::is_same<CurrentType, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_fq_fr<OtherType, CurrentType> result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_FREE_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_PREFER_FREE_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct prefer_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_fq_fr<CurrentType, OtherType> result_type; }; template <typename CurrentType, typename OtherType, typename Param> struct prefer_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, OtherType>::value && !boost::asio::is_same<CurrentType, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_fq_fr<OtherType, CurrentType> result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_PREFER_FREE_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename Executor, typename Param, bool ExpectedResult> void test_can_query() { constexpr bool b1 = boost::asio::can_query<Executor, Param>::value; BOOST_ASIO_CHECK(b1 == ExpectedResult); constexpr bool b2 = boost::asio::can_query<const Executor, Param>::value; BOOST_ASIO_CHECK(b2 == ExpectedResult); constexpr bool b3 = boost::asio::can_query<Executor&, Param>::value; BOOST_ASIO_CHECK(b3 == ExpectedResult); constexpr bool b4 = boost::asio::can_query<const Executor&, Param>::value; BOOST_ASIO_CHECK(b4 == ExpectedResult); } template <typename Executor, typename Param, typename ExpectedResult> void test_query() { exec::relationship_t result1 = boost::asio::query(Executor(), Param()); BOOST_ASIO_CHECK(result1 == ExpectedResult()); Executor ex1 = {}; exec::relationship_t result2 = boost::asio::query(ex1, Param()); BOOST_ASIO_CHECK(result2 == ExpectedResult()); const Executor ex2 = {}; exec::relationship_t result3 = boost::asio::query(ex2, Param()); BOOST_ASIO_CHECK(result3 == ExpectedResult()); } template <typename Executor, typename Param, typename ExpectedResult> void test_constexpr_query() { constexpr Executor ex1 = {}; constexpr exec::relationship_t result1 = boost::asio::query(ex1, Param()); BOOST_ASIO_CHECK(result1 == ExpectedResult()); } template <typename Executor, typename Param, bool ExpectedResult> void test_can_require() { constexpr bool b1 = boost::asio::can_require<Executor, Param>::value; BOOST_ASIO_CHECK(b1 == ExpectedResult); constexpr bool b2 = boost::asio::can_require<const Executor, Param>::value; BOOST_ASIO_CHECK(b2 == ExpectedResult); constexpr bool b3 = boost::asio::can_require<Executor&, Param>::value; BOOST_ASIO_CHECK(b3 == ExpectedResult); constexpr bool b4 = boost::asio::can_require<const Executor&, Param>::value; BOOST_ASIO_CHECK(b4 == ExpectedResult); } template <typename Executor, typename Param, typename ExpectedResult> void test_require() { BOOST_ASIO_CHECK( boost::asio::query( boost::asio::require(Executor(), Param()), Param()) == ExpectedResult()); Executor ex1 = {}; BOOST_ASIO_CHECK( boost::asio::query( boost::asio::require(ex1, Param()), Param()) == ExpectedResult()); const Executor ex2 = {}; BOOST_ASIO_CHECK( boost::asio::query( boost::asio::require(ex2, Param()), Param()) == ExpectedResult()); } template <typename Executor, typename Param, bool ExpectedResult> void test_can_prefer() { constexpr bool b1 = boost::asio::can_prefer<Executor, Param>::value; BOOST_ASIO_CHECK(b1 == ExpectedResult); constexpr bool b2 = boost::asio::can_prefer<const Executor, Param>::value; BOOST_ASIO_CHECK(b2 == ExpectedResult); constexpr bool b3 = boost::asio::can_prefer<Executor&, Param>::value; BOOST_ASIO_CHECK(b3 == ExpectedResult); constexpr bool b4 = boost::asio::can_prefer<const Executor&, Param>::value; BOOST_ASIO_CHECK(b4 == ExpectedResult); } template <typename Executor, typename Param, typename ExpectedResult> void test_prefer() { BOOST_ASIO_CHECK( s(boost::asio::query( boost::asio::prefer(Executor(), Param()), s())) == s(ExpectedResult())); Executor ex1 = {}; BOOST_ASIO_CHECK( s(boost::asio::query( boost::asio::prefer(ex1, Param()), s())) == s(ExpectedResult())); const Executor ex2 = {}; BOOST_ASIO_CHECK( s(boost::asio::query( boost::asio::prefer(ex2, Param()), s())) == s(ExpectedResult())); } void test_vars() { BOOST_ASIO_CHECK(s() == exec::relationship); BOOST_ASIO_CHECK(s() != exec::relationship.fork); BOOST_ASIO_CHECK(s() != exec::relationship.continuation); BOOST_ASIO_CHECK(n1() == exec::relationship.fork); BOOST_ASIO_CHECK(n1() != exec::relationship.continuation); BOOST_ASIO_CHECK(n2() == exec::relationship.continuation); BOOST_ASIO_CHECK(n2() != exec::relationship.fork); } BOOST_ASIO_TEST_SUITE ( "relationship", BOOST_ASIO_TEST_CASE3(test_can_query<ex_nq_nr, s, true>) BOOST_ASIO_TEST_CASE3(test_can_query<ex_nq_nr, n1, true>) BOOST_ASIO_TEST_CASE3(test_can_query<ex_nq_nr, n2, false>) BOOST_ASIO_TEST_CASE3(test_query<ex_nq_nr, s, n1>) BOOST_ASIO_TEST_CASE3(test_query<ex_nq_nr, n1, n1>) BOOST_ASIO_TEST_CASE3(test_constexpr_query<ex_nq_nr, s, n1>) BOOST_ASIO_TEST_CASE3(test_constexpr_query<ex_nq_nr, n1, n1>) BOOST_ASIO_TEST_CASE3(test_can_require<ex_nq_nr, s, false>) BOOST_ASIO_TEST_CASE3(test_can_require<ex_nq_nr, n1, true>) BOOST_ASIO_TEST_CASE3(test_can_require<ex_nq_nr, n2, false>) BOOST_ASIO_TEST_CASE3(test_require<ex_nq_nr, n1, n1>) BOOST_ASIO_TEST_CASE3(test_can_prefer<ex_nq_nr, s, false>) BOOST_ASIO_TEST_CASE3(test_can_prefer<ex_nq_nr, n1, true>) BOOST_ASIO_TEST_CASE3(test_can_prefer<ex_nq_nr, n2, true>) BOOST_ASIO_TEST_CASE3(test_prefer<ex_nq_nr, n1, n1>) BOOST_ASIO_TEST_CASE3(test_prefer<ex_nq_nr, n2, n1>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n1, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n2, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n1, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n2, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n1, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n2, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n1, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n2, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n1, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n2, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n1, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n2, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n1, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n2, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n1, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n2, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n1, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n2, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n1, s, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n1, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n2, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n2, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n1, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n2, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n1, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n2, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n1, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n2, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n1, s, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n1, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n2, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n2, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n1>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n2>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n1>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n2>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n1, n2>, s, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n2, n1>, s, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n1>, n2, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n1>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n2>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n1>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n2>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n1, n2>, s, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n2, n1>, s, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n1>, n2, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE(test_vars) )
cpp
asio
data/projects/asio/test/execution/executor.cpp
// // executor.cpp // ~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/execution/executor.hpp> #include "../unit_test.hpp" struct not_an_executor { }; struct executor { executor() { } executor(const executor&) noexcept { } executor(executor&&) noexcept { } template <typename F> void execute(F&& f) const noexcept { (void)f; } bool operator==(const executor&) const noexcept { return true; } bool operator!=(const executor&) const noexcept { return false; } }; namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) template <typename F> struct execute_member<executor, F> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef void result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_SET_ERROR_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) template <> struct equality_comparable<executor> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) } // namespace traits } // namespace asio } // namespace boost void is_executor_test() { BOOST_ASIO_CHECK(( !boost::asio::execution::is_executor< void >::value)); BOOST_ASIO_CHECK(( !boost::asio::execution::is_executor< not_an_executor >::value)); BOOST_ASIO_CHECK(( boost::asio::execution::is_executor< executor >::value)); } BOOST_ASIO_TEST_SUITE ( "executor", BOOST_ASIO_TEST_CASE(is_executor_test) )
cpp
asio
data/projects/asio/test/execution/blocking_adaptation.cpp
// // blocking_adaptation.cpp // ~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/execution/blocking_adaptation.hpp> #include <boost/asio/prefer.hpp> #include <boost/asio/query.hpp> #include <boost/asio/require.hpp> #include "../unit_test.hpp" namespace exec = boost::asio::execution; typedef exec::blocking_adaptation_t s; typedef exec::blocking_adaptation_t::disallowed_t n1; typedef exec::blocking_adaptation_t::allowed_t n2; struct ex_nq_nr { template <typename F> void execute(const F&) const { } friend bool operator==(const ex_nq_nr&, const ex_nq_nr&) noexcept { return true; } friend bool operator!=(const ex_nq_nr&, const ex_nq_nr&) noexcept { return false; } }; namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) template <> struct equality_comparable<ex_nq_nr> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) template <typename Function> struct execute_member<ex_nq_nr, Function> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = false; typedef void result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename ResultType, typename ParamType, typename Result> struct ex_cq_nr { static constexpr ResultType query(ParamType) noexcept { return Result(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_cq_nr&, const ex_cq_nr&) noexcept { return true; } friend bool operator!=(const ex_cq_nr&, const ex_cq_nr&) noexcept { return false; } }; namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) template <typename ResultType, typename ParamType, typename Result> struct equality_comparable<ex_cq_nr<ResultType, ParamType, Result> > { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) template <typename ResultType, typename ParamType, typename Result, typename Function> struct execute_member<ex_cq_nr<ResultType, ParamType, Result>, Function> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = false; typedef void result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT) template <typename ResultType, typename ParamType, typename Result, typename Param> struct query_static_constexpr_member< ex_cq_nr<ResultType, ParamType, Result>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, ParamType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef Result result_type; // Must return raw result type. static constexpr result_type value() { return Result(); } }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename ResultType, typename ParamType, typename Result> struct ex_mq_nr { ResultType query(ParamType) const noexcept { return Result(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_mq_nr&, const ex_mq_nr&) noexcept { return true; } friend bool operator!=(const ex_mq_nr&, const ex_mq_nr&) noexcept { return false; } }; namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) template <typename ResultType, typename ParamType, typename Result> struct equality_comparable<ex_mq_nr<ResultType, ParamType, Result> > { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) template <typename ResultType, typename ParamType, typename Result, typename Function> struct execute_member<ex_mq_nr<ResultType, ParamType, Result>, Function> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = false; typedef void result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) template <typename ResultType, typename ParamType, typename Result, typename Param> struct query_member< ex_mq_nr<ResultType, ParamType, Result>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, ParamType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ResultType result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename ResultType, typename ParamType, typename Result> struct ex_fq_nr { friend ResultType query(const ex_fq_nr&, ParamType) noexcept { return Result(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_fq_nr&, const ex_fq_nr&) noexcept { return true; } friend bool operator!=(const ex_fq_nr&, const ex_fq_nr&) noexcept { return false; } }; namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) template <typename ResultType, typename ParamType, typename Result> struct equality_comparable<ex_fq_nr<ResultType, ParamType, Result> > { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) template <typename ResultType, typename ParamType, typename Result, typename Function> struct execute_member<ex_fq_nr<ResultType, ParamType, Result>, Function> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = false; typedef void result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) template <typename ResultType, typename ParamType, typename Result, typename Param> struct query_free< ex_fq_nr<ResultType, ParamType, Result>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, ParamType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ResultType result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename CurrentType, typename OtherType> struct ex_mq_mr { CurrentType query(CurrentType) const noexcept { return CurrentType(); } CurrentType query(OtherType) const noexcept { return CurrentType(); } ex_mq_mr<CurrentType, OtherType> require( CurrentType) const noexcept { return ex_mq_mr<CurrentType, OtherType>(); } ex_mq_mr<OtherType, CurrentType> require( OtherType) const noexcept { return ex_mq_mr<OtherType, CurrentType>(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_mq_mr&, const ex_mq_mr&) noexcept { return true; } friend bool operator!=(const ex_mq_mr&, const ex_mq_mr&) noexcept { return false; } }; template <typename CurrentType> struct ex_mq_mr<CurrentType, CurrentType> { CurrentType query(CurrentType) const noexcept { return CurrentType(); } ex_mq_mr<CurrentType, CurrentType> require( CurrentType) const noexcept { return ex_mq_mr<CurrentType, CurrentType>(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_mq_mr&, const ex_mq_mr&) noexcept { return true; } friend bool operator!=(const ex_mq_mr&, const ex_mq_mr&) noexcept { return false; } }; namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) template <typename CurrentType, typename OtherType> struct equality_comparable<ex_mq_mr<CurrentType, OtherType> > { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) template <typename CurrentType, typename OtherType, typename Function> struct execute_member<ex_mq_mr<CurrentType, OtherType>, Function> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = false; typedef void result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct query_member< ex_mq_mr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value || boost::asio::is_convertible<Param, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef CurrentType result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct require_member< ex_mq_mr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_mq_mr<CurrentType, OtherType> result_type; }; template <typename CurrentType, typename OtherType, typename Param> struct require_member< ex_mq_mr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, OtherType>::value && !boost::asio::is_same<CurrentType, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_mq_mr<OtherType, CurrentType> result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename CurrentType, typename OtherType> struct ex_fq_fr { friend CurrentType query(const ex_fq_fr&, CurrentType) noexcept { return CurrentType(); } friend CurrentType query(const ex_fq_fr&, OtherType) noexcept { return CurrentType(); } friend ex_fq_fr<CurrentType, OtherType> require( const ex_fq_fr&, CurrentType) noexcept { return ex_fq_fr<CurrentType, OtherType>(); } friend ex_fq_fr<OtherType, CurrentType> require( const ex_fq_fr&, OtherType) noexcept { return ex_fq_fr<OtherType, CurrentType>(); } friend ex_fq_fr<CurrentType, OtherType> prefer( const ex_fq_fr&, CurrentType) noexcept { return ex_fq_fr<CurrentType, OtherType>(); } friend ex_fq_fr<OtherType, CurrentType> prefer( const ex_fq_fr&, OtherType) noexcept { return ex_fq_fr<OtherType, CurrentType>(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_fq_fr&, const ex_fq_fr&) noexcept { return true; } friend bool operator!=(const ex_fq_fr&, const ex_fq_fr&) noexcept { return false; } }; template <typename CurrentType> struct ex_fq_fr<CurrentType, CurrentType> { friend CurrentType query(const ex_fq_fr&, CurrentType) noexcept { return CurrentType(); } friend ex_fq_fr<CurrentType, CurrentType> require( const ex_fq_fr&, CurrentType) noexcept { return ex_fq_fr<CurrentType, CurrentType>(); } friend ex_fq_fr<CurrentType, CurrentType> prefer( const ex_fq_fr&, CurrentType) noexcept { return ex_fq_fr<CurrentType, CurrentType>(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_fq_fr&, const ex_fq_fr&) noexcept { return true; } friend bool operator!=(const ex_fq_fr&, const ex_fq_fr&) noexcept { return false; } }; namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) template <typename CurrentType, typename OtherType> struct equality_comparable<ex_fq_fr<CurrentType, OtherType> > { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) template <typename CurrentType, typename OtherType, typename Function> struct execute_member<ex_fq_fr<CurrentType, OtherType>, Function> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = false; typedef void result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct query_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value || boost::asio::is_convertible<Param, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef CurrentType result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_FREE_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct require_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_fq_fr<CurrentType, OtherType> result_type; }; template <typename CurrentType, typename OtherType, typename Param> struct require_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, OtherType>::value && !boost::asio::is_same<CurrentType, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_fq_fr<OtherType, CurrentType> result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_FREE_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_PREFER_FREE_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct prefer_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_fq_fr<CurrentType, OtherType> result_type; }; template <typename CurrentType, typename OtherType, typename Param> struct prefer_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, OtherType>::value && !boost::asio::is_same<CurrentType, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_fq_fr<OtherType, CurrentType> result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_PREFER_FREE_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename Executor, typename Param, bool ExpectedResult> void test_can_query() { constexpr bool b1 = boost::asio::can_query<Executor, Param>::value; BOOST_ASIO_CHECK(b1 == ExpectedResult); constexpr bool b2 = boost::asio::can_query<const Executor, Param>::value; BOOST_ASIO_CHECK(b2 == ExpectedResult); constexpr bool b3 = boost::asio::can_query<Executor&, Param>::value; BOOST_ASIO_CHECK(b3 == ExpectedResult); constexpr bool b4 = boost::asio::can_query<const Executor&, Param>::value; BOOST_ASIO_CHECK(b4 == ExpectedResult); } template <typename Executor, typename Param, typename ExpectedResult> void test_query() { exec::blocking_adaptation_t result1 = boost::asio::query(Executor(), Param()); BOOST_ASIO_CHECK(result1 == ExpectedResult()); Executor ex1 = {}; exec::blocking_adaptation_t result2 = boost::asio::query(ex1, Param()); BOOST_ASIO_CHECK(result2 == ExpectedResult()); const Executor ex2 = {}; exec::blocking_adaptation_t result3 = boost::asio::query(ex2, Param()); BOOST_ASIO_CHECK(result3 == ExpectedResult()); } template <typename Executor, typename Param, typename ExpectedResult> void test_constexpr_query() { constexpr Executor ex1 = {}; constexpr exec::blocking_adaptation_t result1 = boost::asio::query(ex1, Param()); BOOST_ASIO_CHECK(result1 == ExpectedResult()); } template <typename Executor, typename Param, bool ExpectedResult> void test_can_require() { constexpr bool b1 = boost::asio::can_require<Executor, Param>::value; BOOST_ASIO_CHECK(b1 == ExpectedResult); constexpr bool b2 = boost::asio::can_require<const Executor, Param>::value; BOOST_ASIO_CHECK(b2 == ExpectedResult); constexpr bool b3 = boost::asio::can_require<Executor&, Param>::value; BOOST_ASIO_CHECK(b3 == ExpectedResult); constexpr bool b4 = boost::asio::can_require<const Executor&, Param>::value; BOOST_ASIO_CHECK(b4 == ExpectedResult); } void do_nothing() { } template <typename Executor, typename Param, typename ExpectedResult> void test_require() { BOOST_ASIO_CHECK( boost::asio::query( boost::asio::require(Executor(), Param()), Param()) == ExpectedResult()); Executor ex1 = {}; BOOST_ASIO_CHECK( boost::asio::query( boost::asio::require(ex1, Param()), Param()) == ExpectedResult()); BOOST_ASIO_CHECK(( boost::asio::execution::is_executor< typename boost::asio::decay< typename boost::asio::require_result<Executor&, Param>::type >::type >::value)); const Executor ex2 = {}; BOOST_ASIO_CHECK( boost::asio::query( boost::asio::require(ex2, Param()), Param()) == ExpectedResult()); BOOST_ASIO_CHECK(( boost::asio::execution::is_executor< typename boost::asio::decay< typename boost::asio::require_result<const Executor&, Param>::type >::type >::value)); } template <typename Executor, typename Param, bool ExpectedResult> void test_can_prefer() { constexpr bool b1 = boost::asio::can_prefer<Executor, Param>::value; BOOST_ASIO_CHECK(b1 == ExpectedResult); constexpr bool b2 = boost::asio::can_prefer<const Executor, Param>::value; BOOST_ASIO_CHECK(b2 == ExpectedResult); constexpr bool b3 = boost::asio::can_prefer<Executor&, Param>::value; BOOST_ASIO_CHECK(b3 == ExpectedResult); constexpr bool b4 = boost::asio::can_prefer<const Executor&, Param>::value; BOOST_ASIO_CHECK(b4 == ExpectedResult); } template <typename Executor, typename Param, typename ExpectedResult> void test_prefer() { BOOST_ASIO_CHECK( s(boost::asio::query( boost::asio::prefer(Executor(), Param()), s())) == s(ExpectedResult())); Executor ex1 = {}; BOOST_ASIO_CHECK( s(boost::asio::query( boost::asio::prefer(ex1, Param()), s())) == s(ExpectedResult())); const Executor ex2 = {}; BOOST_ASIO_CHECK( s(boost::asio::query( boost::asio::prefer(ex2, Param()), s())) == s(ExpectedResult())); } void test_vars() { BOOST_ASIO_CHECK(s() == exec::blocking_adaptation); BOOST_ASIO_CHECK(s() != exec::blocking_adaptation.disallowed); BOOST_ASIO_CHECK(s() != exec::blocking_adaptation.allowed); BOOST_ASIO_CHECK(n1() == exec::blocking_adaptation.disallowed); BOOST_ASIO_CHECK(n1() != exec::blocking_adaptation.allowed); BOOST_ASIO_CHECK(n2() == exec::blocking_adaptation.allowed); BOOST_ASIO_CHECK(n2() != exec::blocking_adaptation.disallowed); } BOOST_ASIO_TEST_SUITE ( "blocking_adaptation", BOOST_ASIO_TEST_CASE3(test_can_query<ex_nq_nr, s, true>) BOOST_ASIO_TEST_CASE3(test_can_query<ex_nq_nr, n1, true>) BOOST_ASIO_TEST_CASE3(test_can_query<ex_nq_nr, n2, false>) BOOST_ASIO_TEST_CASE3(test_query<ex_nq_nr, s, n1>) BOOST_ASIO_TEST_CASE3(test_query<ex_nq_nr, n1, n1>) BOOST_ASIO_TEST_CASE3(test_constexpr_query<ex_nq_nr, s, n1>) BOOST_ASIO_TEST_CASE3(test_constexpr_query<ex_nq_nr, n1, n1>) BOOST_ASIO_TEST_CASE3(test_can_require<ex_nq_nr, s, false>) BOOST_ASIO_TEST_CASE3(test_can_require<ex_nq_nr, n1, true>) BOOST_ASIO_TEST_CASE3(test_can_require<ex_nq_nr, n2, true>) BOOST_ASIO_TEST_CASE3(test_require<ex_nq_nr, n1, n1>) BOOST_ASIO_TEST_CASE3(test_require<ex_nq_nr, n2, n2>) BOOST_ASIO_TEST_CASE3(test_can_prefer<ex_nq_nr, s, false>) BOOST_ASIO_TEST_CASE3(test_can_prefer<ex_nq_nr, n1, true>) BOOST_ASIO_TEST_CASE3(test_can_prefer<ex_nq_nr, n2, false>) BOOST_ASIO_TEST_CASE3(test_prefer<ex_nq_nr, n1, n1>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n1, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n2, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n1, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n2, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n1, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n2, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n1, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n2, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n1, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n2, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n2, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, s, n1>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, n1, n1>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<n1, s, n1>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n1, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n2, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n1, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n2, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n1, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n2, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n1, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n2, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n1, s, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n2, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_require<ex_mq_nr<s, s, n1>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_mq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_mq_nr<s, n1, n1>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_mq_nr<s, n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_mq_nr<s, n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_mq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_mq_nr<n1, s, n1>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_mq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n1, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n2, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n1, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n2, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n1, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n2, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n1, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n2, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n1, s, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n2, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_require<ex_fq_nr<s, s, n1>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_fq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_fq_nr<s, n1, n1>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_fq_nr<s, n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_fq_nr<s, n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_fq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_fq_nr<n1, s, n1>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_fq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n1, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n2, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n1>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n2>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n1>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n2>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n1, n2>, s, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n2, n1>, s, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n1, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n2>, n2, false>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n1>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n2>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n1>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n2>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n1, n2>, s, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n2, n1>, s, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n1, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n2>, n2, false>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE(test_vars) )
cpp
asio
data/projects/asio/test/execution/any_executor.cpp
// // any_executor.cpp // ~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/execution/any_executor.hpp> #include <cstring> #include <functional> #include <boost/asio/thread_pool.hpp> #include "../unit_test.hpp" using namespace boost::asio; namespace bindns = std; static bool next_nothrow_new_fails = false; void* operator new(std::size_t n, const std::nothrow_t&) noexcept { if (next_nothrow_new_fails) { next_nothrow_new_fails = false; return 0; } return ::operator new(n); } struct fat_executor { fat_executor(int id) : id_(id) { std::memset(data_, 0, sizeof(data_)); } template <typename F> void execute(const F&) const { } std::size_t query(execution::occupancy_t) const { return 1; } friend bool operator==(const fat_executor& a, const fat_executor& b) noexcept { return a.id_ == b.id_; } friend bool operator!=(const fat_executor& a, const fat_executor& b) noexcept { return a.id_ != b.id_; } int id_; unsigned char data_[1024]; }; namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) template <typename F> struct execute_member<fat_executor, F> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef void result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) template <> struct query_member<fat_executor, execution::occupancy_t> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = false; typedef std::size_t result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) template <> struct equality_comparable<fat_executor> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) } // namespace traits } // namespace asio } // namespace boost void increment(int* count) { ++(*count); } void any_executor_construction_test() { typedef execution::any_executor<> ex_no_props_t; typedef execution::any_executor< execution::blocking_t > ex_one_prop_t; typedef execution::any_executor< execution::blocking_t, execution::occupancy_t > ex_two_props_t; thread_pool pool(1); boost::asio::nullptr_t null_ptr = boost::asio::nullptr_t(); ex_two_props_t ex_two_props_1; BOOST_ASIO_CHECK(ex_two_props_1.target<void>() == 0); BOOST_ASIO_CHECK(ex_two_props_1 == null_ptr); ex_two_props_t ex_two_props_2(null_ptr); BOOST_ASIO_CHECK(ex_two_props_2.target<void>() == 0); BOOST_ASIO_CHECK(ex_two_props_2 == null_ptr); BOOST_ASIO_CHECK(ex_two_props_2 == ex_two_props_1); ex_two_props_t ex_two_props_3(pool.executor()); BOOST_ASIO_CHECK(ex_two_props_3.target<void>() != 0); BOOST_ASIO_CHECK(ex_two_props_3 != null_ptr); BOOST_ASIO_CHECK(ex_two_props_3 != ex_two_props_1); ex_two_props_t ex_two_props_4(ex_two_props_1); BOOST_ASIO_CHECK(ex_two_props_4.target<void>() == 0); BOOST_ASIO_CHECK(ex_two_props_4 == null_ptr); BOOST_ASIO_CHECK(ex_two_props_4 == ex_two_props_1); ex_two_props_t ex_two_props_5(ex_two_props_3); BOOST_ASIO_CHECK(ex_two_props_5.target<void>() != 0); BOOST_ASIO_CHECK(ex_two_props_5 != null_ptr); BOOST_ASIO_CHECK(ex_two_props_5 == ex_two_props_3); ex_two_props_t ex_two_props_6 = fat_executor(1); BOOST_ASIO_CHECK(ex_two_props_6.target<void>() != 0); BOOST_ASIO_CHECK(ex_two_props_6 != null_ptr); BOOST_ASIO_CHECK(ex_two_props_6 != ex_two_props_1); ex_two_props_t ex_two_props_7 = fat_executor(1); BOOST_ASIO_CHECK(ex_two_props_7.target<void>() != 0); BOOST_ASIO_CHECK(ex_two_props_7 != null_ptr); BOOST_ASIO_CHECK(ex_two_props_7 != ex_two_props_1); BOOST_ASIO_CHECK(ex_two_props_7 == ex_two_props_6); ex_two_props_t ex_two_props_8 = fat_executor(2); BOOST_ASIO_CHECK(ex_two_props_8.target<void>() != 0); BOOST_ASIO_CHECK(ex_two_props_8 != null_ptr); BOOST_ASIO_CHECK(ex_two_props_8 != ex_two_props_1); BOOST_ASIO_CHECK(ex_two_props_8 != ex_two_props_6); BOOST_ASIO_CHECK(ex_two_props_8 != ex_two_props_7); ex_two_props_t ex_two_props_9(ex_two_props_6); BOOST_ASIO_CHECK(ex_two_props_9.target<void>() != 0); BOOST_ASIO_CHECK(ex_two_props_9 != null_ptr); BOOST_ASIO_CHECK(ex_two_props_9 != ex_two_props_1); BOOST_ASIO_CHECK(ex_two_props_9 == ex_two_props_6); BOOST_ASIO_CHECK(ex_two_props_9 == ex_two_props_7); BOOST_ASIO_CHECK(ex_two_props_9 != ex_two_props_8); ex_two_props_t ex_two_props_10(std::move(ex_two_props_1)); BOOST_ASIO_CHECK(ex_two_props_10.target<void>() == 0); BOOST_ASIO_CHECK(ex_two_props_10 == null_ptr); BOOST_ASIO_CHECK(ex_two_props_1.target<void>() == 0); BOOST_ASIO_CHECK(ex_two_props_1 == null_ptr); ex_two_props_t ex_two_props_11(std::move(ex_two_props_3)); BOOST_ASIO_CHECK(ex_two_props_11.target<void>() != 0); BOOST_ASIO_CHECK(ex_two_props_11 != null_ptr); BOOST_ASIO_CHECK(ex_two_props_3.target<void>() == 0); BOOST_ASIO_CHECK(ex_two_props_3 == null_ptr); BOOST_ASIO_CHECK(ex_two_props_11 == ex_two_props_5); ex_two_props_t ex_two_props_12(std::move(ex_two_props_7)); BOOST_ASIO_CHECK(ex_two_props_12.target<void>() != 0); BOOST_ASIO_CHECK(ex_two_props_12 != null_ptr); BOOST_ASIO_CHECK(ex_two_props_7.target<void>() == 0); BOOST_ASIO_CHECK(ex_two_props_7 == null_ptr); BOOST_ASIO_CHECK(ex_two_props_12 == ex_two_props_6); BOOST_ASIO_CHECK(ex_two_props_12 != ex_two_props_8); ex_one_prop_t ex_one_prop_1; BOOST_ASIO_CHECK(ex_one_prop_1.target<void>() == 0); BOOST_ASIO_CHECK(ex_one_prop_1 == null_ptr); ex_one_prop_t ex_one_prop_2(null_ptr); BOOST_ASIO_CHECK(ex_one_prop_2.target<void>() == 0); BOOST_ASIO_CHECK(ex_one_prop_2 == null_ptr); BOOST_ASIO_CHECK(ex_one_prop_2 == ex_one_prop_1); ex_one_prop_t ex_one_prop_3(pool.executor()); BOOST_ASIO_CHECK(ex_one_prop_3.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_3 != null_ptr); BOOST_ASIO_CHECK(ex_one_prop_3 != ex_one_prop_1); ex_one_prop_t ex_one_prop_4(ex_one_prop_1); BOOST_ASIO_CHECK(ex_one_prop_4.target<void>() == 0); BOOST_ASIO_CHECK(ex_one_prop_4 == null_ptr); BOOST_ASIO_CHECK(ex_one_prop_4 == ex_one_prop_1); ex_one_prop_t ex_one_prop_5(ex_one_prop_3); BOOST_ASIO_CHECK(ex_one_prop_5.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_5 != null_ptr); BOOST_ASIO_CHECK(ex_one_prop_5 == ex_one_prop_3); ex_one_prop_t ex_one_prop_6 = fat_executor(1); BOOST_ASIO_CHECK(ex_one_prop_6.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_6 != null_ptr); BOOST_ASIO_CHECK(ex_one_prop_6 != ex_one_prop_1); ex_one_prop_t ex_one_prop_7 = fat_executor(1); BOOST_ASIO_CHECK(ex_one_prop_7.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_7 != null_ptr); BOOST_ASIO_CHECK(ex_one_prop_7 != ex_one_prop_1); BOOST_ASIO_CHECK(ex_one_prop_7 == ex_one_prop_6); ex_one_prop_t ex_one_prop_8 = fat_executor(2); BOOST_ASIO_CHECK(ex_one_prop_8.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_8 != null_ptr); BOOST_ASIO_CHECK(ex_one_prop_8 != ex_one_prop_1); BOOST_ASIO_CHECK(ex_one_prop_8 != ex_one_prop_6); BOOST_ASIO_CHECK(ex_one_prop_8 != ex_one_prop_7); ex_one_prop_t ex_one_prop_9(ex_one_prop_6); BOOST_ASIO_CHECK(ex_one_prop_9.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_9 != null_ptr); BOOST_ASIO_CHECK(ex_one_prop_9 != ex_one_prop_1); BOOST_ASIO_CHECK(ex_one_prop_9 == ex_one_prop_6); BOOST_ASIO_CHECK(ex_one_prop_9 == ex_one_prop_7); BOOST_ASIO_CHECK(ex_one_prop_9 != ex_one_prop_8); ex_one_prop_t ex_one_prop_10(std::move(ex_one_prop_1)); BOOST_ASIO_CHECK(ex_one_prop_10.target<void>() == 0); BOOST_ASIO_CHECK(ex_one_prop_10 == null_ptr); BOOST_ASIO_CHECK(ex_one_prop_1.target<void>() == 0); BOOST_ASIO_CHECK(ex_one_prop_1 == null_ptr); ex_one_prop_t ex_one_prop_11(std::move(ex_one_prop_3)); BOOST_ASIO_CHECK(ex_one_prop_11.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_11 != null_ptr); BOOST_ASIO_CHECK(ex_one_prop_3.target<void>() == 0); BOOST_ASIO_CHECK(ex_one_prop_3 == null_ptr); BOOST_ASIO_CHECK(ex_one_prop_11 == ex_one_prop_5); ex_one_prop_t ex_one_prop_12(std::move(ex_one_prop_7)); BOOST_ASIO_CHECK(ex_one_prop_12.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_12 != null_ptr); BOOST_ASIO_CHECK(ex_one_prop_7.target<void>() == 0); BOOST_ASIO_CHECK(ex_one_prop_7 == null_ptr); BOOST_ASIO_CHECK(ex_one_prop_12 == ex_one_prop_6); BOOST_ASIO_CHECK(ex_one_prop_12 != ex_one_prop_8); ex_one_prop_t ex_one_prop_13(ex_two_props_1); BOOST_ASIO_CHECK(ex_one_prop_13.target<void>() == 0); BOOST_ASIO_CHECK(ex_one_prop_13 == null_ptr); ex_one_prop_t ex_one_prop_14(ex_two_props_5); BOOST_ASIO_CHECK(ex_one_prop_14.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_14 != null_ptr); ex_one_prop_t ex_one_prop_15(ex_two_props_9); BOOST_ASIO_CHECK(ex_one_prop_15.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_15 != null_ptr); ex_no_props_t ex_no_props_1; BOOST_ASIO_CHECK(ex_no_props_1.target<void>() == 0); BOOST_ASIO_CHECK(ex_no_props_1 == null_ptr); ex_no_props_t ex_no_props_2(null_ptr); BOOST_ASIO_CHECK(ex_no_props_2.target<void>() == 0); BOOST_ASIO_CHECK(ex_no_props_2 == null_ptr); BOOST_ASIO_CHECK(ex_no_props_2 == ex_no_props_1); ex_no_props_t ex_no_props_3(pool.executor()); BOOST_ASIO_CHECK(ex_no_props_3.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_3 != null_ptr); BOOST_ASIO_CHECK(ex_no_props_3 != ex_no_props_1); ex_no_props_t ex_no_props_4(ex_no_props_1); BOOST_ASIO_CHECK(ex_no_props_4.target<void>() == 0); BOOST_ASIO_CHECK(ex_no_props_4 == null_ptr); BOOST_ASIO_CHECK(ex_no_props_4 == ex_no_props_1); ex_no_props_t ex_no_props_5(ex_no_props_3); BOOST_ASIO_CHECK(ex_no_props_5.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_5 != null_ptr); BOOST_ASIO_CHECK(ex_no_props_5 == ex_no_props_3); ex_no_props_t ex_no_props_6 = fat_executor(1); BOOST_ASIO_CHECK(ex_no_props_6.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_6 != null_ptr); BOOST_ASIO_CHECK(ex_no_props_6 != ex_no_props_1); ex_no_props_t ex_no_props_7 = fat_executor(1); BOOST_ASIO_CHECK(ex_no_props_7.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_7 != null_ptr); BOOST_ASIO_CHECK(ex_no_props_7 != ex_no_props_1); BOOST_ASIO_CHECK(ex_no_props_7 == ex_no_props_6); ex_no_props_t ex_no_props_8 = fat_executor(2); BOOST_ASIO_CHECK(ex_no_props_8.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_8 != null_ptr); BOOST_ASIO_CHECK(ex_no_props_8 != ex_no_props_1); BOOST_ASIO_CHECK(ex_no_props_8 != ex_no_props_6); BOOST_ASIO_CHECK(ex_no_props_8 != ex_no_props_7); ex_no_props_t ex_no_props_9(ex_no_props_6); BOOST_ASIO_CHECK(ex_no_props_9.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_9 != null_ptr); BOOST_ASIO_CHECK(ex_no_props_9 != ex_no_props_1); BOOST_ASIO_CHECK(ex_no_props_9 == ex_no_props_6); BOOST_ASIO_CHECK(ex_no_props_9 == ex_no_props_7); BOOST_ASIO_CHECK(ex_no_props_9 != ex_no_props_8); ex_no_props_t ex_no_props_10(std::move(ex_no_props_1)); BOOST_ASIO_CHECK(ex_no_props_10.target<void>() == 0); BOOST_ASIO_CHECK(ex_no_props_10 == null_ptr); BOOST_ASIO_CHECK(ex_no_props_1.target<void>() == 0); BOOST_ASIO_CHECK(ex_no_props_1 == null_ptr); ex_no_props_t ex_no_props_11(std::move(ex_no_props_3)); BOOST_ASIO_CHECK(ex_no_props_11.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_11 != null_ptr); BOOST_ASIO_CHECK(ex_no_props_3.target<void>() == 0); BOOST_ASIO_CHECK(ex_no_props_3 == null_ptr); BOOST_ASIO_CHECK(ex_no_props_11 == ex_no_props_5); ex_no_props_t ex_no_props_12(std::move(ex_no_props_7)); BOOST_ASIO_CHECK(ex_no_props_12.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_12 != null_ptr); BOOST_ASIO_CHECK(ex_no_props_7.target<void>() == 0); BOOST_ASIO_CHECK(ex_no_props_7 == null_ptr); BOOST_ASIO_CHECK(ex_no_props_12 == ex_no_props_6); BOOST_ASIO_CHECK(ex_no_props_12 != ex_no_props_8); ex_no_props_t ex_no_props_13(ex_two_props_1); BOOST_ASIO_CHECK(ex_no_props_13.target<void>() == 0); BOOST_ASIO_CHECK(ex_no_props_13 == null_ptr); ex_no_props_t ex_no_props_14(ex_two_props_5); BOOST_ASIO_CHECK(ex_no_props_14.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_14 != null_ptr); ex_no_props_t ex_no_props_15(ex_two_props_9); BOOST_ASIO_CHECK(ex_no_props_15.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_15 != null_ptr); ex_no_props_t ex_no_props_16(ex_one_prop_1); BOOST_ASIO_CHECK(ex_no_props_16.target<void>() == 0); BOOST_ASIO_CHECK(ex_no_props_16 == null_ptr); ex_no_props_t ex_no_props_17(ex_one_prop_5); BOOST_ASIO_CHECK(ex_no_props_17.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_17 != null_ptr); ex_no_props_t ex_no_props_18(ex_one_prop_9); BOOST_ASIO_CHECK(ex_no_props_18.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_18 != null_ptr); } void any_executor_nothrow_construction_test() { typedef execution::any_executor<> ex_no_props_t; typedef execution::any_executor< execution::blocking_t > ex_one_prop_t; typedef execution::any_executor< execution::blocking_t, execution::occupancy_t > ex_two_props_t; thread_pool pool(1); boost::asio::nullptr_t null_ptr = boost::asio::nullptr_t(); ex_two_props_t ex_two_props_1; BOOST_ASIO_CHECK(ex_two_props_1.target<void>() == 0); BOOST_ASIO_CHECK(ex_two_props_1 == null_ptr); ex_two_props_t ex_two_props_2(null_ptr); BOOST_ASIO_CHECK(ex_two_props_2.target<void>() == 0); BOOST_ASIO_CHECK(ex_two_props_2 == null_ptr); BOOST_ASIO_CHECK(ex_two_props_2 == ex_two_props_1); ex_two_props_t ex_two_props_3(std::nothrow, pool.executor()); BOOST_ASIO_CHECK(ex_two_props_3.target<void>() != 0); BOOST_ASIO_CHECK(ex_two_props_3 != null_ptr); BOOST_ASIO_CHECK(ex_two_props_3 != ex_two_props_1); ex_two_props_t ex_two_props_4(std::nothrow, ex_two_props_1); BOOST_ASIO_CHECK(ex_two_props_4.target<void>() == 0); BOOST_ASIO_CHECK(ex_two_props_4 == null_ptr); BOOST_ASIO_CHECK(ex_two_props_4 == ex_two_props_1); ex_two_props_t ex_two_props_5(std::nothrow, ex_two_props_3); BOOST_ASIO_CHECK(ex_two_props_5.target<void>() != 0); BOOST_ASIO_CHECK(ex_two_props_5 != null_ptr); BOOST_ASIO_CHECK(ex_two_props_5 == ex_two_props_3); ex_two_props_t ex_two_props_6(std::nothrow, fat_executor(1)); BOOST_ASIO_CHECK(ex_two_props_6.target<void>() != 0); BOOST_ASIO_CHECK(ex_two_props_6 != null_ptr); BOOST_ASIO_CHECK(ex_two_props_6 != ex_two_props_1); ex_two_props_t ex_two_props_7(std::nothrow, fat_executor(1)); BOOST_ASIO_CHECK(ex_two_props_7.target<void>() != 0); BOOST_ASIO_CHECK(ex_two_props_7 != null_ptr); BOOST_ASIO_CHECK(ex_two_props_7 != ex_two_props_1); BOOST_ASIO_CHECK(ex_two_props_7 == ex_two_props_6); ex_two_props_t ex_two_props_8(std::nothrow, fat_executor(2)); BOOST_ASIO_CHECK(ex_two_props_8.target<void>() != 0); BOOST_ASIO_CHECK(ex_two_props_8 != null_ptr); BOOST_ASIO_CHECK(ex_two_props_8 != ex_two_props_1); BOOST_ASIO_CHECK(ex_two_props_8 != ex_two_props_6); BOOST_ASIO_CHECK(ex_two_props_8 != ex_two_props_7); ex_two_props_t ex_two_props_9(std::nothrow, ex_two_props_6); BOOST_ASIO_CHECK(ex_two_props_9.target<void>() != 0); BOOST_ASIO_CHECK(ex_two_props_9 != null_ptr); BOOST_ASIO_CHECK(ex_two_props_9 != ex_two_props_1); BOOST_ASIO_CHECK(ex_two_props_9 == ex_two_props_6); BOOST_ASIO_CHECK(ex_two_props_9 == ex_two_props_7); BOOST_ASIO_CHECK(ex_two_props_9 != ex_two_props_8); ex_two_props_t ex_two_props_10(std::nothrow, std::move(ex_two_props_1)); BOOST_ASIO_CHECK(ex_two_props_10.target<void>() == 0); BOOST_ASIO_CHECK(ex_two_props_10 == null_ptr); BOOST_ASIO_CHECK(ex_two_props_1.target<void>() == 0); BOOST_ASIO_CHECK(ex_two_props_1 == null_ptr); ex_two_props_t ex_two_props_11(std::nothrow, std::move(ex_two_props_3)); BOOST_ASIO_CHECK(ex_two_props_11.target<void>() != 0); BOOST_ASIO_CHECK(ex_two_props_11 != null_ptr); BOOST_ASIO_CHECK(ex_two_props_3.target<void>() == 0); BOOST_ASIO_CHECK(ex_two_props_3 == null_ptr); BOOST_ASIO_CHECK(ex_two_props_11 == ex_two_props_5); ex_two_props_t ex_two_props_12(std::nothrow, std::move(ex_two_props_7)); BOOST_ASIO_CHECK(ex_two_props_12.target<void>() != 0); BOOST_ASIO_CHECK(ex_two_props_12 != null_ptr); BOOST_ASIO_CHECK(ex_two_props_7.target<void>() == 0); BOOST_ASIO_CHECK(ex_two_props_7 == null_ptr); BOOST_ASIO_CHECK(ex_two_props_12 == ex_two_props_6); BOOST_ASIO_CHECK(ex_two_props_12 != ex_two_props_8); next_nothrow_new_fails = true; ex_two_props_t ex_two_props_13(std::nothrow, fat_executor(3)); BOOST_ASIO_CHECK(ex_two_props_13.target<void>() == 0); BOOST_ASIO_CHECK(ex_two_props_13 == null_ptr); BOOST_ASIO_CHECK(ex_two_props_13 == ex_two_props_1); ex_one_prop_t ex_one_prop_1; BOOST_ASIO_CHECK(ex_one_prop_1.target<void>() == 0); BOOST_ASIO_CHECK(ex_one_prop_1 == null_ptr); ex_one_prop_t ex_one_prop_2(null_ptr); BOOST_ASIO_CHECK(ex_one_prop_2.target<void>() == 0); BOOST_ASIO_CHECK(ex_one_prop_2 == null_ptr); BOOST_ASIO_CHECK(ex_one_prop_2 == ex_one_prop_1); ex_one_prop_t ex_one_prop_3(std::nothrow, pool.executor()); BOOST_ASIO_CHECK(ex_one_prop_3.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_3 != null_ptr); BOOST_ASIO_CHECK(ex_one_prop_3 != ex_one_prop_1); ex_one_prop_t ex_one_prop_4(std::nothrow, ex_one_prop_1); BOOST_ASIO_CHECK(ex_one_prop_4.target<void>() == 0); BOOST_ASIO_CHECK(ex_one_prop_4 == null_ptr); BOOST_ASIO_CHECK(ex_one_prop_4 == ex_one_prop_1); ex_one_prop_t ex_one_prop_5(std::nothrow, ex_one_prop_3); BOOST_ASIO_CHECK(ex_one_prop_5.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_5 != null_ptr); BOOST_ASIO_CHECK(ex_one_prop_5 == ex_one_prop_3); ex_one_prop_t ex_one_prop_6 = fat_executor(1); BOOST_ASIO_CHECK(ex_one_prop_6.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_6 != null_ptr); BOOST_ASIO_CHECK(ex_one_prop_6 != ex_one_prop_1); ex_one_prop_t ex_one_prop_7(std::nothrow, fat_executor(1)); BOOST_ASIO_CHECK(ex_one_prop_7.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_7 != null_ptr); BOOST_ASIO_CHECK(ex_one_prop_7 != ex_one_prop_1); BOOST_ASIO_CHECK(ex_one_prop_7 == ex_one_prop_6); ex_one_prop_t ex_one_prop_8(std::nothrow, fat_executor(2)); BOOST_ASIO_CHECK(ex_one_prop_8.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_8 != null_ptr); BOOST_ASIO_CHECK(ex_one_prop_8 != ex_one_prop_1); BOOST_ASIO_CHECK(ex_one_prop_8 != ex_one_prop_6); BOOST_ASIO_CHECK(ex_one_prop_8 != ex_one_prop_7); ex_one_prop_t ex_one_prop_9(std::nothrow, ex_one_prop_6); BOOST_ASIO_CHECK(ex_one_prop_9.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_9 != null_ptr); BOOST_ASIO_CHECK(ex_one_prop_9 != ex_one_prop_1); BOOST_ASIO_CHECK(ex_one_prop_9 == ex_one_prop_6); BOOST_ASIO_CHECK(ex_one_prop_9 == ex_one_prop_7); BOOST_ASIO_CHECK(ex_one_prop_9 != ex_one_prop_8); ex_one_prop_t ex_one_prop_10(std::nothrow, std::move(ex_one_prop_1)); BOOST_ASIO_CHECK(ex_one_prop_10.target<void>() == 0); BOOST_ASIO_CHECK(ex_one_prop_10 == null_ptr); BOOST_ASIO_CHECK(ex_one_prop_1.target<void>() == 0); BOOST_ASIO_CHECK(ex_one_prop_1 == null_ptr); ex_one_prop_t ex_one_prop_11(std::nothrow, std::move(ex_one_prop_3)); BOOST_ASIO_CHECK(ex_one_prop_11.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_11 != null_ptr); BOOST_ASIO_CHECK(ex_one_prop_3.target<void>() == 0); BOOST_ASIO_CHECK(ex_one_prop_3 == null_ptr); BOOST_ASIO_CHECK(ex_one_prop_11 == ex_one_prop_5); ex_one_prop_t ex_one_prop_12(std::nothrow, std::move(ex_one_prop_7)); BOOST_ASIO_CHECK(ex_one_prop_12.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_12 != null_ptr); BOOST_ASIO_CHECK(ex_one_prop_7.target<void>() == 0); BOOST_ASIO_CHECK(ex_one_prop_7 == null_ptr); BOOST_ASIO_CHECK(ex_one_prop_12 == ex_one_prop_6); BOOST_ASIO_CHECK(ex_one_prop_12 != ex_one_prop_8); ex_one_prop_t ex_one_prop_13(std::nothrow, ex_two_props_1); BOOST_ASIO_CHECK(ex_one_prop_13.target<void>() == 0); BOOST_ASIO_CHECK(ex_one_prop_13 == null_ptr); ex_one_prop_t ex_one_prop_14(std::nothrow, ex_two_props_5); BOOST_ASIO_CHECK(ex_one_prop_14.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_14 != null_ptr); ex_one_prop_t ex_one_prop_15(std::nothrow, ex_two_props_9); BOOST_ASIO_CHECK(ex_one_prop_15.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_15 != null_ptr); next_nothrow_new_fails = true; ex_one_prop_t ex_one_prop_16(std::nothrow, fat_executor(3)); BOOST_ASIO_CHECK(ex_one_prop_16.target<void>() == 0); BOOST_ASIO_CHECK(ex_one_prop_16 == null_ptr); BOOST_ASIO_CHECK(ex_one_prop_16 == ex_one_prop_1); ex_no_props_t ex_no_props_1; BOOST_ASIO_CHECK(ex_no_props_1.target<void>() == 0); BOOST_ASIO_CHECK(ex_no_props_1 == null_ptr); ex_no_props_t ex_no_props_2(null_ptr); BOOST_ASIO_CHECK(ex_no_props_2.target<void>() == 0); BOOST_ASIO_CHECK(ex_no_props_2 == null_ptr); BOOST_ASIO_CHECK(ex_no_props_2 == ex_no_props_1); ex_no_props_t ex_no_props_3(std::nothrow, pool.executor()); BOOST_ASIO_CHECK(ex_no_props_3.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_3 != null_ptr); BOOST_ASIO_CHECK(ex_no_props_3 != ex_no_props_1); ex_no_props_t ex_no_props_4(std::nothrow, ex_no_props_1); BOOST_ASIO_CHECK(ex_no_props_4.target<void>() == 0); BOOST_ASIO_CHECK(ex_no_props_4 == null_ptr); BOOST_ASIO_CHECK(ex_no_props_4 == ex_no_props_1); ex_no_props_t ex_no_props_5(std::nothrow, ex_no_props_3); BOOST_ASIO_CHECK(ex_no_props_5.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_5 != null_ptr); BOOST_ASIO_CHECK(ex_no_props_5 == ex_no_props_3); ex_no_props_t ex_no_props_6(std::nothrow, fat_executor(1)); BOOST_ASIO_CHECK(ex_no_props_6.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_6 != null_ptr); BOOST_ASIO_CHECK(ex_no_props_6 != ex_no_props_1); ex_no_props_t ex_no_props_7(std::nothrow, fat_executor(1)); BOOST_ASIO_CHECK(ex_no_props_7.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_7 != null_ptr); BOOST_ASIO_CHECK(ex_no_props_7 != ex_no_props_1); BOOST_ASIO_CHECK(ex_no_props_7 == ex_no_props_6); ex_no_props_t ex_no_props_8(std::nothrow, fat_executor(2)); BOOST_ASIO_CHECK(ex_no_props_8.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_8 != null_ptr); BOOST_ASIO_CHECK(ex_no_props_8 != ex_no_props_1); BOOST_ASIO_CHECK(ex_no_props_8 != ex_no_props_6); BOOST_ASIO_CHECK(ex_no_props_8 != ex_no_props_7); ex_no_props_t ex_no_props_9(std::nothrow, ex_no_props_6); BOOST_ASIO_CHECK(ex_no_props_9.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_9 != null_ptr); BOOST_ASIO_CHECK(ex_no_props_9 != ex_no_props_1); BOOST_ASIO_CHECK(ex_no_props_9 == ex_no_props_6); BOOST_ASIO_CHECK(ex_no_props_9 == ex_no_props_7); BOOST_ASIO_CHECK(ex_no_props_9 != ex_no_props_8); ex_no_props_t ex_no_props_10(std::nothrow, std::move(ex_no_props_1)); BOOST_ASIO_CHECK(ex_no_props_10.target<void>() == 0); BOOST_ASIO_CHECK(ex_no_props_10 == null_ptr); BOOST_ASIO_CHECK(ex_no_props_1.target<void>() == 0); BOOST_ASIO_CHECK(ex_no_props_1 == null_ptr); ex_no_props_t ex_no_props_11(std::nothrow, std::move(ex_no_props_3)); BOOST_ASIO_CHECK(ex_no_props_11.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_11 != null_ptr); BOOST_ASIO_CHECK(ex_no_props_3.target<void>() == 0); BOOST_ASIO_CHECK(ex_no_props_3 == null_ptr); BOOST_ASIO_CHECK(ex_no_props_11 == ex_no_props_5); ex_no_props_t ex_no_props_12(std::nothrow, std::move(ex_no_props_7)); BOOST_ASIO_CHECK(ex_no_props_12.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_12 != null_ptr); BOOST_ASIO_CHECK(ex_no_props_7.target<void>() == 0); BOOST_ASIO_CHECK(ex_no_props_7 == null_ptr); BOOST_ASIO_CHECK(ex_no_props_12 == ex_no_props_6); BOOST_ASIO_CHECK(ex_no_props_12 != ex_no_props_8); ex_no_props_t ex_no_props_13(std::nothrow, ex_two_props_1); BOOST_ASIO_CHECK(ex_no_props_13.target<void>() == 0); BOOST_ASIO_CHECK(ex_no_props_13 == null_ptr); ex_no_props_t ex_no_props_14(std::nothrow, ex_two_props_5); BOOST_ASIO_CHECK(ex_no_props_14.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_14 != null_ptr); ex_no_props_t ex_no_props_15(std::nothrow, ex_two_props_9); BOOST_ASIO_CHECK(ex_no_props_15.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_15 != null_ptr); ex_no_props_t ex_no_props_16(std::nothrow, ex_one_prop_1); BOOST_ASIO_CHECK(ex_no_props_16.target<void>() == 0); BOOST_ASIO_CHECK(ex_no_props_16 == null_ptr); ex_no_props_t ex_no_props_17(std::nothrow, ex_one_prop_5); BOOST_ASIO_CHECK(ex_no_props_17.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_17 != null_ptr); ex_no_props_t ex_no_props_18(std::nothrow, ex_one_prop_9); BOOST_ASIO_CHECK(ex_no_props_18.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_18 != null_ptr); next_nothrow_new_fails = true; ex_no_props_t ex_no_props_19(std::nothrow, fat_executor(3)); BOOST_ASIO_CHECK(ex_no_props_19.target<void>() == 0); BOOST_ASIO_CHECK(ex_no_props_19 == null_ptr); BOOST_ASIO_CHECK(ex_no_props_19 == ex_no_props_1); } void any_executor_assignment_test() { typedef execution::any_executor<> ex_no_props_t; typedef execution::any_executor< execution::blocking_t > ex_one_prop_t; typedef execution::any_executor< execution::blocking_t, execution::occupancy_t > ex_two_props_t; thread_pool pool(1); boost::asio::nullptr_t null_ptr = boost::asio::nullptr_t(); ex_two_props_t ex_two_props_1; ex_two_props_t ex_two_props_2; ex_two_props_2 = null_ptr; BOOST_ASIO_CHECK(ex_two_props_2.target<void>() == 0); ex_two_props_t ex_two_props_3; ex_two_props_3 = pool.executor(); BOOST_ASIO_CHECK(ex_two_props_3.target<void>() != 0); ex_two_props_t ex_two_props_4; ex_two_props_4 = ex_two_props_1; BOOST_ASIO_CHECK(ex_two_props_4.target<void>() == 0); BOOST_ASIO_CHECK(ex_two_props_4 == ex_two_props_1); ex_two_props_4 = ex_two_props_3; BOOST_ASIO_CHECK(ex_two_props_4.target<void>() != 0); BOOST_ASIO_CHECK(ex_two_props_4 == ex_two_props_3); ex_two_props_t ex_two_props_5; ex_two_props_5 = fat_executor(1); BOOST_ASIO_CHECK(ex_two_props_5.target<void>() != 0); BOOST_ASIO_CHECK(ex_two_props_5 != null_ptr); BOOST_ASIO_CHECK(ex_two_props_5 != ex_two_props_1); ex_two_props_t ex_two_props_6; ex_two_props_6 = fat_executor(1); BOOST_ASIO_CHECK(ex_two_props_6.target<void>() != 0); BOOST_ASIO_CHECK(ex_two_props_6 != null_ptr); BOOST_ASIO_CHECK(ex_two_props_6 != ex_two_props_1); BOOST_ASIO_CHECK(ex_two_props_6 == ex_two_props_5); ex_two_props_6 = fat_executor(2); BOOST_ASIO_CHECK(ex_two_props_6.target<void>() != 0); BOOST_ASIO_CHECK(ex_two_props_6 != null_ptr); BOOST_ASIO_CHECK(ex_two_props_6 != ex_two_props_1); BOOST_ASIO_CHECK(ex_two_props_6 != ex_two_props_5); ex_two_props_t ex_two_props_7; ex_two_props_7 = ex_two_props_5; BOOST_ASIO_CHECK(ex_two_props_7.target<void>() != 0); BOOST_ASIO_CHECK(ex_two_props_7 != null_ptr); BOOST_ASIO_CHECK(ex_two_props_7 != ex_two_props_1); BOOST_ASIO_CHECK(ex_two_props_7 == ex_two_props_5); BOOST_ASIO_CHECK(ex_two_props_7 != ex_two_props_6); ex_two_props_t ex_two_props_8; ex_two_props_8 = std::move(ex_two_props_1); BOOST_ASIO_CHECK(ex_two_props_8.target<void>() == 0); BOOST_ASIO_CHECK(ex_two_props_1.target<void>() == 0); ex_two_props_8 = std::move(ex_two_props_3); BOOST_ASIO_CHECK(ex_two_props_8.target<void>() != 0); BOOST_ASIO_CHECK(ex_two_props_3.target<void>() == 0); BOOST_ASIO_CHECK(ex_two_props_8 == ex_two_props_4); ex_two_props_8 = std::move(ex_two_props_5); BOOST_ASIO_CHECK(ex_two_props_8.target<void>() != 0); BOOST_ASIO_CHECK(ex_two_props_5.target<void>() == 0); BOOST_ASIO_CHECK(ex_two_props_8 == ex_two_props_7); ex_one_prop_t ex_one_prop_1; ex_one_prop_t ex_one_prop_2; ex_one_prop_2 = null_ptr; BOOST_ASIO_CHECK(ex_one_prop_2.target<void>() == 0); ex_one_prop_t ex_one_prop_3; ex_one_prop_3 = pool.executor(); BOOST_ASIO_CHECK(ex_one_prop_3.target<void>() != 0); ex_one_prop_t ex_one_prop_4; ex_one_prop_4 = ex_one_prop_1; BOOST_ASIO_CHECK(ex_one_prop_4.target<void>() == 0); BOOST_ASIO_CHECK(ex_one_prop_4 == ex_one_prop_1); ex_one_prop_4 = ex_one_prop_3; BOOST_ASIO_CHECK(ex_one_prop_4.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_4 == ex_one_prop_3); ex_one_prop_t ex_one_prop_5; ex_one_prop_5 = fat_executor(1); BOOST_ASIO_CHECK(ex_one_prop_5.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_5 != null_ptr); BOOST_ASIO_CHECK(ex_one_prop_5 != ex_one_prop_1); ex_one_prop_t ex_one_prop_6; ex_one_prop_6 = fat_executor(1); BOOST_ASIO_CHECK(ex_one_prop_6.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_6 != null_ptr); BOOST_ASIO_CHECK(ex_one_prop_6 != ex_one_prop_1); BOOST_ASIO_CHECK(ex_one_prop_6 == ex_one_prop_5); ex_one_prop_6 = fat_executor(2); BOOST_ASIO_CHECK(ex_one_prop_6.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_6 != null_ptr); BOOST_ASIO_CHECK(ex_one_prop_6 != ex_one_prop_1); BOOST_ASIO_CHECK(ex_one_prop_6 != ex_one_prop_5); ex_one_prop_t ex_one_prop_7; ex_one_prop_7 = ex_one_prop_5; BOOST_ASIO_CHECK(ex_one_prop_7.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_7 != null_ptr); BOOST_ASIO_CHECK(ex_one_prop_7 != ex_one_prop_1); BOOST_ASIO_CHECK(ex_one_prop_7 == ex_one_prop_5); BOOST_ASIO_CHECK(ex_one_prop_7 != ex_one_prop_6); ex_one_prop_t ex_one_prop_8; ex_one_prop_8 = std::move(ex_one_prop_1); BOOST_ASIO_CHECK(ex_one_prop_8.target<void>() == 0); BOOST_ASIO_CHECK(ex_one_prop_1.target<void>() == 0); ex_one_prop_8 = std::move(ex_one_prop_3); BOOST_ASIO_CHECK(ex_one_prop_8.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_3.target<void>() == 0); BOOST_ASIO_CHECK(ex_one_prop_8 == ex_one_prop_4); ex_one_prop_8 = std::move(ex_one_prop_5); BOOST_ASIO_CHECK(ex_one_prop_8.target<void>() != 0); BOOST_ASIO_CHECK(ex_one_prop_5.target<void>() == 0); BOOST_ASIO_CHECK(ex_one_prop_8 == ex_one_prop_7); ex_one_prop_t ex_one_prop_9; ex_one_prop_9 = ex_two_props_1; BOOST_ASIO_CHECK(ex_one_prop_9.target<void>() == 0); ex_one_prop_9 = ex_two_props_4; BOOST_ASIO_CHECK(ex_one_prop_9.target<void>() != 0); ex_one_prop_9 = ex_two_props_7; BOOST_ASIO_CHECK(ex_one_prop_9.target<void>() != 0); ex_no_props_t ex_no_props_1; ex_no_props_t ex_no_props_2; ex_no_props_2 = null_ptr; BOOST_ASIO_CHECK(ex_no_props_2.target<void>() == 0); ex_no_props_t ex_no_props_3; ex_no_props_3 = pool.executor(); BOOST_ASIO_CHECK(ex_no_props_3.target<void>() != 0); ex_no_props_t ex_no_props_4; ex_no_props_4 = ex_no_props_1; BOOST_ASIO_CHECK(ex_no_props_4.target<void>() == 0); BOOST_ASIO_CHECK(ex_no_props_4 == ex_no_props_1); ex_no_props_4 = ex_no_props_3; BOOST_ASIO_CHECK(ex_no_props_4.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_4 == ex_no_props_3); ex_no_props_t ex_no_props_5; ex_no_props_5 = fat_executor(1); BOOST_ASIO_CHECK(ex_no_props_5.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_5 != null_ptr); BOOST_ASIO_CHECK(ex_no_props_5 != ex_no_props_1); ex_no_props_t ex_no_props_6; ex_no_props_6 = fat_executor(1); BOOST_ASIO_CHECK(ex_no_props_6.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_6 != null_ptr); BOOST_ASIO_CHECK(ex_no_props_6 != ex_no_props_1); BOOST_ASIO_CHECK(ex_no_props_6 == ex_no_props_5); ex_no_props_6 = fat_executor(2); BOOST_ASIO_CHECK(ex_no_props_6.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_6 != null_ptr); BOOST_ASIO_CHECK(ex_no_props_6 != ex_no_props_1); BOOST_ASIO_CHECK(ex_no_props_6 != ex_no_props_5); ex_no_props_t ex_no_props_7; ex_no_props_7 = ex_no_props_5; BOOST_ASIO_CHECK(ex_no_props_7.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_7 != null_ptr); BOOST_ASIO_CHECK(ex_no_props_7 != ex_no_props_1); BOOST_ASIO_CHECK(ex_no_props_7 == ex_no_props_5); BOOST_ASIO_CHECK(ex_no_props_7 != ex_no_props_6); ex_no_props_t ex_no_props_8; ex_no_props_8 = std::move(ex_no_props_1); BOOST_ASIO_CHECK(ex_no_props_8.target<void>() == 0); BOOST_ASIO_CHECK(ex_no_props_1.target<void>() == 0); ex_no_props_8 = std::move(ex_no_props_3); BOOST_ASIO_CHECK(ex_no_props_8.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_3.target<void>() == 0); BOOST_ASIO_CHECK(ex_no_props_8 == ex_no_props_4); ex_no_props_8 = std::move(ex_no_props_5); BOOST_ASIO_CHECK(ex_no_props_8.target<void>() != 0); BOOST_ASIO_CHECK(ex_no_props_5.target<void>() == 0); BOOST_ASIO_CHECK(ex_no_props_8 == ex_no_props_7); ex_no_props_t ex_no_props_9; ex_no_props_9 = ex_two_props_1; BOOST_ASIO_CHECK(ex_no_props_9.target<void>() == 0); ex_no_props_9 = ex_two_props_4; BOOST_ASIO_CHECK(ex_no_props_9.target<void>() != 0); ex_no_props_9 = ex_two_props_7; BOOST_ASIO_CHECK(ex_no_props_9.target<void>() != 0); ex_no_props_9 = ex_one_prop_1; BOOST_ASIO_CHECK(ex_no_props_9.target<void>() == 0); ex_no_props_9 = ex_one_prop_4; BOOST_ASIO_CHECK(ex_no_props_9.target<void>() != 0); ex_no_props_9 = ex_one_prop_7; BOOST_ASIO_CHECK(ex_no_props_9.target<void>() != 0); } void any_executor_swap_test() { typedef execution::any_executor<> ex_no_props_t; typedef execution::any_executor< execution::blocking_t > ex_one_prop_t; typedef execution::any_executor< execution::blocking_t, execution::occupancy_t > ex_two_props_t; thread_pool pool1(1); thread_pool pool2(1); ex_no_props_t ex_no_props_1(pool1.executor()); ex_no_props_t ex_no_props_2(pool2.executor()); ex_no_props_t ex_no_props_3(ex_no_props_1); ex_no_props_t ex_no_props_4(ex_no_props_2); BOOST_ASIO_CHECK(ex_no_props_3 == ex_no_props_1); BOOST_ASIO_CHECK(ex_no_props_4 == ex_no_props_2); ex_no_props_3.swap(ex_no_props_4); BOOST_ASIO_CHECK(ex_no_props_3 == ex_no_props_2); BOOST_ASIO_CHECK(ex_no_props_4 == ex_no_props_1); execution::swap(ex_no_props_3, ex_no_props_4); BOOST_ASIO_CHECK(ex_no_props_3 == ex_no_props_1); BOOST_ASIO_CHECK(ex_no_props_4 == ex_no_props_2); ex_one_prop_t ex_one_prop_1(pool1.executor()); ex_one_prop_t ex_one_prop_2(pool2.executor()); ex_one_prop_t ex_one_prop_3(ex_one_prop_1); ex_one_prop_t ex_one_prop_4(ex_one_prop_2); BOOST_ASIO_CHECK(ex_one_prop_3 == ex_one_prop_1); BOOST_ASIO_CHECK(ex_one_prop_4 == ex_one_prop_2); ex_one_prop_3.swap(ex_one_prop_4); BOOST_ASIO_CHECK(ex_one_prop_3 == ex_one_prop_2); BOOST_ASIO_CHECK(ex_one_prop_4 == ex_one_prop_1); execution::swap(ex_one_prop_3, ex_one_prop_4); BOOST_ASIO_CHECK(ex_one_prop_3 == ex_one_prop_1); BOOST_ASIO_CHECK(ex_one_prop_4 == ex_one_prop_2); ex_two_props_t ex_two_props_1(pool1.executor()); ex_two_props_t ex_two_props_2(pool2.executor()); ex_two_props_t ex_two_props_3(ex_two_props_1); ex_two_props_t ex_two_props_4(ex_two_props_2); BOOST_ASIO_CHECK(ex_two_props_3 == ex_two_props_1); BOOST_ASIO_CHECK(ex_two_props_4 == ex_two_props_2); ex_two_props_3.swap(ex_two_props_4); BOOST_ASIO_CHECK(ex_two_props_3 == ex_two_props_2); BOOST_ASIO_CHECK(ex_two_props_4 == ex_two_props_1); execution::swap(ex_two_props_3, ex_two_props_4); BOOST_ASIO_CHECK(ex_two_props_3 == ex_two_props_1); BOOST_ASIO_CHECK(ex_two_props_4 == ex_two_props_2); } void any_executor_query_test() { thread_pool pool(1); execution::any_executor< execution::blocking_t, execution::outstanding_work_t, execution::relationship_t, execution::mapping_t::thread_t, execution::occupancy_t> ex(pool.executor()); BOOST_ASIO_CHECK( boost::asio::query(ex, boost::asio::execution::blocking) == boost::asio::execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ex, boost::asio::execution::blocking.possibly) == boost::asio::execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ex, boost::asio::execution::outstanding_work) == boost::asio::execution::outstanding_work.untracked); BOOST_ASIO_CHECK( boost::asio::query(ex, boost::asio::execution::outstanding_work.untracked) == boost::asio::execution::outstanding_work.untracked); BOOST_ASIO_CHECK( boost::asio::query(ex, boost::asio::execution::relationship) == boost::asio::execution::relationship.fork); BOOST_ASIO_CHECK( boost::asio::query(ex, boost::asio::execution::relationship.fork) == boost::asio::execution::relationship.fork); BOOST_ASIO_CHECK( boost::asio::query(ex, boost::asio::execution::mapping) == boost::asio::execution::mapping.thread); BOOST_ASIO_CHECK( boost::asio::query(ex, boost::asio::execution::occupancy) == 1); } void any_executor_execute_test() { int count = 0; thread_pool pool(1); execution::any_executor< execution::blocking_t::possibly_t, execution::blocking_t::never_t, execution::outstanding_work_t::untracked_t, execution::outstanding_work_t::tracked_t, execution::relationship_t::continuation_t> ex(pool.executor()); ex.execute(bindns::bind(increment, &count)); boost::asio::require(ex, boost::asio::execution::blocking.possibly).execute( bindns::bind(increment, &count)); boost::asio::require(ex, boost::asio::execution::blocking.never).execute( bindns::bind(increment, &count)); boost::asio::require(ex, boost::asio::execution::blocking.never, boost::asio::execution::outstanding_work.tracked ).execute(bindns::bind(increment, &count)); boost::asio::require(ex, boost::asio::execution::blocking.never, boost::asio::execution::outstanding_work.untracked ).execute(bindns::bind(increment, &count)); boost::asio::require(ex, boost::asio::execution::blocking.never, boost::asio::execution::outstanding_work.untracked, boost::asio::execution::relationship.continuation ).execute(bindns::bind(increment, &count)); pool.wait(); BOOST_ASIO_CHECK(count == 6); } BOOST_ASIO_TEST_SUITE ( "any_executor", BOOST_ASIO_TEST_CASE(any_executor_construction_test) BOOST_ASIO_TEST_CASE(any_executor_nothrow_construction_test) BOOST_ASIO_TEST_CASE(any_executor_assignment_test) BOOST_ASIO_TEST_CASE(any_executor_swap_test) BOOST_ASIO_TEST_CASE(any_executor_query_test) BOOST_ASIO_TEST_CASE(any_executor_execute_test) )
cpp
asio
data/projects/asio/test/execution/context_as.cpp
// // context_as.cpp // ~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/execution/context_as.hpp> #include <functional> #include <boost/asio/execution/any_executor.hpp> #include <boost/asio/io_context.hpp> #include <boost/asio/static_thread_pool.hpp> #include "../unit_test.hpp" using namespace boost::asio; namespace bindns = std; void context_as_executor_query_test() { static_thread_pool pool(1); BOOST_ASIO_CHECK( &boost::asio::query(pool.executor(), execution::context_as_t<static_thread_pool&>()) == &pool); execution::any_executor< execution::context_as_t<static_thread_pool&> > ex1 = pool.executor(); BOOST_ASIO_CHECK( &boost::asio::query(ex1, execution::context_as_t<static_thread_pool&>()) == &pool); BOOST_ASIO_CHECK( &boost::asio::query(ex1, execution::context) == &pool); BOOST_ASIO_CHECK( &boost::asio::query(pool.executor(), execution::context_as_t<const static_thread_pool&>()) == &pool); execution::any_executor< execution::context_as_t<const static_thread_pool&> > ex2 = pool.executor(); BOOST_ASIO_CHECK( &boost::asio::query(ex2, execution::context_as_t<const static_thread_pool&>()) == &pool); BOOST_ASIO_CHECK( &boost::asio::query(ex2, execution::context) == &pool); io_context io_ctx; BOOST_ASIO_CHECK( &boost::asio::query(io_ctx.get_executor(), execution::context_as_t<io_context&>()) == &io_ctx); execution::any_executor< execution::context_as_t<io_context&> > ex3 = io_ctx.get_executor(); BOOST_ASIO_CHECK( &boost::asio::query(ex3, execution::context_as_t<io_context&>()) == &io_ctx); BOOST_ASIO_CHECK( &boost::asio::query(ex3, execution::context) == &io_ctx); BOOST_ASIO_CHECK( &boost::asio::query(io_ctx.get_executor(), execution::context_as_t<const io_context&>()) == &io_ctx); execution::any_executor< execution::context_as_t<const io_context&> > ex4 = io_ctx.get_executor(); BOOST_ASIO_CHECK( &boost::asio::query(ex4, execution::context_as_t<const io_context&>()) == &io_ctx); BOOST_ASIO_CHECK( &boost::asio::query(ex4, execution::context) == &io_ctx); BOOST_ASIO_CHECK( &boost::asio::query(io_ctx.get_executor(), execution::context_as_t<execution_context&>()) == &io_ctx); execution::any_executor< execution::context_as_t<execution_context&> > ex5 = io_ctx.get_executor(); BOOST_ASIO_CHECK( &boost::asio::query(ex5, execution::context_as_t<execution_context&>()) == &io_ctx); BOOST_ASIO_CHECK( &boost::asio::query(ex5, execution::context) == &io_ctx); BOOST_ASIO_CHECK( &boost::asio::query(io_ctx.get_executor(), execution::context_as_t<const execution_context&>()) == &io_ctx); execution::any_executor< execution::context_as_t<const execution_context&> > ex6 = io_ctx.get_executor(); BOOST_ASIO_CHECK( &boost::asio::query(ex6, execution::context_as_t<const execution_context&>()) == &io_ctx); BOOST_ASIO_CHECK( &boost::asio::query(ex6, execution::context) == &io_ctx); } BOOST_ASIO_TEST_SUITE ( "context_as", BOOST_ASIO_TEST_CASE(context_as_executor_query_test) )
cpp
asio
data/projects/asio/test/execution/invocable_archetype.cpp
// // invocable_archetype.cpp // ~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/execution/invocable_archetype.hpp> #include "../unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "invocable_archetype", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/execution/blocking.cpp
// // blocking.cpp // ~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/execution/blocking.hpp> #include <boost/asio/prefer.hpp> #include <boost/asio/query.hpp> #include <boost/asio/require.hpp> #include "../unit_test.hpp" namespace exec = boost::asio::execution; typedef exec::blocking_t s; typedef exec::blocking_t::possibly_t n1; typedef exec::blocking_t::always_t n2; typedef exec::blocking_t::never_t n3; struct ex_nq_nr { template <typename F> void execute(const F&) const { } friend bool operator==(const ex_nq_nr&, const ex_nq_nr&) noexcept { return true; } friend bool operator!=(const ex_nq_nr&, const ex_nq_nr&) noexcept { return false; } }; #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace execution { template <> struct is_executor<ex_nq_nr> : boost::asio::true_type { }; } // namespace execution } // namespace asio } // namespace boost #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) template <typename ResultType, typename ParamType, typename Result> struct ex_cq_nr { static constexpr ResultType query(ParamType) noexcept { return Result(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_cq_nr&, const ex_cq_nr&) noexcept { return true; } friend bool operator!=(const ex_cq_nr&, const ex_cq_nr&) noexcept { return false; } }; #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace execution { template <typename ResultType, typename ParamType, typename Result> struct is_executor<ex_cq_nr<ResultType, ParamType, Result> > : boost::asio::true_type { }; } // namespace execution } // namespace asio } // namespace boost #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT) template <typename ResultType, typename ParamType, typename Result, typename Param> struct query_static_constexpr_member< ex_cq_nr<ResultType, ParamType, Result>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, ParamType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef Result result_type; // Must return raw result type. static constexpr result_type value() { return Result(); } }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename ResultType, typename ParamType, typename Result> struct ex_mq_nr { ResultType query(ParamType) const noexcept { return Result(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_mq_nr&, const ex_mq_nr&) noexcept { return true; } friend bool operator!=(const ex_mq_nr&, const ex_mq_nr&) noexcept { return false; } }; #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace execution { template <typename ResultType, typename ParamType, typename Result> struct is_executor<ex_mq_nr<ResultType, ParamType, Result> > : boost::asio::true_type { }; } // namespace execution } // namespace asio } // namespace boost #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) template <typename ResultType, typename ParamType, typename Result, typename Param> struct query_member< ex_mq_nr<ResultType, ParamType, Result>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, ParamType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ResultType result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename ResultType, typename ParamType, typename Result> struct ex_fq_nr { friend ResultType query(const ex_fq_nr&, ParamType) noexcept { return Result(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_fq_nr&, const ex_fq_nr&) noexcept { return true; } friend bool operator!=(const ex_fq_nr&, const ex_fq_nr&) noexcept { return false; } }; #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace execution { template <typename ResultType, typename ParamType, typename Result> struct is_executor<ex_fq_nr<ResultType, ParamType, Result> > : boost::asio::true_type { }; } // namespace execution } // namespace asio } // namespace boost #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) template <typename ResultType, typename ParamType, typename Result, typename Param> struct query_free< ex_fq_nr<ResultType, ParamType, Result>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, ParamType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ResultType result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename CurrentType, typename OtherType> struct ex_mq_mr { CurrentType query(CurrentType) const noexcept { return CurrentType(); } CurrentType query(OtherType) const noexcept { return CurrentType(); } ex_mq_mr<CurrentType, OtherType> require( CurrentType) const noexcept { return ex_mq_mr<CurrentType, OtherType>(); } ex_mq_mr<OtherType, CurrentType> require( OtherType) const noexcept { return ex_mq_mr<OtherType, CurrentType>(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_mq_mr&, const ex_mq_mr&) noexcept { return true; } friend bool operator!=(const ex_mq_mr&, const ex_mq_mr&) noexcept { return false; } }; template <typename CurrentType> struct ex_mq_mr<CurrentType, CurrentType> { CurrentType query(CurrentType) const noexcept { return CurrentType(); } ex_mq_mr<CurrentType, CurrentType> require( CurrentType) const noexcept { return ex_mq_mr<CurrentType, CurrentType>(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_mq_mr&, const ex_mq_mr&) noexcept { return true; } friend bool operator!=(const ex_mq_mr&, const ex_mq_mr&) noexcept { return false; } }; #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace execution { template <typename CurrentType, typename OtherType> struct is_executor<ex_mq_mr<CurrentType, OtherType> > : boost::asio::true_type { }; } // namespace execution } // namespace asio } // namespace boost #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct query_member< ex_mq_mr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value || boost::asio::is_convertible<Param, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef CurrentType result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct require_member< ex_mq_mr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_mq_mr<CurrentType, OtherType> result_type; }; template <typename CurrentType, typename OtherType, typename Param> struct require_member< ex_mq_mr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, OtherType>::value && !boost::asio::is_same<CurrentType, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_mq_mr<OtherType, CurrentType> result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename CurrentType, typename OtherType> struct ex_fq_fr { friend CurrentType query(const ex_fq_fr&, CurrentType) noexcept { return CurrentType(); } friend CurrentType query(const ex_fq_fr&, OtherType) noexcept { return CurrentType(); } friend ex_fq_fr<CurrentType, OtherType> require( const ex_fq_fr&, CurrentType) noexcept { return ex_fq_fr<CurrentType, OtherType>(); } friend ex_fq_fr<OtherType, CurrentType> require( const ex_fq_fr&, OtherType) noexcept { return ex_fq_fr<OtherType, CurrentType>(); } friend ex_fq_fr<CurrentType, OtherType> prefer( const ex_fq_fr&, CurrentType) noexcept { return ex_fq_fr<CurrentType, OtherType>(); } friend ex_fq_fr<OtherType, CurrentType> prefer( const ex_fq_fr&, OtherType) noexcept { return ex_fq_fr<OtherType, CurrentType>(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_fq_fr&, const ex_fq_fr&) noexcept { return true; } friend bool operator!=(const ex_fq_fr&, const ex_fq_fr&) noexcept { return false; } }; template <typename CurrentType> struct ex_fq_fr<CurrentType, CurrentType> { friend CurrentType query(const ex_fq_fr&, CurrentType) noexcept { return CurrentType(); } friend ex_fq_fr<CurrentType, CurrentType> require( const ex_fq_fr&, CurrentType) noexcept { return ex_fq_fr<CurrentType, CurrentType>(); } friend ex_fq_fr<CurrentType, CurrentType> prefer( const ex_fq_fr&, CurrentType) noexcept { return ex_fq_fr<CurrentType, CurrentType>(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_fq_fr&, const ex_fq_fr&) noexcept { return true; } friend bool operator!=(const ex_fq_fr&, const ex_fq_fr&) noexcept { return false; } }; #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace execution { template <typename CurrentType, typename OtherType> struct is_executor<ex_fq_fr<CurrentType, OtherType> > : boost::asio::true_type { }; } // namespace execution } // namespace asio } // namespace boost #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct query_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value || boost::asio::is_convertible<Param, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef CurrentType result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_FREE_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct require_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_fq_fr<CurrentType, OtherType> result_type; }; template <typename CurrentType, typename OtherType, typename Param> struct require_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, OtherType>::value && !boost::asio::is_same<CurrentType, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_fq_fr<OtherType, CurrentType> result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_FREE_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_PREFER_FREE_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct prefer_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_fq_fr<CurrentType, OtherType> result_type; }; template <typename CurrentType, typename OtherType, typename Param> struct prefer_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, OtherType>::value && !boost::asio::is_same<CurrentType, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_fq_fr<OtherType, CurrentType> result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_PREFER_FREE_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename Executor, typename Param, bool ExpectedResult> void test_can_query() { constexpr bool b1 = boost::asio::can_query<Executor, Param>::value; BOOST_ASIO_CHECK(b1 == ExpectedResult); constexpr bool b2 = boost::asio::can_query<const Executor, Param>::value; BOOST_ASIO_CHECK(b2 == ExpectedResult); constexpr bool b3 = boost::asio::can_query<Executor&, Param>::value; BOOST_ASIO_CHECK(b3 == ExpectedResult); constexpr bool b4 = boost::asio::can_query<const Executor&, Param>::value; BOOST_ASIO_CHECK(b4 == ExpectedResult); } template <typename Executor, typename Param, typename ExpectedResult> void test_query() { exec::blocking_t result1 = boost::asio::query(Executor(), Param()); BOOST_ASIO_CHECK(result1 == ExpectedResult()); Executor ex1 = {}; exec::blocking_t result2 = boost::asio::query(ex1, Param()); BOOST_ASIO_CHECK(result2 == ExpectedResult()); const Executor ex2 = {}; exec::blocking_t result3 = boost::asio::query(ex2, Param()); BOOST_ASIO_CHECK(result3 == ExpectedResult()); } template <typename Executor, typename Param, typename ExpectedResult> void test_constexpr_query() { constexpr Executor ex1 = {}; constexpr exec::blocking_t result1 = boost::asio::query(ex1, Param()); BOOST_ASIO_CHECK(result1 == ExpectedResult()); } template <typename Executor, typename Param, bool ExpectedResult> void test_can_require() { constexpr bool b1 = boost::asio::can_require<Executor, Param>::value; BOOST_ASIO_CHECK(b1 == ExpectedResult); constexpr bool b2 = boost::asio::can_require<const Executor, Param>::value; BOOST_ASIO_CHECK(b2 == ExpectedResult); constexpr bool b3 = boost::asio::can_require<Executor&, Param>::value; BOOST_ASIO_CHECK(b3 == ExpectedResult); constexpr bool b4 = boost::asio::can_require<const Executor&, Param>::value; BOOST_ASIO_CHECK(b4 == ExpectedResult); } template <typename Executor, typename Param, typename ExpectedResult> void test_require() { BOOST_ASIO_CHECK( boost::asio::query( boost::asio::require(Executor(), Param()), Param()) == ExpectedResult()); Executor ex1 = {}; BOOST_ASIO_CHECK( boost::asio::query( boost::asio::require(ex1, Param()), Param()) == ExpectedResult()); const Executor ex2 = {}; BOOST_ASIO_CHECK( boost::asio::query( boost::asio::require(ex2, Param()), Param()) == ExpectedResult()); } template <typename Executor, typename Param, bool ExpectedResult> void test_can_prefer() { constexpr bool b1 = boost::asio::can_prefer<Executor, Param>::value; BOOST_ASIO_CHECK(b1 == ExpectedResult); constexpr bool b2 = boost::asio::can_prefer<const Executor, Param>::value; BOOST_ASIO_CHECK(b2 == ExpectedResult); constexpr bool b3 = boost::asio::can_prefer<Executor&, Param>::value; BOOST_ASIO_CHECK(b3 == ExpectedResult); constexpr bool b4 = boost::asio::can_prefer<const Executor&, Param>::value; BOOST_ASIO_CHECK(b4 == ExpectedResult); } template <typename Executor, typename Param, typename ExpectedResult> void test_prefer() { BOOST_ASIO_CHECK( s(boost::asio::query( boost::asio::prefer(Executor(), Param()), s())) == s(ExpectedResult())); Executor ex1 = {}; BOOST_ASIO_CHECK( s(boost::asio::query( boost::asio::prefer(ex1, Param()), s())) == s(ExpectedResult())); const Executor ex2 = {}; BOOST_ASIO_CHECK( s(boost::asio::query( boost::asio::prefer(ex2, Param()), s())) == s(ExpectedResult())); } void test_vars() { BOOST_ASIO_CHECK(s() == exec::blocking); BOOST_ASIO_CHECK(s() != exec::blocking.possibly); BOOST_ASIO_CHECK(s() != exec::blocking.always); BOOST_ASIO_CHECK(s() != exec::blocking.never); BOOST_ASIO_CHECK(n1() == exec::blocking.possibly); BOOST_ASIO_CHECK(n1() != exec::blocking.always); BOOST_ASIO_CHECK(n1() != exec::blocking.never); BOOST_ASIO_CHECK(n2() == exec::blocking.always); BOOST_ASIO_CHECK(n2() != exec::blocking.possibly); BOOST_ASIO_CHECK(n2() != exec::blocking.never); BOOST_ASIO_CHECK(n3() == exec::blocking.never); BOOST_ASIO_CHECK(n3() != exec::blocking.possibly); BOOST_ASIO_CHECK(n3() != exec::blocking.always); } BOOST_ASIO_TEST_SUITE ( "blocking", BOOST_ASIO_TEST_CASE3(test_can_query<ex_nq_nr, s, true>) BOOST_ASIO_TEST_CASE3(test_can_query<ex_nq_nr, n1, true>) BOOST_ASIO_TEST_CASE3(test_can_query<ex_nq_nr, n2, false>) BOOST_ASIO_TEST_CASE3(test_can_query<ex_nq_nr, n3, false>) BOOST_ASIO_TEST_CASE3(test_query<ex_nq_nr, s, n1>) BOOST_ASIO_TEST_CASE3(test_query<ex_nq_nr, n1, n1>) BOOST_ASIO_TEST_CASE3(test_constexpr_query<ex_nq_nr, s, n1>) BOOST_ASIO_TEST_CASE3(test_constexpr_query<ex_nq_nr, n1, n1>) BOOST_ASIO_TEST_CASE3(test_can_require<ex_nq_nr, s, false>) BOOST_ASIO_TEST_CASE3(test_can_require<ex_nq_nr, n1, true>) BOOST_ASIO_TEST_CASE3(test_can_require<ex_nq_nr, n2, false>) BOOST_ASIO_TEST_CASE3(test_can_require<ex_nq_nr, n3, false>) BOOST_ASIO_TEST_CASE3(test_require<ex_nq_nr, n1, n1>) BOOST_ASIO_TEST_CASE3(test_can_prefer<ex_nq_nr, s, false>) BOOST_ASIO_TEST_CASE3(test_can_prefer<ex_nq_nr, n1, true>) BOOST_ASIO_TEST_CASE3(test_can_prefer<ex_nq_nr, n2, false>) BOOST_ASIO_TEST_CASE3(test_can_prefer<ex_nq_nr, n3, true>) BOOST_ASIO_TEST_CASE3(test_prefer<ex_nq_nr, n1, n1>) BOOST_ASIO_TEST_CASE3(test_prefer<ex_nq_nr, n3, n1>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n3, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n3, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n3, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n3, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n3, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n3, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n3, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n3, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n3, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n1, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n1, s, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n2, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n2, s, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n3, s, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n3, s, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n3, s, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n3, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n1, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n1, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n1, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n2, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n2, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n2, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n3, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n3, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n3, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n3, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n3, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n1, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n1, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n2, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n2, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n3, s, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n3, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n3, s, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n3, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n1, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n1, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n1, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n2, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n2, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n2, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n3, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n3, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n3, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n3, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n3, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n1, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n1, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n2, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n2, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n3, s, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n3, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n3, s, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n3, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n3, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n3, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n3, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n3, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n3, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n3, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n3, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n3, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n3, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n1, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n1, s, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n2, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n2, s, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n3, s, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n3, s, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n3, s, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n3, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<n3, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n3, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n3, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n3, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n3, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n3, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n3, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n3, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n3, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n3, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n1, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n1, s, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n2, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n2, s, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n3, s, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n3, s, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n3, s, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n3, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n3, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n3, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n3, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n3, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n3, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n1, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n2, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n3, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n3, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n3, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n3, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n3, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n3, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n3, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n3, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n3, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n3, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n3, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n1, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n1, s, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n2, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n2, s, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n3, s, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n3, s, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n3, s, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n3, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n1, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n1, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n1, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n2, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n2, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n2, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n3, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n3, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n3, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n3, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n3, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n1, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n1, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n2, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n2, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n3, s, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n3, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n3, s, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n3, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n3, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n3, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n3, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n3, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n3, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n3, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n3, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n3, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n3, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n3, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n1, s, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n1, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n1, s, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n2, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n2, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n2, s, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n3, s, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n3, s, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n3, s, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n3, s, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n3, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n3, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n3, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n3, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n3, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n3, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n3, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n3, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n3, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n1, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n1, s, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n2, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n2, s, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n3, s, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n3, s, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n3, s, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n3, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n3, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n3, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n3, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n3, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n3, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n1, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n2, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n3, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n3, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n3, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n3, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n3, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n3, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n3, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n3, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n3, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n3, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n3, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n1, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n1, s, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n2, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n2, s, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n3, s, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n3, s, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n3, s, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n3, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n1, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n1, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n1, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n2, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n2, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n2, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n3, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n3, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n3, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n3, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n3, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n1, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n1, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n2, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n2, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n3, s, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n3, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n3, s, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n3, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n3, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n3, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n3, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n3, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n3, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n3, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n3, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n3, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n3, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n3, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n1, s, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n1, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n1, s, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n2, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n2, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n2, s, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n3, s, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n3, s, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n3, s, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n3, s, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n3, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n3, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n3, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n3, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n3, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n3, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n3, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n3, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n3, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n1, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n1, s, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n2, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n2, s, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n3, s, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n3, s, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n3, s, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n3, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n3, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n3, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n3, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n3, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n3, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n1, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n2, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n3, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n3, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n1>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n1>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n2>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n2>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n3>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n3>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n1>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n1>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n2>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n2>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n3>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n3>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n3>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n3, n1>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n3, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n3, n1>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n3, n2>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n3, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n3, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n3, n2>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n3, n3>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n3, n3>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n1, n2>, s, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n1, n3>, s, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n1, n3>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n2, n1>, s, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n2, n3>, s, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n2, n3>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n3, n1>, s, n3>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n3, n1>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n3, n2>, s, n3>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n3, n2>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n3, n3>, s, n3>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n1>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n2>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n3>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n3>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n1>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n2>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n3>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n3>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n3>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n3, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n3, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n3, n1>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n3, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n3, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n3, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n3, n2>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n3, n3>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n3, n3>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n1, n3>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n1, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n2, n3>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n2, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n3, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n3, n1>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n3, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n3, n2>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n1>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n2>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n3>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n3>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n1>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n2>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n2>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n3>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n3>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n3>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n3, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n3, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n3, n1>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n3, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n3, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n3, n2>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n3, n2>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n3, n3>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n3, n3>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n1>, n3, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n2>, n3, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n3>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n1>, n3, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n2>, n3, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n3>, n1, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n3, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n3, n1>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n3, n2>, n1, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n3, n2>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n3, n3>, n1, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n1>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n1>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n2>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n2>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n3>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n3>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n1>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n1>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n2>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n2>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n3>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n3>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n3>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n3, n1>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n3, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n3, n1>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n3, n2>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n3, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n3, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n3, n2>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n3, n3>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n3, n3>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n1, n2>, s, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n1, n3>, s, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n1, n3>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n2, n1>, s, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n2, n3>, s, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n2, n3>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n3, n1>, s, n3>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n3, n1>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n3, n2>, s, n3>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n3, n2>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n3, n3>, s, n3>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n1>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n2>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n3>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n3>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n1>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n2>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n3>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n3>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n3>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n3, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n3, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n3, n1>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n3, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n3, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n3, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n3, n2>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n3, n3>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n3, n3>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n1, n3>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n1, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n2, n3>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n2, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n3, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n3, n1>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n3, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n3, n2>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n1>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n2>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n3>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n3>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n1>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n2>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n2>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n3>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n3>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n3>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n3, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n3, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n3, n1>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n3, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n3, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n3, n2>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n3, n2>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n3, n3>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n3, n3>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n1>, n3, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n2>, n3, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n3>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n1>, n3, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n2>, n3, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n3>, n1, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n3, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n3, n1>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n3, n2>, n1, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n3, n2>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n3, n3>, n1, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE(test_vars) )
cpp
asio
data/projects/asio/test/execution/prefer_only.cpp
// // prefer_only.cpp // ~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/execution/prefer_only.hpp> #include <functional> #include <boost/asio/execution/any_executor.hpp> #include "../unit_test.hpp" using namespace boost::asio; namespace bindns = std; static int possibly_blocking_count = 0; static int never_blocking_count = 0; struct possibly_blocking_executor { template <typename F> void execute(const F&) const { ++possibly_blocking_count; } friend bool operator==(const possibly_blocking_executor&, const possibly_blocking_executor&) noexcept { return true; } friend bool operator!=(const possibly_blocking_executor&, const possibly_blocking_executor&) noexcept { return false; } }; namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) template <typename F> struct execute_member<possibly_blocking_executor, F> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef void result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) template <> struct equality_comparable<possibly_blocking_executor> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) } // namespace traits } // namespace asio } // namespace boost struct never_blocking_executor { static constexpr execution::blocking_t::never_t query(execution::blocking_t) noexcept { return execution::blocking_t::never_t(); } template <typename F> void execute(const F&) const { ++never_blocking_count; } friend bool operator==(const never_blocking_executor&, const never_blocking_executor&) noexcept { return true; } friend bool operator!=(const never_blocking_executor&, const never_blocking_executor&) noexcept { return false; } }; namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) template <typename F> struct execute_member<never_blocking_executor, F> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef void result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) template <> struct equality_comparable<never_blocking_executor> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT) template <typename Param> struct query_static_constexpr_member< never_blocking_executor, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, execution::blocking_t>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef execution::blocking_t::never_t result_type; static constexpr result_type value() { return result_type(); } }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT) } // namespace traits } // namespace asio } // namespace boost struct either_blocking_executor { execution::blocking_t blocking_; explicit either_blocking_executor(execution::blocking_t b) : blocking_(b) { } execution::blocking_t query(execution::blocking_t) const noexcept { return blocking_; } either_blocking_executor require(execution::blocking_t::possibly_t) const { return either_blocking_executor(execution::blocking.possibly); } either_blocking_executor require(execution::blocking_t::never_t) const { return either_blocking_executor(execution::blocking.never); } template <typename F> void execute(const F&) const { if (blocking_ == execution::blocking.never) ++never_blocking_count; else ++possibly_blocking_count; } friend bool operator==(const either_blocking_executor& a, const either_blocking_executor& b) noexcept { return a.blocking_ == b.blocking_; } friend bool operator!=(const either_blocking_executor& a, const either_blocking_executor& b) noexcept { return a.blocking_ != b.blocking_; } }; namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) template <typename F> struct execute_member<either_blocking_executor, F> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef void result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) template <> struct equality_comparable<either_blocking_executor> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) template <typename Param> struct query_member< either_blocking_executor, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, execution::blocking_t>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef execution::blocking_t result_type; }; #if !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT) #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) template <typename Param> struct require_member< either_blocking_executor, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, execution::blocking_t>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = false; typedef either_blocking_executor result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) } // namespace traits } // namespace asio } // namespace boost void prefer_only_executor_query_test() { typedef execution::any_executor< execution::blocking_t, execution::prefer_only<execution::blocking_t::possibly_t>, execution::prefer_only<execution::blocking_t::never_t> > executor_type; executor_type ex1 = possibly_blocking_executor(); BOOST_ASIO_CHECK( boost::asio::query(ex1, execution::blocking) == execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ex1, execution::blocking.possibly) == execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ex1, execution::blocking.never) == execution::blocking.possibly); executor_type ex2 = boost::asio::prefer(ex1, execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ex2, execution::blocking) == execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ex2, execution::blocking.possibly) == execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ex2, execution::blocking.never) == execution::blocking.possibly); executor_type ex3 = boost::asio::prefer(ex1, execution::blocking.never); BOOST_ASIO_CHECK( boost::asio::query(ex3, execution::blocking) == execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ex3, execution::blocking.possibly) == execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ex3, execution::blocking.never) == execution::blocking.possibly); executor_type ex4 = never_blocking_executor(); BOOST_ASIO_CHECK( boost::asio::query(ex4, execution::blocking) == execution::blocking.never); BOOST_ASIO_CHECK( boost::asio::query(ex4, execution::blocking.possibly) == execution::blocking.never); BOOST_ASIO_CHECK( boost::asio::query(ex4, execution::blocking.never) == execution::blocking.never); executor_type ex5 = boost::asio::prefer(ex4, execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ex5, execution::blocking) == execution::blocking.never); BOOST_ASIO_CHECK( boost::asio::query(ex5, execution::blocking.possibly) == execution::blocking.never); BOOST_ASIO_CHECK( boost::asio::query(ex5, execution::blocking.never) == execution::blocking.never); executor_type ex6 = boost::asio::prefer(ex4, execution::blocking.never); BOOST_ASIO_CHECK( boost::asio::query(ex6, execution::blocking) == execution::blocking.never); BOOST_ASIO_CHECK( boost::asio::query(ex6, execution::blocking.possibly) == execution::blocking.never); BOOST_ASIO_CHECK( boost::asio::query(ex6, execution::blocking.never) == execution::blocking.never); executor_type ex7 = either_blocking_executor(execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ex7, execution::blocking) == execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ex7, execution::blocking.possibly) == execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ex7, execution::blocking.never) == execution::blocking.possibly); executor_type ex8 = boost::asio::prefer(ex7, execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ex8, execution::blocking) == execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ex8, execution::blocking.possibly) == execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ex8, execution::blocking.never) == execution::blocking.possibly); executor_type ex9 = boost::asio::prefer(ex7, execution::blocking.never); BOOST_ASIO_CHECK( boost::asio::query(ex9, execution::blocking) == execution::blocking.never); BOOST_ASIO_CHECK( boost::asio::query(ex9, execution::blocking.possibly) == execution::blocking.never); BOOST_ASIO_CHECK( boost::asio::query(ex9, execution::blocking.never) == execution::blocking.never); executor_type ex10 = either_blocking_executor(execution::blocking.never); BOOST_ASIO_CHECK( boost::asio::query(ex10, execution::blocking) == execution::blocking.never); BOOST_ASIO_CHECK( boost::asio::query(ex10, execution::blocking.possibly) == execution::blocking.never); BOOST_ASIO_CHECK( boost::asio::query(ex10, execution::blocking.never) == execution::blocking.never); executor_type ex11 = boost::asio::prefer(ex7, execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ex11, execution::blocking) == execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ex11, execution::blocking.possibly) == execution::blocking.possibly); BOOST_ASIO_CHECK( boost::asio::query(ex11, execution::blocking.never) == execution::blocking.possibly); executor_type ex12 = boost::asio::prefer(ex7, execution::blocking.never); BOOST_ASIO_CHECK( boost::asio::query(ex12, execution::blocking) == execution::blocking.never); BOOST_ASIO_CHECK( boost::asio::query(ex12, execution::blocking.possibly) == execution::blocking.never); BOOST_ASIO_CHECK( boost::asio::query(ex12, execution::blocking.never) == execution::blocking.never); } void do_nothing() { } void prefer_only_executor_execute_test() { typedef execution::any_executor< execution::blocking_t, execution::prefer_only<execution::blocking_t::possibly_t>, execution::prefer_only<execution::blocking_t::never_t> > executor_type; executor_type ex1 = possibly_blocking_executor(); ex1.execute(&do_nothing); BOOST_ASIO_CHECK(possibly_blocking_count == 1); BOOST_ASIO_CHECK(never_blocking_count == 0); executor_type ex2 = boost::asio::prefer(ex1, execution::blocking.possibly); ex2.execute(&do_nothing); BOOST_ASIO_CHECK(possibly_blocking_count == 2); BOOST_ASIO_CHECK(never_blocking_count == 0); executor_type ex3 = boost::asio::prefer(ex1, execution::blocking.never); ex3.execute(&do_nothing); BOOST_ASIO_CHECK(possibly_blocking_count == 3); BOOST_ASIO_CHECK(never_blocking_count == 0); executor_type ex4 = never_blocking_executor(); ex4.execute(&do_nothing); BOOST_ASIO_CHECK(possibly_blocking_count == 3); BOOST_ASIO_CHECK(never_blocking_count == 1); executor_type ex5 = boost::asio::prefer(ex4, execution::blocking.possibly); ex5.execute(&do_nothing); BOOST_ASIO_CHECK(possibly_blocking_count == 3); BOOST_ASIO_CHECK(never_blocking_count == 2); executor_type ex6 = boost::asio::prefer(ex4, execution::blocking.never); ex6.execute(&do_nothing); BOOST_ASIO_CHECK(possibly_blocking_count == 3); BOOST_ASIO_CHECK(never_blocking_count == 3); executor_type ex7 = either_blocking_executor(execution::blocking.possibly); ex7.execute(&do_nothing); BOOST_ASIO_CHECK(possibly_blocking_count == 4); BOOST_ASIO_CHECK(never_blocking_count == 3); executor_type ex8 = boost::asio::prefer(ex7, execution::blocking.possibly); ex8.execute(&do_nothing); BOOST_ASIO_CHECK(possibly_blocking_count == 5); BOOST_ASIO_CHECK(never_blocking_count == 3); executor_type ex9 = boost::asio::prefer(ex7, execution::blocking.never); ex9.execute(&do_nothing); BOOST_ASIO_CHECK(possibly_blocking_count == 5); BOOST_ASIO_CHECK(never_blocking_count == 4); executor_type ex10 = either_blocking_executor(execution::blocking.never); ex10.execute(&do_nothing); BOOST_ASIO_CHECK(possibly_blocking_count == 5); BOOST_ASIO_CHECK(never_blocking_count == 5); executor_type ex11 = boost::asio::prefer(ex7, execution::blocking.possibly); ex11.execute(&do_nothing); BOOST_ASIO_CHECK(possibly_blocking_count == 6); BOOST_ASIO_CHECK(never_blocking_count == 5); executor_type ex12 = boost::asio::prefer(ex7, execution::blocking.never); ex12.execute(&do_nothing); BOOST_ASIO_CHECK(possibly_blocking_count == 6); BOOST_ASIO_CHECK(never_blocking_count == 6); } BOOST_ASIO_TEST_SUITE ( "prefer_only", BOOST_ASIO_TEST_CASE(prefer_only_executor_query_test) BOOST_ASIO_TEST_CASE(prefer_only_executor_execute_test) )
cpp
asio
data/projects/asio/test/execution/mapping.cpp
// // mapping.cpp // ~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/execution/mapping.hpp> #include <boost/asio/prefer.hpp> #include <boost/asio/query.hpp> #include <boost/asio/require.hpp> #include "../unit_test.hpp" namespace exec = boost::asio::execution; typedef exec::mapping_t s; typedef exec::mapping_t::thread_t n1; typedef exec::mapping_t::new_thread_t n2; typedef exec::mapping_t::other_t n3; struct ex_nq_nr { template <typename F> void execute(const F&) const { } friend bool operator==(const ex_nq_nr&, const ex_nq_nr&) noexcept { return true; } friend bool operator!=(const ex_nq_nr&, const ex_nq_nr&) noexcept { return false; } }; #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace execution { template <> struct is_executor<ex_nq_nr> : boost::asio::true_type { }; } // namespace execution } // namespace asio } // namespace boost #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) template <typename ResultType, typename ParamType, typename Result> struct ex_cq_nr { static constexpr ResultType query(ParamType) noexcept { return Result(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_cq_nr&, const ex_cq_nr&) noexcept { return true; } friend bool operator!=(const ex_cq_nr&, const ex_cq_nr&) noexcept { return false; } }; #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace execution { template <typename ResultType, typename ParamType, typename Result> struct is_executor<ex_cq_nr<ResultType, ParamType, Result> > : boost::asio::true_type { }; } // namespace execution } // namespace asio } // namespace boost #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT) template <typename ResultType, typename ParamType, typename Result, typename Param> struct query_static_constexpr_member< ex_cq_nr<ResultType, ParamType, Result>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, ParamType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef Result result_type; // Must return raw result type. static constexpr result_type value() { return Result(); } }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename ResultType, typename ParamType, typename Result> struct ex_mq_nr { ResultType query(ParamType) const noexcept { return Result(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_mq_nr&, const ex_mq_nr&) noexcept { return true; } friend bool operator!=(const ex_mq_nr&, const ex_mq_nr&) noexcept { return false; } }; #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace execution { template <typename ResultType, typename ParamType, typename Result> struct is_executor<ex_mq_nr<ResultType, ParamType, Result> > : boost::asio::true_type { }; } // namespace execution } // namespace asio } // namespace boost #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) template <typename ResultType, typename ParamType, typename Result, typename Param> struct query_member< ex_mq_nr<ResultType, ParamType, Result>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, ParamType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ResultType result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename ResultType, typename ParamType, typename Result> struct ex_fq_nr { friend ResultType query(const ex_fq_nr&, ParamType) noexcept { return Result(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_fq_nr&, const ex_fq_nr&) noexcept { return true; } friend bool operator!=(const ex_fq_nr&, const ex_fq_nr&) noexcept { return false; } }; #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace execution { template <typename ResultType, typename ParamType, typename Result> struct is_executor<ex_fq_nr<ResultType, ParamType, Result> > : boost::asio::true_type { }; } // namespace execution } // namespace asio } // namespace boost #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) template <typename ResultType, typename ParamType, typename Result, typename Param> struct query_free< ex_fq_nr<ResultType, ParamType, Result>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, ParamType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ResultType result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename CurrentType, typename OtherType> struct ex_mq_mr { CurrentType query(CurrentType) const noexcept { return CurrentType(); } CurrentType query(OtherType) const noexcept { return CurrentType(); } ex_mq_mr<CurrentType, OtherType> require( CurrentType) const noexcept { return ex_mq_mr<CurrentType, OtherType>(); } ex_mq_mr<OtherType, CurrentType> require( OtherType) const noexcept { return ex_mq_mr<OtherType, CurrentType>(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_mq_mr&, const ex_mq_mr&) noexcept { return true; } friend bool operator!=(const ex_mq_mr&, const ex_mq_mr&) noexcept { return false; } }; template <typename CurrentType> struct ex_mq_mr<CurrentType, CurrentType> { CurrentType query(CurrentType) const noexcept { return CurrentType(); } ex_mq_mr<CurrentType, CurrentType> require( CurrentType) const noexcept { return ex_mq_mr<CurrentType, CurrentType>(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_mq_mr&, const ex_mq_mr&) noexcept { return true; } friend bool operator!=(const ex_mq_mr&, const ex_mq_mr&) noexcept { return false; } }; #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace execution { template <typename CurrentType, typename OtherType> struct is_executor<ex_mq_mr<CurrentType, OtherType> > : boost::asio::true_type { }; } // namespace execution } // namespace asio } // namespace boost #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct query_member< ex_mq_mr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value || boost::asio::is_convertible<Param, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef CurrentType result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct require_member< ex_mq_mr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_mq_mr<CurrentType, OtherType> result_type; }; template <typename CurrentType, typename OtherType, typename Param> struct require_member< ex_mq_mr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, OtherType>::value && !boost::asio::is_same<CurrentType, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_mq_mr<OtherType, CurrentType> result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename CurrentType, typename OtherType> struct ex_fq_fr { friend CurrentType query(const ex_fq_fr&, CurrentType) noexcept { return CurrentType(); } friend CurrentType query(const ex_fq_fr&, OtherType) noexcept { return CurrentType(); } friend ex_fq_fr<CurrentType, OtherType> require( const ex_fq_fr&, CurrentType) noexcept { return ex_fq_fr<CurrentType, OtherType>(); } friend ex_fq_fr<OtherType, CurrentType> require( const ex_fq_fr&, OtherType) noexcept { return ex_fq_fr<OtherType, CurrentType>(); } friend ex_fq_fr<CurrentType, OtherType> prefer( const ex_fq_fr&, CurrentType) noexcept { return ex_fq_fr<CurrentType, OtherType>(); } friend ex_fq_fr<OtherType, CurrentType> prefer( const ex_fq_fr&, OtherType) noexcept { return ex_fq_fr<OtherType, CurrentType>(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_fq_fr&, const ex_fq_fr&) noexcept { return true; } friend bool operator!=(const ex_fq_fr&, const ex_fq_fr&) noexcept { return false; } }; template <typename CurrentType> struct ex_fq_fr<CurrentType, CurrentType> { friend CurrentType query(const ex_fq_fr&, CurrentType) noexcept { return CurrentType(); } friend ex_fq_fr<CurrentType, CurrentType> require( const ex_fq_fr&, CurrentType) noexcept { return ex_fq_fr<CurrentType, CurrentType>(); } friend ex_fq_fr<CurrentType, CurrentType> prefer( const ex_fq_fr&, CurrentType) noexcept { return ex_fq_fr<CurrentType, CurrentType>(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_fq_fr&, const ex_fq_fr&) noexcept { return true; } friend bool operator!=(const ex_fq_fr&, const ex_fq_fr&) noexcept { return false; } }; #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace execution { template <typename CurrentType, typename OtherType> struct is_executor<ex_fq_fr<CurrentType, OtherType> > : boost::asio::true_type { }; } // namespace execution } // namespace asio } // namespace boost #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct query_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value || boost::asio::is_convertible<Param, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef CurrentType result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_FREE_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct require_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_fq_fr<CurrentType, OtherType> result_type; }; template <typename CurrentType, typename OtherType, typename Param> struct require_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, OtherType>::value && !boost::asio::is_same<CurrentType, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_fq_fr<OtherType, CurrentType> result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_FREE_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_PREFER_FREE_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct prefer_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_fq_fr<CurrentType, OtherType> result_type; }; template <typename CurrentType, typename OtherType, typename Param> struct prefer_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, OtherType>::value && !boost::asio::is_same<CurrentType, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_fq_fr<OtherType, CurrentType> result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_PREFER_FREE_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename Executor, typename Param, bool ExpectedResult> void test_can_query() { constexpr bool b1 = boost::asio::can_query<Executor, Param>::value; BOOST_ASIO_CHECK(b1 == ExpectedResult); constexpr bool b2 = boost::asio::can_query<const Executor, Param>::value; BOOST_ASIO_CHECK(b2 == ExpectedResult); constexpr bool b3 = boost::asio::can_query<Executor&, Param>::value; BOOST_ASIO_CHECK(b3 == ExpectedResult); constexpr bool b4 = boost::asio::can_query<const Executor&, Param>::value; BOOST_ASIO_CHECK(b4 == ExpectedResult); } template <typename Executor, typename Param, typename ExpectedResult> void test_query() { exec::mapping_t result1 = boost::asio::query(Executor(), Param()); BOOST_ASIO_CHECK(result1 == ExpectedResult()); Executor ex1 = {}; exec::mapping_t result2 = boost::asio::query(ex1, Param()); BOOST_ASIO_CHECK(result2 == ExpectedResult()); const Executor ex2 = {}; exec::mapping_t result3 = boost::asio::query(ex2, Param()); BOOST_ASIO_CHECK(result3 == ExpectedResult()); } template <typename Executor, typename Param, typename ExpectedResult> void test_constexpr_query() { constexpr Executor ex1 = {}; constexpr exec::mapping_t result1 = boost::asio::query(ex1, Param()); BOOST_ASIO_CHECK(result1 == ExpectedResult()); } template <typename Executor, typename Param, bool ExpectedResult> void test_can_require() { constexpr bool b1 = boost::asio::can_require<Executor, Param>::value; BOOST_ASIO_CHECK(b1 == ExpectedResult); constexpr bool b2 = boost::asio::can_require<const Executor, Param>::value; BOOST_ASIO_CHECK(b2 == ExpectedResult); constexpr bool b3 = boost::asio::can_require<Executor&, Param>::value; BOOST_ASIO_CHECK(b3 == ExpectedResult); constexpr bool b4 = boost::asio::can_require<const Executor&, Param>::value; BOOST_ASIO_CHECK(b4 == ExpectedResult); } template <typename Executor, typename Param, typename ExpectedResult> void test_require() { BOOST_ASIO_CHECK( boost::asio::query( boost::asio::require(Executor(), Param()), Param()) == ExpectedResult()); Executor ex1 = {}; BOOST_ASIO_CHECK( boost::asio::query( boost::asio::require(ex1, Param()), Param()) == ExpectedResult()); const Executor ex2 = {}; BOOST_ASIO_CHECK( boost::asio::query( boost::asio::require(ex2, Param()), Param()) == ExpectedResult()); } template <typename Executor, typename Param, bool ExpectedResult> void test_can_prefer() { constexpr bool b1 = boost::asio::can_prefer<Executor, Param>::value; BOOST_ASIO_CHECK(b1 == ExpectedResult); constexpr bool b2 = boost::asio::can_prefer<const Executor, Param>::value; BOOST_ASIO_CHECK(b2 == ExpectedResult); constexpr bool b3 = boost::asio::can_prefer<Executor&, Param>::value; BOOST_ASIO_CHECK(b3 == ExpectedResult); constexpr bool b4 = boost::asio::can_prefer<const Executor&, Param>::value; BOOST_ASIO_CHECK(b4 == ExpectedResult); } template <typename Executor, typename Param, typename ExpectedResult> void test_prefer() { BOOST_ASIO_CHECK( s(boost::asio::query( boost::asio::prefer(Executor(), Param()), s())) == s(ExpectedResult())); Executor ex1 = {}; BOOST_ASIO_CHECK( s(boost::asio::query( boost::asio::prefer(ex1, Param()), s())) == s(ExpectedResult())); const Executor ex2 = {}; BOOST_ASIO_CHECK( s(boost::asio::query( boost::asio::prefer(ex2, Param()), s())) == s(ExpectedResult())); } void test_vars() { BOOST_ASIO_CHECK(s() == exec::mapping); BOOST_ASIO_CHECK(s() != exec::mapping.thread); BOOST_ASIO_CHECK(s() != exec::mapping.new_thread); BOOST_ASIO_CHECK(s() != exec::mapping.other); BOOST_ASIO_CHECK(n1() == exec::mapping.thread); BOOST_ASIO_CHECK(n1() != exec::mapping.new_thread); BOOST_ASIO_CHECK(n1() != exec::mapping.other); BOOST_ASIO_CHECK(n2() == exec::mapping.new_thread); BOOST_ASIO_CHECK(n2() != exec::mapping.thread); BOOST_ASIO_CHECK(n2() != exec::mapping.other); BOOST_ASIO_CHECK(n3() == exec::mapping.other); BOOST_ASIO_CHECK(n3() != exec::mapping.thread); BOOST_ASIO_CHECK(n3() != exec::mapping.new_thread); } BOOST_ASIO_TEST_SUITE ( "mapping", BOOST_ASIO_TEST_CASE3(test_can_query<ex_nq_nr, s, true>) BOOST_ASIO_TEST_CASE3(test_can_query<ex_nq_nr, n1, true>) BOOST_ASIO_TEST_CASE3(test_can_query<ex_nq_nr, n2, false>) BOOST_ASIO_TEST_CASE3(test_can_query<ex_nq_nr, n3, false>) BOOST_ASIO_TEST_CASE3(test_query<ex_nq_nr, s, n1>) BOOST_ASIO_TEST_CASE3(test_query<ex_nq_nr, n1, n1>) BOOST_ASIO_TEST_CASE3(test_constexpr_query<ex_nq_nr, s, n1>) BOOST_ASIO_TEST_CASE3(test_constexpr_query<ex_nq_nr, n1, n1>) BOOST_ASIO_TEST_CASE3(test_can_require<ex_nq_nr, s, false>) BOOST_ASIO_TEST_CASE3(test_can_require<ex_nq_nr, n1, true>) BOOST_ASIO_TEST_CASE3(test_can_require<ex_nq_nr, n2, false>) BOOST_ASIO_TEST_CASE3(test_can_require<ex_nq_nr, n3, false>) BOOST_ASIO_TEST_CASE3(test_require<ex_nq_nr, n1, n1>) BOOST_ASIO_TEST_CASE3(test_can_prefer<ex_nq_nr, s, false>) BOOST_ASIO_TEST_CASE3(test_can_prefer<ex_nq_nr, n1, true>) BOOST_ASIO_TEST_CASE3(test_can_prefer<ex_nq_nr, n2, true>) BOOST_ASIO_TEST_CASE3(test_can_prefer<ex_nq_nr, n3, true>) BOOST_ASIO_TEST_CASE3(test_prefer<ex_nq_nr, n1, n1>) BOOST_ASIO_TEST_CASE3(test_prefer<ex_nq_nr, n2, n1>) BOOST_ASIO_TEST_CASE3(test_prefer<ex_nq_nr, n3, n1>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n3, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n3, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n3, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n3, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n3, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n3, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n3, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n3, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n3, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n1, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n1, s, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n2, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n2, s, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n3, s, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n3, s, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n3, s, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n3, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n1, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n1, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n1, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n2, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n2, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n2, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n3, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n3, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n3, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n3, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n3, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n1, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n1, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n2, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n2, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n3, s, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n3, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n3, s, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n3, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n1, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n1, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n1, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n2, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n2, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n2, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n3, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n3, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n3, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n3, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n3, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n1, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n1, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n2, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n2, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n3, s, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n3, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n3, s, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n3, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n3, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n3, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n3, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n3, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n3, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n3, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n3, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n3, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n3, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n1, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n1, s, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n2, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n2, s, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n3, s, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n3, s, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n3, s, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n3, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<n3, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n3, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n3, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n3, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n3, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n3, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n3, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n3, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n3, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n3, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n3, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n3, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n1, s, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n2, s, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n3, s, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n3, s, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n3, s, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n3, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n3, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n3, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n3, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n3, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n3, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n3, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n3, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n3, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n1, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n2, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n3, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n3, s, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n3, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n3, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n3, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n3, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n3, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n3, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n3, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n3, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n3, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n3, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n1, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n1, s, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n2, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n2, s, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n3, s, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n3, s, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n3, s, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n3, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n1, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n1, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n1, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n2, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n2, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n2, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n3, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n3, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n3, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n3, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n3, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n1, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n1, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n2, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n2, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n3, s, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n3, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n3, s, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n3, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n3, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n3, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n3, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n3, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n3, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n3, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n3, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n3, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n3, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n3, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n1, s, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n1, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n1, s, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n2, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n2, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n2, s, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n3, s, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n3, s, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n3, s, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n3, s, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n3, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n3, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n3, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n3, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n3, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n3, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n3, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n3, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n3, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n3, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n3, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n1, s, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n2, s, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n3, s, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n3, s, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n3, s, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n3, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n3, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n3, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n3, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n3, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n3, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n3, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n3, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n3, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n1, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n2, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n3, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n3, s, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n3, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n3, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n3, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n3, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n3, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n3, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n3, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n3, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n3, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n3, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n1, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n1, s, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n2, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n2, s, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n3, s, n3>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n3, s, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n3, s, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n3, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n1, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n1, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n1, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n2, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n2, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n2, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n3, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n3, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n3, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n3, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n3, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n1, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n1, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n2, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n2, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n3, s, n3>, s, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n3, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n3, s, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n3, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n3, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n3, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n3, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n3, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n3, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n3, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n3, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n3, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n3, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n3, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n1, s, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n1, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n1, s, n1>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n2, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n2, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n2, s, n2>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n3, s, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n3, s, n3>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n3, s, n3>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n3, s, n3>, n3, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n3, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n3, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n3, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n3, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n3, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n3, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n3, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n3, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n3, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n3, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n3, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n1, s, n1>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n2, s, n2>, n3, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n3, s, n3>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n3, s, n3>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n3, s, n3>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n3, s, n3>, n3, true>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n3, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n3, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n3, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n3, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n3, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n3, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n3, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n3, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n1, s, n1>, n3, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n2, s, n2>, n3, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n3, s, n3>, n1, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n3, s, n3>, n2, n3>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n3, s, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n1>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n1>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n2>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n2>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n3>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n3>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n1>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n1>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n2>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n2>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n3>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n3>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n3>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n3, n1>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n3, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n3, n1>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n3, n2>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n3, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n3, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n3, n2>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n3, n3>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n3, n3>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n1, n2>, s, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n1, n3>, s, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n1, n3>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n2, n1>, s, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n2, n3>, s, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n2, n3>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n3, n1>, s, n3>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n3, n1>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n3, n2>, s, n3>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n3, n2>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n3, n3>, s, n3>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n1>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n2>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n3>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n3>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n1>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n2>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n3>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n3>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n3>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n3, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n3, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n3, n1>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n3, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n3, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n3, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n3, n2>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n3, n3>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n3, n3>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n1, n3>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n1, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n2, n3>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n2, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n3, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n3, n1>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n3, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n3, n2>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n1>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n2>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n3>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n3>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n3>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n1>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n2>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n3>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n3>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n3>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n3, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n3, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n3, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n3, n1>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n3, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n3, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n3, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n3, n2>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n3, n3>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n3, n3>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n3, n3>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n1>, n2, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n1>, n3, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n2>, n3, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n3>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n3>, n2, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n1>, n3, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n2>, n3, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n3>, n1, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n3>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n3, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n3, n1>, n2, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n3, n1>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n3, n2>, n1, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n3, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n3, n2>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n3, n3>, n1, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n3, n3>, n2, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n1>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n1>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n2>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n2>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n3>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n3>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n1>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n1>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n2>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n2>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n3>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n3>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n3>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n3, n1>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n3, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n3, n1>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n3, n2>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n3, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n3, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n3, n2>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n3, n3>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n3, n3>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n1, n2>, s, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n1, n3>, s, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n1, n3>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n2, n1>, s, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n2, n3>, s, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n2, n3>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n3, n1>, s, n3>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n3, n1>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n3, n2>, s, n3>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n3, n2>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n3, n3>, s, n3>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n1>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n2>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n3>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n3>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n3>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n1>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n2>, n3, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n3>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n3>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n3>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n3, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n3, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n3, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n3, n1>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n3, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n3, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n3, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n3, n2>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n3, n3>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n3, n3>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n3, n3>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n1, n3>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n1, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n2, n3>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n2, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n3, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n3, n1>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n3, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n3, n2>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n1>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n2>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n3>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n3>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n3>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n1>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n2>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n3>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n3>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n3>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n3, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n3, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n3, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n3, n1>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n3, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n3, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n3, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n3, n2>, n3, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n3, n3>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n3, n3>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n3, n3>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n3, n3>, n3, true>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n1>, n2, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n1>, n3, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n2>, n3, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n3>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n3>, n2, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n1>, n3, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n2>, n3, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n3>, n1, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n3>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n3>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n3, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n3, n1>, n2, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n3, n1>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n3, n2>, n1, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n3, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n3, n2>, n3, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n3, n3>, n1, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n3, n3>, n2, n3>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n3, n3>, n3, n3>) BOOST_ASIO_TEST_CASE(test_vars) )
cpp
asio
data/projects/asio/test/execution/outstanding_work.cpp
// // outstanding_work.cpp // ~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/execution/outstanding_work.hpp> #include <boost/asio/prefer.hpp> #include <boost/asio/query.hpp> #include <boost/asio/require.hpp> #include "../unit_test.hpp" namespace exec = boost::asio::execution; typedef exec::outstanding_work_t s; typedef exec::outstanding_work_t::untracked_t n1; typedef exec::outstanding_work_t::tracked_t n2; struct ex_nq_nr { template <typename F> void execute(const F&) const { } friend bool operator==(const ex_nq_nr&, const ex_nq_nr&) noexcept { return true; } friend bool operator!=(const ex_nq_nr&, const ex_nq_nr&) noexcept { return false; } }; #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace execution { template <> struct is_executor<ex_nq_nr> : boost::asio::true_type { }; } // namespace execution } // namespace asio } // namespace boost #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) template <typename ResultType, typename ParamType, typename Result> struct ex_cq_nr { static constexpr ResultType query(ParamType) noexcept { return Result(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_cq_nr&, const ex_cq_nr&) noexcept { return true; } friend bool operator!=(const ex_cq_nr&, const ex_cq_nr&) noexcept { return false; } }; #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace execution { template <typename ResultType, typename ParamType, typename Result> struct is_executor<ex_cq_nr<ResultType, ParamType, Result> > : boost::asio::true_type { }; } // namespace execution } // namespace asio } // namespace boost #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT) template <typename ResultType, typename ParamType, typename Result, typename Param> struct query_static_constexpr_member< ex_cq_nr<ResultType, ParamType, Result>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, ParamType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef Result result_type; // Must return raw result type. static constexpr result_type value() { return Result(); } }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename ResultType, typename ParamType, typename Result> struct ex_mq_nr { ResultType query(ParamType) const noexcept { return Result(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_mq_nr&, const ex_mq_nr&) noexcept { return true; } friend bool operator!=(const ex_mq_nr&, const ex_mq_nr&) noexcept { return false; } }; #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace execution { template <typename ResultType, typename ParamType, typename Result> struct is_executor<ex_mq_nr<ResultType, ParamType, Result> > : boost::asio::true_type { }; } // namespace execution } // namespace asio } // namespace boost #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) template <typename ResultType, typename ParamType, typename Result, typename Param> struct query_member< ex_mq_nr<ResultType, ParamType, Result>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, ParamType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ResultType result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename ResultType, typename ParamType, typename Result> struct ex_fq_nr { friend ResultType query(const ex_fq_nr&, ParamType) noexcept { return Result(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_fq_nr&, const ex_fq_nr&) noexcept { return true; } friend bool operator!=(const ex_fq_nr&, const ex_fq_nr&) noexcept { return false; } }; #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace execution { template <typename ResultType, typename ParamType, typename Result> struct is_executor<ex_fq_nr<ResultType, ParamType, Result> > : boost::asio::true_type { }; } // namespace execution } // namespace asio } // namespace boost #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) template <typename ResultType, typename ParamType, typename Result, typename Param> struct query_free< ex_fq_nr<ResultType, ParamType, Result>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, ParamType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ResultType result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename CurrentType, typename OtherType> struct ex_mq_mr { CurrentType query(CurrentType) const noexcept { return CurrentType(); } CurrentType query(OtherType) const noexcept { return CurrentType(); } ex_mq_mr<CurrentType, OtherType> require( CurrentType) const noexcept { return ex_mq_mr<CurrentType, OtherType>(); } ex_mq_mr<OtherType, CurrentType> require( OtherType) const noexcept { return ex_mq_mr<OtherType, CurrentType>(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_mq_mr&, const ex_mq_mr&) noexcept { return true; } friend bool operator!=(const ex_mq_mr&, const ex_mq_mr&) noexcept { return false; } }; template <typename CurrentType> struct ex_mq_mr<CurrentType, CurrentType> { CurrentType query(CurrentType) const noexcept { return CurrentType(); } ex_mq_mr<CurrentType, CurrentType> require( CurrentType) const noexcept { return ex_mq_mr<CurrentType, CurrentType>(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_mq_mr&, const ex_mq_mr&) noexcept { return true; } friend bool operator!=(const ex_mq_mr&, const ex_mq_mr&) noexcept { return false; } }; #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace execution { template <typename CurrentType, typename OtherType> struct is_executor<ex_mq_mr<CurrentType, OtherType> > : boost::asio::true_type { }; } // namespace execution } // namespace asio } // namespace boost #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct query_member< ex_mq_mr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value || boost::asio::is_convertible<Param, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef CurrentType result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct require_member< ex_mq_mr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_mq_mr<CurrentType, OtherType> result_type; }; template <typename CurrentType, typename OtherType, typename Param> struct require_member< ex_mq_mr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, OtherType>::value && !boost::asio::is_same<CurrentType, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_mq_mr<OtherType, CurrentType> result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename CurrentType, typename OtherType> struct ex_fq_fr { friend CurrentType query(const ex_fq_fr&, CurrentType) noexcept { return CurrentType(); } friend CurrentType query(const ex_fq_fr&, OtherType) noexcept { return CurrentType(); } friend ex_fq_fr<CurrentType, OtherType> require( const ex_fq_fr&, CurrentType) noexcept { return ex_fq_fr<CurrentType, OtherType>(); } friend ex_fq_fr<OtherType, CurrentType> require( const ex_fq_fr&, OtherType) noexcept { return ex_fq_fr<OtherType, CurrentType>(); } friend ex_fq_fr<CurrentType, OtherType> prefer( const ex_fq_fr&, CurrentType) noexcept { return ex_fq_fr<CurrentType, OtherType>(); } friend ex_fq_fr<OtherType, CurrentType> prefer( const ex_fq_fr&, OtherType) noexcept { return ex_fq_fr<OtherType, CurrentType>(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_fq_fr&, const ex_fq_fr&) noexcept { return true; } friend bool operator!=(const ex_fq_fr&, const ex_fq_fr&) noexcept { return false; } }; template <typename CurrentType> struct ex_fq_fr<CurrentType, CurrentType> { friend CurrentType query(const ex_fq_fr&, CurrentType) noexcept { return CurrentType(); } friend ex_fq_fr<CurrentType, CurrentType> require( const ex_fq_fr&, CurrentType) noexcept { return ex_fq_fr<CurrentType, CurrentType>(); } friend ex_fq_fr<CurrentType, CurrentType> prefer( const ex_fq_fr&, CurrentType) noexcept { return ex_fq_fr<CurrentType, CurrentType>(); } template <typename F> void execute(const F&) const { } friend bool operator==(const ex_fq_fr&, const ex_fq_fr&) noexcept { return true; } friend bool operator!=(const ex_fq_fr&, const ex_fq_fr&) noexcept { return false; } }; #if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace execution { template <typename CurrentType, typename OtherType> struct is_executor<ex_fq_fr<CurrentType, OtherType> > : boost::asio::true_type { }; } // namespace execution } // namespace asio } // namespace boost #endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTION_IS_EXECUTOR_TRAIT) namespace boost { namespace asio { namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct query_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value || boost::asio::is_convertible<Param, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef CurrentType result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_FREE_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct require_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_fq_fr<CurrentType, OtherType> result_type; }; template <typename CurrentType, typename OtherType, typename Param> struct require_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, OtherType>::value && !boost::asio::is_same<CurrentType, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_fq_fr<OtherType, CurrentType> result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_FREE_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_PREFER_FREE_TRAIT) template <typename CurrentType, typename OtherType, typename Param> struct prefer_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, CurrentType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_fq_fr<CurrentType, OtherType> result_type; }; template <typename CurrentType, typename OtherType, typename Param> struct prefer_free< ex_fq_fr<CurrentType, OtherType>, Param, typename boost::asio::enable_if< boost::asio::is_convertible<Param, OtherType>::value && !boost::asio::is_same<CurrentType, OtherType>::value >::type> { static constexpr bool is_valid = true; static constexpr bool is_noexcept = true; typedef ex_fq_fr<OtherType, CurrentType> result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_PREFER_FREE_TRAIT) } // namespace traits } // namespace asio } // namespace boost template <typename Executor, typename Param, bool ExpectedResult> void test_can_query() { constexpr bool b1 = boost::asio::can_query<Executor, Param>::value; BOOST_ASIO_CHECK(b1 == ExpectedResult); constexpr bool b2 = boost::asio::can_query<const Executor, Param>::value; BOOST_ASIO_CHECK(b2 == ExpectedResult); constexpr bool b3 = boost::asio::can_query<Executor&, Param>::value; BOOST_ASIO_CHECK(b3 == ExpectedResult); constexpr bool b4 = boost::asio::can_query<const Executor&, Param>::value; BOOST_ASIO_CHECK(b4 == ExpectedResult); } template <typename Executor, typename Param, typename ExpectedResult> void test_query() { exec::outstanding_work_t result1 = boost::asio::query(Executor(), Param()); BOOST_ASIO_CHECK(result1 == ExpectedResult()); Executor ex1 = {}; exec::outstanding_work_t result2 = boost::asio::query(ex1, Param()); BOOST_ASIO_CHECK(result2 == ExpectedResult()); const Executor ex2 = {}; exec::outstanding_work_t result3 = boost::asio::query(ex2, Param()); BOOST_ASIO_CHECK(result3 == ExpectedResult()); } template <typename Executor, typename Param, typename ExpectedResult> void test_constexpr_query() { constexpr Executor ex1 = {}; constexpr exec::outstanding_work_t result1 = boost::asio::query(ex1, Param()); BOOST_ASIO_CHECK(result1 == ExpectedResult()); } template <typename Executor, typename Param, bool ExpectedResult> void test_can_require() { constexpr bool b1 = boost::asio::can_require<Executor, Param>::value; BOOST_ASIO_CHECK(b1 == ExpectedResult); constexpr bool b2 = boost::asio::can_require<const Executor, Param>::value; BOOST_ASIO_CHECK(b2 == ExpectedResult); constexpr bool b3 = boost::asio::can_require<Executor&, Param>::value; BOOST_ASIO_CHECK(b3 == ExpectedResult); constexpr bool b4 = boost::asio::can_require<const Executor&, Param>::value; BOOST_ASIO_CHECK(b4 == ExpectedResult); } template <typename Executor, typename Param, typename ExpectedResult> void test_require() { BOOST_ASIO_CHECK( boost::asio::query( boost::asio::require(Executor(), Param()), Param()) == ExpectedResult()); Executor ex1 = {}; BOOST_ASIO_CHECK( boost::asio::query( boost::asio::require(ex1, Param()), Param()) == ExpectedResult()); const Executor ex2 = {}; BOOST_ASIO_CHECK( boost::asio::query( boost::asio::require(ex2, Param()), Param()) == ExpectedResult()); } template <typename Executor, typename Param, bool ExpectedResult> void test_can_prefer() { constexpr bool b1 = boost::asio::can_prefer<Executor, Param>::value; BOOST_ASIO_CHECK(b1 == ExpectedResult); constexpr bool b2 = boost::asio::can_prefer<const Executor, Param>::value; BOOST_ASIO_CHECK(b2 == ExpectedResult); constexpr bool b3 = boost::asio::can_prefer<Executor&, Param>::value; BOOST_ASIO_CHECK(b3 == ExpectedResult); constexpr bool b4 = boost::asio::can_prefer<const Executor&, Param>::value; BOOST_ASIO_CHECK(b4 == ExpectedResult); } template <typename Executor, typename Param, typename ExpectedResult> void test_prefer() { BOOST_ASIO_CHECK( s(boost::asio::query( boost::asio::prefer(Executor(), Param()), s())) == s(ExpectedResult())); Executor ex1 = {}; BOOST_ASIO_CHECK( s(boost::asio::query( boost::asio::prefer(ex1, Param()), s())) == s(ExpectedResult())); const Executor ex2 = {}; BOOST_ASIO_CHECK( s(boost::asio::query( boost::asio::prefer(ex2, Param()), s())) == s(ExpectedResult())); } void test_vars() { BOOST_ASIO_CHECK(s() == exec::outstanding_work); BOOST_ASIO_CHECK(s() != exec::outstanding_work.untracked); BOOST_ASIO_CHECK(s() != exec::outstanding_work.tracked); BOOST_ASIO_CHECK(n1() == exec::outstanding_work.untracked); BOOST_ASIO_CHECK(n1() != exec::outstanding_work.tracked); BOOST_ASIO_CHECK(n2() == exec::outstanding_work.tracked); BOOST_ASIO_CHECK(n2() != exec::outstanding_work.untracked); } BOOST_ASIO_TEST_SUITE ( "outstanding_work", BOOST_ASIO_TEST_CASE3(test_can_query<ex_nq_nr, s, true>) BOOST_ASIO_TEST_CASE3(test_can_query<ex_nq_nr, n1, true>) BOOST_ASIO_TEST_CASE3(test_can_query<ex_nq_nr, n2, false>) BOOST_ASIO_TEST_CASE3(test_query<ex_nq_nr, s, n1>) BOOST_ASIO_TEST_CASE3(test_query<ex_nq_nr, n1, n1>) BOOST_ASIO_TEST_CASE3(test_constexpr_query<ex_nq_nr, s, n1>) BOOST_ASIO_TEST_CASE3(test_constexpr_query<ex_nq_nr, n1, n1>) BOOST_ASIO_TEST_CASE3(test_can_require<ex_nq_nr, s, false>) BOOST_ASIO_TEST_CASE3(test_can_require<ex_nq_nr, n1, true>) BOOST_ASIO_TEST_CASE3(test_can_require<ex_nq_nr, n2, false>) BOOST_ASIO_TEST_CASE3(test_require<ex_nq_nr, n1, n1>) BOOST_ASIO_TEST_CASE3(test_can_prefer<ex_nq_nr, s, false>) BOOST_ASIO_TEST_CASE3(test_can_prefer<ex_nq_nr, n1, true>) BOOST_ASIO_TEST_CASE3(test_can_prefer<ex_nq_nr, n2, true>) BOOST_ASIO_TEST_CASE3(test_prefer<ex_nq_nr, n1, n1>) BOOST_ASIO_TEST_CASE3(test_prefer<ex_nq_nr, n2, n1>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n1, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n2, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_cq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n1, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n2, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n1, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n2, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_cq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n1, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n2, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n1, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n2, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_constexpr_query<ex_cq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n1, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n2, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_cq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_require<ex_cq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_cq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_cq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n1, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n2, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_mq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n1, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n2, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n1, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n2, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_mq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<s, n2, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n1, s, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n1, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n2, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_mq_nr<n2, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_mq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_mq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n1, s, n1>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n2, s, n2>, s, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_query<ex_fq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n1, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n2, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n1, s, n1>, s, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n2, s, n2>, s, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_query<ex_fq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n1, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<s, n2, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n1, s, n1>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n1, s, n1>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n2, s, n2>, n1, false>) BOOST_ASIO_TEST_CASE5(test_can_require<ex_fq_nr<n2, s, n2>, n2, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<s, n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n1, s, n1>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n1, s, n1>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n1, s, n1>, n2, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n2, s, n2>, s, false>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n2, s, n2>, n1, true>) BOOST_ASIO_TEST_CASE5(test_can_prefer<ex_fq_nr<n2, s, n2>, n2, true>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<s, n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n1, s, n1>, n1, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n1, s, n1>, n2, n1>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n2, s, n2>, n1, n2>) BOOST_ASIO_TEST_CASE5(test_prefer<ex_fq_nr<n2, s, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n1>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n2>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n1>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n2>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_mq_mr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n1, n2>, s, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n2, n1>, s, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_mq_mr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_mq_mr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_mq_mr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_mq_mr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n1>, n2, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_mq_mr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n1>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n2>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n1>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n2>, s, true>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_query<ex_fq_fr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n1, n1>, s, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n1, n2>, s, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n2, n1>, s, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n2, n2>, s, n2>) BOOST_ASIO_TEST_CASE4(test_query<ex_fq_fr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n1>, n2, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n2>, n1, false>) BOOST_ASIO_TEST_CASE4(test_can_require<ex_fq_fr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_require<ex_fq_fr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n1, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n1>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n1>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n1>, n2, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n2>, s, false>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n2>, n1, true>) BOOST_ASIO_TEST_CASE4(test_can_prefer<ex_fq_fr<n2, n2>, n2, true>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n1>, n2, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n2>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n1, n2>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n1>, n1, n1>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n1>, n2, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n2>, n1, n2>) BOOST_ASIO_TEST_CASE4(test_prefer<ex_fq_fr<n2, n2>, n2, n2>) BOOST_ASIO_TEST_CASE(test_vars) )
cpp
asio
data/projects/asio/test/latency/udp_server.cpp
// // udp_server.cpp // ~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #include <boost/asio/io_context.hpp> #include <boost/asio/ip/udp.hpp> #include <boost/shared_ptr.hpp> #include <cstdio> #include <cstdlib> #include <cstring> #include <vector> #include "allocator.hpp" using boost::asio::ip::udp; #include <boost/asio/yield.hpp> class udp_server : boost::asio::coroutine { public: udp_server(boost::asio::io_context& io_context, unsigned short port, std::size_t buf_size) : socket_(io_context, udp::endpoint(udp::v4(), port)), buffer_(buf_size) { } void operator()(boost::system::error_code ec, std::size_t n = 0) { reenter (this) for (;;) { yield socket_.async_receive_from( boost::asio::buffer(buffer_), sender_, ref(this)); if (!ec) { for (std::size_t i = 0; i < n; ++i) buffer_[i] = ~buffer_[i]; socket_.send_to(boost::asio::buffer(buffer_, n), sender_, 0, ec); } } } friend void* asio_handler_allocate(std::size_t n, udp_server* s) { return s->allocator_.allocate(n); } friend void asio_handler_deallocate(void* p, std::size_t, udp_server* s) { s->allocator_.deallocate(p); } struct ref { explicit ref(udp_server* p) : p_(p) { } void operator()(boost::system::error_code ec, std::size_t n = 0) { (*p_)(ec, n); } private: udp_server* p_; friend void* asio_handler_allocate(std::size_t n, ref* r) { return asio_handler_allocate(n, r->p_); } friend void asio_handler_deallocate(void* p, std::size_t n, ref* r) { asio_handler_deallocate(p, n, r->p_); } }; private: udp::socket socket_; std::vector<unsigned char> buffer_; udp::endpoint sender_; allocator allocator_; }; #include <boost/asio/unyield.hpp> int main(int argc, char* argv[]) { if (argc != 5) { std::fprintf(stderr, "Usage: udp_server <port1> <nports> " "<bufsize> {spin|block}\n"); return 1; } unsigned short first_port = static_cast<unsigned short>(std::atoi(argv[1])); unsigned short num_ports = static_cast<unsigned short>(std::atoi(argv[2])); std::size_t buf_size = std::atoi(argv[3]); bool spin = (std::strcmp(argv[4], "spin") == 0); boost::asio::io_context io_context(1); std::vector<boost::shared_ptr<udp_server> > servers; for (unsigned short i = 0; i < num_ports; ++i) { unsigned short port = first_port + i; boost::shared_ptr<udp_server> s(new udp_server(io_context, port, buf_size)); servers.push_back(s); (*s)(boost::system::error_code()); } if (spin) for (;;) io_context.poll(); else io_context.run(); }
cpp
asio
data/projects/asio/test/latency/tcp_client.cpp
// // tcp_client.cpp // ~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #include <boost/asio/ip/tcp.hpp> #include <boost/asio/read.hpp> #include <boost/asio/write.hpp> #include <boost/date_time/posix_time/posix_time_types.hpp> #include <boost/shared_ptr.hpp> #include <cstdio> #include <cstdlib> #include <cstring> #include <vector> #include "high_res_clock.hpp" using boost::asio::ip::tcp; using boost::posix_time::ptime; using boost::posix_time::microsec_clock; const int num_samples = 100000; struct transfer_all { typedef std::size_t result_type; std::size_t operator()(const boost::system::error_code& ec, std::size_t) { return (ec && ec != boost::asio::error::would_block) ? 0 : ~0; } }; int main(int argc, char* argv[]) { if (argc != 6) { std::fprintf(stderr, "Usage: tcp_client <ip> <port> " "<nconns> <bufsize> {spin|block}\n"); return 1; } const char* ip = argv[1]; unsigned short port = static_cast<unsigned short>(std::atoi(argv[2])); int num_connections = std::atoi(argv[3]); std::size_t buf_size = static_cast<std::size_t>(std::atoi(argv[4])); bool spin = (std::strcmp(argv[5], "spin") == 0); boost::asio::io_context io_context; std::vector<boost::shared_ptr<tcp::socket> > sockets; for (int i = 0; i < num_connections; ++i) { boost::shared_ptr<tcp::socket> s(new tcp::socket(io_context)); tcp::endpoint target(boost::asio::ip::make_address(ip), port); s->connect(target); s->set_option(tcp::no_delay(true)); if (spin) { s->non_blocking(true); } sockets.push_back(s); } std::vector<unsigned char> write_buf(buf_size); std::vector<unsigned char> read_buf(buf_size); ptime start = microsec_clock::universal_time(); boost::uint64_t start_hr = high_res_clock(); boost::uint64_t samples[num_samples]; for (int i = 0; i < num_samples; ++i) { tcp::socket& socket = *sockets[i % num_connections]; boost::uint64_t t = high_res_clock(); boost::system::error_code ec; boost::asio::write(socket, boost::asio::buffer(write_buf), transfer_all(), ec); boost::asio::read(socket, boost::asio::buffer(read_buf), transfer_all(), ec); samples[i] = high_res_clock() - t; } ptime stop = microsec_clock::universal_time(); boost::uint64_t stop_hr = high_res_clock(); boost::uint64_t elapsed_usec = (stop - start).total_microseconds(); boost::uint64_t elapsed_hr = stop_hr - start_hr; double scale = 1.0 * elapsed_usec / elapsed_hr; std::sort(samples, samples + num_samples); std::printf(" 0.0%%\t%f\n", samples[0] * scale); std::printf(" 0.1%%\t%f\n", samples[num_samples / 1000 - 1] * scale); std::printf(" 1.0%%\t%f\n", samples[num_samples / 100 - 1] * scale); std::printf(" 10.0%%\t%f\n", samples[num_samples / 10 - 1] * scale); std::printf(" 20.0%%\t%f\n", samples[num_samples * 2 / 10 - 1] * scale); std::printf(" 30.0%%\t%f\n", samples[num_samples * 3 / 10 - 1] * scale); std::printf(" 40.0%%\t%f\n", samples[num_samples * 4 / 10 - 1] * scale); std::printf(" 50.0%%\t%f\n", samples[num_samples * 5 / 10 - 1] * scale); std::printf(" 60.0%%\t%f\n", samples[num_samples * 6 / 10 - 1] * scale); std::printf(" 70.0%%\t%f\n", samples[num_samples * 7 / 10 - 1] * scale); std::printf(" 80.0%%\t%f\n", samples[num_samples * 8 / 10 - 1] * scale); std::printf(" 90.0%%\t%f\n", samples[num_samples * 9 / 10 - 1] * scale); std::printf(" 99.0%%\t%f\n", samples[num_samples * 99 / 100 - 1] * scale); std::printf(" 99.9%%\t%f\n", samples[num_samples * 999 / 1000 - 1] * scale); std::printf("100.0%%\t%f\n", samples[num_samples - 1] * scale); double total = 0.0; for (int i = 0; i < num_samples; ++i) total += samples[i] * scale; std::printf(" mean\t%f\n", total / num_samples); }
cpp
asio
data/projects/asio/test/latency/allocator.hpp
// // allocator.hpp // ~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #ifndef ALLOCATOR_HPP #define ALLOCATOR_HPP #include <boost/aligned_storage.hpp> // Represents a single connection from a client. class allocator { public: allocator() : in_use_(false) { } void* allocate(std::size_t n) { if (in_use_ || n >= 1024) return ::operator new(n); in_use_ = true; return static_cast<void*>(&space_); } void deallocate(void* p) { if (p != static_cast<void*>(&space_)) ::operator delete(p); else in_use_ = false; } private: allocator(const allocator&); allocator& operator=(const allocator&); // Whether the reusable memory space is currently in use. bool in_use_; // The reusable memory space made available by the allocator. boost::aligned_storage<1024>::type space_; }; #endif // ALLOCATOR_HPP
hpp
asio
data/projects/asio/test/latency/tcp_server.cpp
// // tcp_server.cpp // ~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #include <boost/asio/io_context.hpp> #include <boost/asio/ip/tcp.hpp> #include <boost/asio/read.hpp> #include <boost/asio/write.hpp> #include <boost/shared_ptr.hpp> #include <cstdio> #include <cstdlib> #include <cstring> #include <vector> using boost::asio::ip::tcp; #include <boost/asio/yield.hpp> class tcp_server : boost::asio::coroutine { public: tcp_server(tcp::acceptor& acceptor, std::size_t buf_size) : acceptor_(acceptor), socket_(acceptor_.get_executor()), buffer_(buf_size) { } void operator()(boost::system::error_code ec, std::size_t n = 0) { reenter (this) for (;;) { yield acceptor_.async_accept(socket_, ref(this)); while (!ec) { yield boost::asio::async_read(socket_, boost::asio::buffer(buffer_), ref(this)); if (!ec) { for (std::size_t i = 0; i < n; ++i) buffer_[i] = ~buffer_[i]; yield boost::asio::async_write(socket_, boost::asio::buffer(buffer_), ref(this)); } } socket_.close(); } } struct ref { explicit ref(tcp_server* p) : p_(p) { } void operator()(boost::system::error_code ec, std::size_t n = 0) { (*p_)(ec, n); } private: tcp_server* p_; }; private: tcp::acceptor& acceptor_; tcp::socket socket_; std::vector<unsigned char> buffer_; tcp::endpoint sender_; }; #include <boost/asio/unyield.hpp> int main(int argc, char* argv[]) { if (argc != 5) { std::fprintf(stderr, "Usage: tcp_server <port> <nconns> " "<bufsize> {spin|block}\n"); return 1; } unsigned short port = static_cast<unsigned short>(std::atoi(argv[1])); int max_connections = std::atoi(argv[2]); std::size_t buf_size = std::atoi(argv[3]); bool spin = (std::strcmp(argv[4], "spin") == 0); boost::asio::io_context io_context(1); tcp::acceptor acceptor(io_context, tcp::endpoint(tcp::v4(), port)); std::vector<boost::shared_ptr<tcp_server> > servers; for (int i = 0; i < max_connections; ++i) { boost::shared_ptr<tcp_server> s(new tcp_server(acceptor, buf_size)); servers.push_back(s); (*s)(boost::system::error_code()); } if (spin) for (;;) io_context.poll(); else io_context.run(); }
cpp
asio
data/projects/asio/test/latency/udp_client.cpp
// // udp_client.cpp // ~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #include <boost/asio/ip/udp.hpp> #include <boost/date_time/posix_time/posix_time_types.hpp> #include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <vector> #include "high_res_clock.hpp" using boost::asio::ip::udp; using boost::posix_time::ptime; using boost::posix_time::microsec_clock; const int num_samples = 100000; int main(int argc, char* argv[]) { if (argc != 6) { std::fprintf(stderr, "Usage: udp_client <ip> <port1> " "<nports> <bufsize> {spin|block}\n"); return 1; } const char* ip = argv[1]; unsigned short first_port = static_cast<unsigned short>(std::atoi(argv[2])); unsigned short num_ports = static_cast<unsigned short>(std::atoi(argv[3])); std::size_t buf_size = static_cast<std::size_t>(std::atoi(argv[4])); bool spin = (std::strcmp(argv[5], "spin") == 0); boost::asio::io_context io_context; udp::socket socket(io_context, udp::endpoint(udp::v4(), 0)); if (spin) { socket.non_blocking(true); } udp::endpoint target(boost::asio::ip::make_address(ip), first_port); unsigned short last_port = first_port + num_ports - 1; std::vector<unsigned char> write_buf(buf_size); std::vector<unsigned char> read_buf(buf_size); ptime start = microsec_clock::universal_time(); boost::uint64_t start_hr = high_res_clock(); boost::uint64_t samples[num_samples]; for (int i = 0; i < num_samples; ++i) { boost::uint64_t t = high_res_clock(); boost::system::error_code ec; socket.send_to(boost::asio::buffer(write_buf), target, 0, ec); do socket.receive(boost::asio::buffer(read_buf), 0, ec); while (ec == boost::asio::error::would_block); samples[i] = high_res_clock() - t; if (target.port() == last_port) target.port(first_port); else target.port(target.port() + 1); } ptime stop = microsec_clock::universal_time(); boost::uint64_t stop_hr = high_res_clock(); boost::uint64_t elapsed_usec = (stop - start).total_microseconds(); boost::uint64_t elapsed_hr = stop_hr - start_hr; double scale = 1.0 * elapsed_usec / elapsed_hr; std::sort(samples, samples + num_samples); std::printf(" 0.0%%\t%f\n", samples[0] * scale); std::printf(" 0.1%%\t%f\n", samples[num_samples / 1000 - 1] * scale); std::printf(" 1.0%%\t%f\n", samples[num_samples / 100 - 1] * scale); std::printf(" 10.0%%\t%f\n", samples[num_samples / 10 - 1] * scale); std::printf(" 20.0%%\t%f\n", samples[num_samples * 2 / 10 - 1] * scale); std::printf(" 30.0%%\t%f\n", samples[num_samples * 3 / 10 - 1] * scale); std::printf(" 40.0%%\t%f\n", samples[num_samples * 4 / 10 - 1] * scale); std::printf(" 50.0%%\t%f\n", samples[num_samples * 5 / 10 - 1] * scale); std::printf(" 60.0%%\t%f\n", samples[num_samples * 6 / 10 - 1] * scale); std::printf(" 70.0%%\t%f\n", samples[num_samples * 7 / 10 - 1] * scale); std::printf(" 80.0%%\t%f\n", samples[num_samples * 8 / 10 - 1] * scale); std::printf(" 90.0%%\t%f\n", samples[num_samples * 9 / 10 - 1] * scale); std::printf(" 99.0%%\t%f\n", samples[num_samples * 99 / 100 - 1] * scale); std::printf(" 99.9%%\t%f\n", samples[num_samples * 999 / 1000 - 1] * scale); std::printf("100.0%%\t%f\n", samples[num_samples - 1] * scale); double total = 0.0; for (int i = 0; i < num_samples; ++i) total += samples[i] * scale; std::printf(" mean\t%f\n", total / num_samples); }
cpp
asio
data/projects/asio/test/latency/high_res_clock.hpp
// // high_res_clock.hpp // ~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #ifndef HIGH_RES_CLOCK_HPP #define HIGH_RES_CLOCK_HPP #include <boost/config.hpp> #include <boost/cstdint.hpp> #if defined(BOOST_ASIO_WINDOWS) inline boost::uint64_t high_res_clock() { LARGE_INTEGER i; QueryPerformanceCounter(&i); return i.QuadPart; } #elif defined(__GNUC__) && defined(__x86_64__) inline boost::uint64_t high_res_clock() { unsigned long low, high; __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high)); return (((boost::uint64_t)high) << 32) | low; } #else #include <boost/date_time/posix_time/posix_time_types.hpp> inline boost::uint64_t high_res_clock() { boost::posix_time::ptime now = boost::posix_time::microsec_clock::universal_time(); boost::posix_time::ptime epoch( boost::gregorian::date(1970, 1, 1), boost::posix_time::seconds(0)); return (now - epoch).total_microseconds(); } #endif #endif // HIGH_RES_CLOCK_HPP
hpp
asio
data/projects/asio/test/windows/object_handle.cpp
// // object_handle.cpp // ~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/windows/object_handle.hpp> #include <boost/asio/io_context.hpp> #include "../archetypes/async_result.hpp" #include "../unit_test.hpp" //------------------------------------------------------------------------------ // windows_object_handle_compile test // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // The following test checks that all public member functions on the class // windows::object_handle compile and link correctly. Runtime failures are // ignored. namespace windows_object_handle_compile { void wait_handler(const boost::system::error_code&) { } void test() { #if defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) using namespace boost::asio; namespace win = boost::asio::windows; try { io_context ioc; const io_context::executor_type ioc_ex = ioc.get_executor(); archetypes::lazy_handler lazy; boost::system::error_code ec; // basic_object_handle constructors. win::object_handle handle1(ioc); HANDLE native_handle1 = INVALID_HANDLE_VALUE; #if defined(BOOST_ASIO_MSVC) && (_MSC_VER < 1910) // Skip this on older MSVC due to mysterious ambiguous overload errors. #else win::object_handle handle2(ioc, native_handle1); #endif win::object_handle handle3(ioc_ex); HANDLE native_handle2 = INVALID_HANDLE_VALUE; win::object_handle handle4(ioc_ex, native_handle2); win::object_handle handle5(std::move(handle4)); win::basic_object_handle<io_context::executor_type> handle6(ioc); win::object_handle handle7(std::move(handle6)); // basic_object_handle operators. handle1 = win::object_handle(ioc); handle1 = std::move(handle3); handle1 = std::move(handle6); // basic_io_object functions. win::object_handle::executor_type ex = handle1.get_executor(); (void)ex; // basic_handle functions. win::object_handle::lowest_layer_type& lowest_layer = handle1.lowest_layer(); (void)lowest_layer; const win::object_handle& handle8 = handle1; const win::object_handle::lowest_layer_type& lowest_layer3 = handle8.lowest_layer(); (void)lowest_layer3; HANDLE native_handle4 = INVALID_HANDLE_VALUE; handle1.assign(native_handle4); bool is_open = handle1.is_open(); (void)is_open; handle1.close(); handle1.close(ec); win::object_handle::native_handle_type native_handle3 = handle1.native_handle(); (void)native_handle3; handle1.cancel(); handle1.cancel(ec); // basic_object_handle functions. handle1.wait(); handle1.wait(ec); handle1.async_wait(&wait_handler); int i1 = handle1.async_wait(lazy); (void)i1; } catch (std::exception&) { } #endif // defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) } } // namespace windows_object_handle_compile //------------------------------------------------------------------------------ BOOST_ASIO_TEST_SUITE ( "windows/object_handle", BOOST_ASIO_COMPILE_TEST_CASE(windows_object_handle_compile::test) )
cpp
asio
data/projects/asio/test/windows/random_access_handle.cpp
// // random_access_handle.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/windows/random_access_handle.hpp> #include <boost/asio/io_context.hpp> #include "../archetypes/async_result.hpp" #include "../unit_test.hpp" //------------------------------------------------------------------------------ // windows_random_access_handle_compile test // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // The following test checks that all public member functions on the class // windows::random_access_handle compile and link correctly. Runtime failures // are ignored. namespace windows_random_access_handle_compile { void write_some_handler(const boost::system::error_code&, std::size_t) { } void read_some_handler(const boost::system::error_code&, std::size_t) { } void test() { #if defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) using namespace boost::asio; namespace win = boost::asio::windows; try { io_context ioc; const io_context::executor_type ioc_ex = ioc.get_executor(); char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; boost::asio::uint64_t offset = 0; archetypes::lazy_handler lazy; boost::system::error_code ec; // basic_random_access_handle constructors. win::random_access_handle handle1(ioc); HANDLE native_handle1 = INVALID_HANDLE_VALUE; #if defined(BOOST_ASIO_MSVC) && (_MSC_VER < 1910) // Skip this on older MSVC due to mysterious ambiguous overload errors. #else win::random_access_handle handle2(ioc, native_handle1); #endif win::random_access_handle handle3(ioc_ex); HANDLE native_handle2 = INVALID_HANDLE_VALUE; win::random_access_handle handle4(ioc_ex, native_handle2); win::random_access_handle handle5(std::move(handle4)); win::basic_random_access_handle<io_context::executor_type> handle6(ioc); win::random_access_handle handle7(std::move(handle6)); // basic_random_access_handle operators. handle1 = win::random_access_handle(ioc); handle1 = std::move(handle4); handle1 = std::move(handle6); // basic_io_object functions. windows::random_access_handle::executor_type ex = handle1.get_executor(); (void)ex; // basic_overlapped_handle functions. win::random_access_handle::lowest_layer_type& lowest_layer = handle1.lowest_layer(); (void)lowest_layer; const win::random_access_handle& handle8 = handle1; const win::random_access_handle::lowest_layer_type& lowest_layer2 = handle8.lowest_layer(); (void)lowest_layer2; HANDLE native_handle3 = INVALID_HANDLE_VALUE; handle1.assign(native_handle3); bool is_open = handle1.is_open(); (void)is_open; handle1.close(); handle1.close(ec); win::random_access_handle::native_handle_type native_handle4 = handle1.release(); (void)native_handle4; win::random_access_handle::native_handle_type native_handle5 = handle1.release(ec); (void)native_handle5; win::random_access_handle::native_handle_type native_handle6 = handle1.native_handle(); (void)native_handle6; handle1.cancel(); handle1.cancel(ec); // basic_random_access_handle functions. handle1.write_some_at(offset, buffer(mutable_char_buffer)); handle1.write_some_at(offset, buffer(const_char_buffer)); handle1.write_some_at(offset, buffer(mutable_char_buffer), ec); handle1.write_some_at(offset, buffer(const_char_buffer), ec); handle1.async_write_some_at(offset, buffer(mutable_char_buffer), &write_some_handler); handle1.async_write_some_at(offset, buffer(const_char_buffer), &write_some_handler); int i1 = handle1.async_write_some_at(offset, buffer(mutable_char_buffer), lazy); (void)i1; int i2 = handle1.async_write_some_at(offset, buffer(const_char_buffer), lazy); (void)i2; handle1.read_some_at(offset, buffer(mutable_char_buffer)); handle1.read_some_at(offset, buffer(mutable_char_buffer), ec); handle1.async_read_some_at(offset, buffer(mutable_char_buffer), &read_some_handler); int i3 = handle1.async_read_some_at(offset, buffer(mutable_char_buffer), lazy); (void)i3; } catch (std::exception&) { } #endif // defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) } } // namespace windows_random_access_handle_compile //------------------------------------------------------------------------------ BOOST_ASIO_TEST_SUITE ( "windows/random_access_handle", BOOST_ASIO_COMPILE_TEST_CASE(windows_random_access_handle_compile::test) )
cpp
asio
data/projects/asio/test/windows/basic_random_access_handle.cpp
// // basic_random_access_handle.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/windows/basic_random_access_handle.hpp> #include "../unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "basic_random_access_handle", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/windows/basic_object_handle.cpp
// // basic_object_handle.cpp // ~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/windows/basic_object_handle.hpp> #include "../unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "basic_object_handle", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/windows/basic_overlapped_handle.cpp
// // basic_overlapped_handle.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/windows/basic_overlapped_handle.hpp> #include "../unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "basic_overlapped_handle", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/windows/overlapped_ptr.cpp
// // overlapped_ptr.cpp // ~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/windows/overlapped_ptr.hpp> #include <boost/asio/any_io_executor.hpp> #include <boost/asio/executor.hpp> #include <boost/asio/io_context.hpp> #include "../unit_test.hpp" //------------------------------------------------------------------------------ // windows_overlapped_ptr_compile test // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // The following test checks that all public member functions on the class // windows::overlapped_ptr compile and link correctly. Runtime failures are // ignored. namespace windows_overlapped_ptr_compile { void overlapped_handler_1(const boost::system::error_code&, std::size_t) { } struct overlapped_handler_2 { void operator()(const boost::system::error_code&, std::size_t) { } }; void test() { #if defined(BOOST_ASIO_HAS_WINDOWS_OVERLAPPED_PTR) using namespace boost::asio; namespace win = boost::asio::windows; try { io_context ioc; boost::asio::any_io_executor ex1(ioc.get_executor()); #if !defined(BOOST_ASIO_NO_TS_EXECUTORS) boost::asio::executor ex2(ioc.get_executor()); #endif // !defined(BOOST_ASIO_NO_TS_EXECUTORS) // basic_overlapped_ptr constructors. win::overlapped_ptr ptr1; win::overlapped_ptr ptr2(ioc, &overlapped_handler_1); win::overlapped_ptr ptr3(ioc, overlapped_handler_2()); win::overlapped_ptr ptr4(ioc.get_executor(), &overlapped_handler_1); win::overlapped_ptr ptr5(ioc.get_executor(), overlapped_handler_2()); win::overlapped_ptr ptr6(ex1, &overlapped_handler_1); win::overlapped_ptr ptr7(ex1, overlapped_handler_2()); #if !defined(BOOST_ASIO_NO_TS_EXECUTORS) win::overlapped_ptr ptr8(ex2, &overlapped_handler_1); win::overlapped_ptr ptr9(ex2, overlapped_handler_2()); #endif // !defined(BOOST_ASIO_NO_TS_EXECUTORS) // overlapped_ptr functions. ptr1.reset(); ptr2.reset(ioc, &overlapped_handler_1); ptr3.reset(ioc, overlapped_handler_2()); ptr2.reset(ioc.get_executor(), &overlapped_handler_1); ptr3.reset(ioc.get_executor(), overlapped_handler_2()); ptr2.reset(ex1, &overlapped_handler_1); ptr3.reset(ex1, overlapped_handler_2()); #if !defined(BOOST_ASIO_NO_TS_EXECUTORS) ptr3.reset(ex2, &overlapped_handler_1); ptr3.reset(ex2, overlapped_handler_2()); #endif // !defined(BOOST_ASIO_NO_TS_EXECUTORS) OVERLAPPED* ov1 = ptr1.get(); (void)ov1; const win::overlapped_ptr& ptr10(ptr1); const OVERLAPPED* ov2 = ptr10.get(); (void)ov2; OVERLAPPED* ov3 = ptr1.release(); (void)ov3; boost::system::error_code ec; std::size_t bytes_transferred = 0; ptr1.complete(ec, bytes_transferred); } catch (std::exception&) { } #endif // defined(BOOST_ASIO_HAS_WINDOWS_OVERLAPPED_PTR) } } // namespace windows_overlapped_ptr_compile //------------------------------------------------------------------------------ BOOST_ASIO_TEST_SUITE ( "windows/overlapped_ptr", BOOST_ASIO_COMPILE_TEST_CASE(windows_overlapped_ptr_compile::test) )
cpp
asio
data/projects/asio/test/windows/basic_stream_handle.cpp
// // basic_stream_handle.cpp // ~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/windows/basic_stream_handle.hpp> #include "../unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "basic_stream_handle", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/windows/stream_handle.cpp
// // stream_handle.cpp // ~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/windows/stream_handle.hpp> #include <boost/asio/io_context.hpp> #include "../archetypes/async_result.hpp" #include "../unit_test.hpp" //------------------------------------------------------------------------------ // windows_stream_handle_compile test // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // The following test checks that all public member functions on the class // windows::stream_handle compile and link correctly. Runtime failures are // ignored. namespace windows_stream_handle_compile { void write_some_handler(const boost::system::error_code&, std::size_t) { } void read_some_handler(const boost::system::error_code&, std::size_t) { } void test() { #if defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE) using namespace boost::asio; namespace win = boost::asio::windows; try { io_context ioc; const io_context::executor_type ioc_ex = ioc.get_executor(); char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; archetypes::lazy_handler lazy; boost::system::error_code ec; // basic_stream_handle constructors. win::stream_handle handle1(ioc); HANDLE native_handle1 = INVALID_HANDLE_VALUE; #if defined(BOOST_ASIO_MSVC) && (_MSC_VER < 1910) // Skip this on older MSVC due to mysterious ambiguous overload errors. #else win::stream_handle handle2(ioc, native_handle1); #endif win::stream_handle handle3(ioc_ex); HANDLE native_handle2 = INVALID_HANDLE_VALUE; win::stream_handle handle4(ioc_ex, native_handle2); win::stream_handle handle5(std::move(handle4)); win::basic_stream_handle<io_context::executor_type> handle6(ioc); win::stream_handle handle7(std::move(handle6)); // basic_stream_handle operators. handle1 = win::stream_handle(ioc); handle1 = std::move(handle4); handle1 = std::move(handle6); // basic_io_object functions. windows::stream_handle::executor_type ex = handle1.get_executor(); (void)ex; // basic_overlapped_handle functions. win::stream_handle::lowest_layer_type& lowest_layer = handle1.lowest_layer(); (void)lowest_layer; const win::stream_handle& handle8 = handle1; const win::stream_handle::lowest_layer_type& lowest_layer2 = handle8.lowest_layer(); (void)lowest_layer2; HANDLE native_handle3 = INVALID_HANDLE_VALUE; handle1.assign(native_handle3); bool is_open = handle1.is_open(); (void)is_open; handle1.close(); handle1.close(ec); win::stream_handle::native_handle_type native_handle4 = handle1.release(); (void)native_handle4; win::stream_handle::native_handle_type native_handle5 = handle1.release(ec); (void)native_handle5; win::stream_handle::native_handle_type native_handle6 = handle1.native_handle(); (void)native_handle6; handle1.cancel(); handle1.cancel(ec); // basic_stream_handle functions. handle1.write_some(buffer(mutable_char_buffer)); handle1.write_some(buffer(const_char_buffer)); handle1.write_some(buffer(mutable_char_buffer), ec); handle1.write_some(buffer(const_char_buffer), ec); handle1.async_write_some(buffer(mutable_char_buffer), &write_some_handler); handle1.async_write_some(buffer(const_char_buffer), &write_some_handler); int i1 = handle1.async_write_some(buffer(mutable_char_buffer), lazy); (void)i1; int i2 = handle1.async_write_some(buffer(const_char_buffer), lazy); (void)i2; handle1.read_some(buffer(mutable_char_buffer)); handle1.read_some(buffer(mutable_char_buffer), ec); handle1.async_read_some(buffer(mutable_char_buffer), &read_some_handler); int i3 = handle1.async_read_some(buffer(mutable_char_buffer), lazy); (void)i3; } catch (std::exception&) { } #endif // defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE) } } // namespace windows_stream_handle_compile //------------------------------------------------------------------------------ BOOST_ASIO_TEST_SUITE ( "windows/stream_handle", BOOST_ASIO_COMPILE_TEST_CASE(windows_stream_handle_compile::test) )
cpp
asio
data/projects/asio/test/windows/overlapped_handle.cpp
// // overlapped_handle.cpp // ~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/windows/overlapped_handle.hpp> #include <boost/asio.hpp> #include "../unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "windows/overlapped_handle", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/experimental/basic_channel.cpp
// // experimental/basic_channel.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/experimental/basic_channel.hpp> #include "../unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "experimental/basic_channel", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/experimental/promise.cpp
// // promise.cpp // ~~~~~~~~~~~ // // Copyright (c) 2021-2023 Klemens D. Morgenstern // (klemens dot morgenstern at gmx dot net) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/experimental/promise.hpp> #include <boost/asio/append.hpp> #include <boost/asio/bind_cancellation_slot.hpp> #include <boost/asio/compose.hpp> #include <boost/asio/deferred.hpp> #include <boost/asio/experimental/use_promise.hpp> #include <boost/asio/steady_timer.hpp> #include "../unit_test.hpp" namespace promise { void promise_tester() { using namespace boost::asio; using namespace std::chrono; io_context ctx; steady_timer timer1{ctx}, timer2{ctx}; const auto started_when = steady_clock::now(); timer1.expires_at(started_when + milliseconds(5000)); timer2.expires_at(started_when + milliseconds(1000)); auto p1 = timer1.async_wait(experimental::use_promise); steady_clock::time_point completed_when; boost::system::error_code ec; bool called = false; p1([&](boost::system::error_code ec_) { ec = ec_; called = true; completed_when = steady_clock::now(); }); steady_clock::time_point timer2_done; timer2.async_wait( [&](boost::system::error_code) { timer2_done = steady_clock::now(); p1.cancel(); }); ctx.run(); static_assert( boost::asio::is_async_operation<decltype(p1)>::value, "promise is async_op"); BOOST_ASIO_CHECK(timer2_done + milliseconds(1) > started_when); BOOST_ASIO_CHECK(completed_when > timer2_done); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(ec == error::operation_aborted); timer1.expires_after(milliseconds(0)); auto p2 = timer1.async_wait( boost::asio::append(experimental::use_promise, 123)); ec = boost::asio::error::would_block; called = false; p2([&](boost::system::error_code ec_, int i) { BOOST_ASIO_CHECK(i == 123); ec = ec_; called = true; }); BOOST_ASIO_CHECK(ec == boost::asio::error::would_block); BOOST_ASIO_CHECK(!called); ctx.restart(); ctx.run(); static_assert( boost::asio::is_async_operation<decltype(p2)>::value, "promise is async_op"); BOOST_ASIO_CHECK(!ec); BOOST_ASIO_CHECK(called); } void promise_slot_tester() { using namespace boost::asio; using namespace std::chrono; io_context ctx; steady_timer timer1{ctx}, timer2{ctx}; const auto started_when = steady_clock::now(); timer1.expires_at(started_when + milliseconds(2500)); timer2.expires_at(started_when + milliseconds(1000)); auto p = timer1.async_wait(experimental::use_promise); steady_clock::time_point completed_when; boost::system::error_code ec; bool called = false; boost::asio::cancellation_signal sig; p(boost::asio::bind_cancellation_slot( sig.slot(), [&](boost::system::error_code ec_) { ec = ec_; called = true; completed_when = steady_clock::now(); })); steady_clock::time_point timer2_done; timer2.async_wait( [&](boost::system::error_code) { timer2_done = steady_clock::now(); sig.emit(boost::asio::cancellation_type::all); }); ctx.run(); static_assert( boost::asio::is_async_operation<decltype(p)>::value, "promise is async_op"); BOOST_ASIO_CHECK(timer2_done + milliseconds(1) > started_when); BOOST_ASIO_CHECK(completed_when > timer2_done); BOOST_ASIO_CHECK(called); BOOST_ASIO_CHECK(ec == error::operation_aborted); } void early_completion() { using namespace boost::asio; using namespace std::chrono; io_context ctx; auto p = boost::asio::post(ctx, boost::asio::experimental::use_promise); ctx.run(); BOOST_ASIO_CHECK(p.completed()); bool completed = false; p([&]{completed = true;}); BOOST_ASIO_CHECK(!completed); ctx.restart(); ctx.run(); BOOST_ASIO_CHECK(completed); } struct test_cancel_impl_op { boost::asio::steady_timer & tim; boost::system::error_code &ec; template<typename Self> void operator()(Self& self) { tim.async_wait(std::forward<Self>(self)); } template<typename Self> void operator()(Self& self, boost::system::error_code ec_) { ec = ec_; self.complete(ec_); } }; template <typename CompletionToken> BOOST_ASIO_INITFN_AUTO_RESULT_TYPE( CompletionToken, void(boost::system::error_code)) test_cancel_impl(boost::asio::steady_timer & tim, boost::system::error_code &ec, CompletionToken&& token) { return boost::asio::async_compose<CompletionToken, void(boost::system::error_code)>( test_cancel_impl_op{tim, ec}, token, tim); } void test_cancel() { boost::asio::io_context ctx; boost::asio::steady_timer tim{ctx, std::chrono::seconds(10)}; boost::system::error_code ec; { auto p = test_cancel_impl( tim, ec, boost::asio::experimental::use_promise); } ctx.run(); BOOST_ASIO_CHECK_MESSAGE( ec == boost::asio::error::operation_aborted, ec.message()); } } // namespace promise BOOST_ASIO_TEST_SUITE ( "promise", BOOST_ASIO_TEST_CASE(promise::promise_tester) BOOST_ASIO_TEST_CASE(promise::promise_slot_tester) BOOST_ASIO_TEST_CASE(promise::early_completion) BOOST_ASIO_TEST_CASE(promise::test_cancel) )
cpp
asio
data/projects/asio/test/experimental/awaitable_operators.cpp
// // experimental/awaitable_operators.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Prevent link dependency on the Boost.System library. #if !defined(BOOST_SYSTEM_NO_DEPRECATED) #define BOOST_SYSTEM_NO_DEPRECATED #endif // !defined(BOOST_SYSTEM_NO_DEPRECATED) // Test that header file is self-contained. #include <boost/asio/experimental/awaitable_operators.hpp> #include <boost/asio/co_spawn.hpp> #include <boost/asio/detached.hpp> #include <boost/asio/io_context.hpp> #include <boost/asio/post.hpp> #include "../unit_test.hpp" using boost::asio::awaitable; using namespace boost::asio::experimental::awaitable_operators; struct move_only { move_only(int i) : value(i) {} move_only(const move_only&) = delete; move_only(move_only&&) {} move_only& operator=(const move_only&) = delete; move_only& operator=(move_only&&) { return *this; } int value; }; awaitable<void> void_ok() { co_return; } awaitable<void> void_ex() { throw std::runtime_error("exception"); co_return; } awaitable<void> void_post_loop() { for (;;) co_await boost::asio::post(boost::asio::use_awaitable); } awaitable<int> int_0() { co_return 0; } awaitable<int> int_1() { co_return 1; } awaitable<int> int_2() { co_return 2; } awaitable<int> int_ex() { throw std::runtime_error("exception"); co_return -1; } awaitable<move_only> move_only_0() { co_return move_only(0); } awaitable<move_only> move_only_1() { co_return move_only(1); } awaitable<move_only> move_only_2() { co_return move_only(2); } awaitable<move_only> move_only_ex() { throw std::runtime_error("exception"); co_return move_only(-1); } awaitable<void> do_test_and_awaitable_operator() { int i; std::tuple<int, int> ii; std::tuple<int, int, int> iii; co_await (void_ok() && void_ok()); co_await (void_ok() && void_ok() && void_ok()); try { co_await (void_ex() && void_ok()); } catch (...) {} try { co_await (void_ex() && void_ok() && void_ok()); } catch (...) {} try { co_await (void_ex() && void_post_loop()); } catch (...) {} try { co_await (void_ex() && void_ok() && void_post_loop()); } catch (...) {} i = co_await (void_ok() && int_0()); BOOST_ASIO_CHECK(i == 0); i = co_await (void_ok() && int_1()); BOOST_ASIO_CHECK(i == 1); i = co_await (int_0() && void_ok()); BOOST_ASIO_CHECK(i == 0); ii = co_await (int_0() && int_1()); BOOST_ASIO_CHECK(std::get<0>(ii) == 0); BOOST_ASIO_CHECK(std::get<1>(ii) == 1); i = co_await (void_ok() && void_ok() && int_0()); BOOST_ASIO_CHECK(i == 0); i = co_await (void_ok() && int_0() && void_ok()); BOOST_ASIO_CHECK(i == 0); ii = co_await (void_ok() && int_0() && int_1()); BOOST_ASIO_CHECK(std::get<0>(ii) == 0); BOOST_ASIO_CHECK(std::get<1>(ii) == 1); ii = co_await (int_0() && void_ok() && int_1()); BOOST_ASIO_CHECK(std::get<0>(ii) == 0); BOOST_ASIO_CHECK(std::get<1>(ii) == 1); iii = co_await (int_0() && int_1() && int_2()); BOOST_ASIO_CHECK(std::get<0>(iii) == 0); BOOST_ASIO_CHECK(std::get<1>(iii) == 1); BOOST_ASIO_CHECK(std::get<2>(iii) == 2); } void test_and_awaitable_operator() { boost::asio::io_context ctx; co_spawn(ctx, do_test_and_awaitable_operator(), boost::asio::detached); ctx.run(); } awaitable<void> do_test_or_awaitable_operator() { std::variant<int, int> ii; std::variant<int, std::monostate> iv; std::variant<std::monostate, int> vi; std::variant<std::monostate, std::monostate> vv; std::variant<int, int, int> iii; std::variant<int, int, std::monostate> iiv; std::variant<int, std::monostate, int> ivi; std::variant<int, std::monostate, std::monostate> ivv; std::variant<std::monostate, int, int> vii; std::variant<std::monostate, int, std::monostate> viv; std::variant<std::monostate, std::monostate, int> vvi; std::variant<std::monostate, std::monostate, std::monostate> vvv; vv = co_await (void_ok() || void_ok()); BOOST_ASIO_CHECK(vv.index() == 0); vv = co_await (void_ex() || void_ok()); BOOST_ASIO_CHECK(vv.index() == 1); vi = co_await (void_ok() || int_0()); BOOST_ASIO_CHECK(vi.index() == 0); vi = co_await (void_ex() || int_0()); BOOST_ASIO_CHECK(vi.index() == 1); iv = co_await (int_0() || void_ex()); BOOST_ASIO_CHECK(iv.index() == 0); BOOST_ASIO_CHECK(std::get<0>(iv) == 0); ii = co_await (int_0() || int_1()); BOOST_ASIO_CHECK(ii.index() == 0); BOOST_ASIO_CHECK(std::get<0>(ii) == 0); ii = co_await (int_ex() || int_1()); BOOST_ASIO_CHECK(ii.index() == 1); BOOST_ASIO_CHECK(std::get<1>(ii) == 1); vvv = co_await (void_ok() || void_ok() || void_ok()); BOOST_ASIO_CHECK(vvv.index() == 0); vvv = co_await (void_ex() || void_ok() || void_ok()); BOOST_ASIO_CHECK(vvv.index() == 1); vvv = co_await (void_ex() || void_ex() || void_ok()); BOOST_ASIO_CHECK(vvv.index() == 2); vvi = co_await (void_ok() || void_ok() || int_0()); BOOST_ASIO_CHECK(vvi.index() == 0); viv = co_await (void_ok() || int_0() || void_ok()); BOOST_ASIO_CHECK(viv.index() == 0); viv = co_await (void_ex() || int_0() || void_ok()); BOOST_ASIO_CHECK(viv.index() == 1); BOOST_ASIO_CHECK(std::get<1>(viv) == 0); vii = co_await (void_ex() || int_0() || int_1()); BOOST_ASIO_CHECK(vii.index() == 1); BOOST_ASIO_CHECK(std::get<1>(vii) == 0); ivv = co_await (int_0() || void_ok() || void_ok()); BOOST_ASIO_CHECK(ivv.index() == 0); BOOST_ASIO_CHECK(std::get<0>(ivv) == 0); ivv = co_await (int_ex() || void_ok() || void_ok()); BOOST_ASIO_CHECK(ivv.index() == 1); ivi = co_await (int_0() || void_ok() || int_1()); BOOST_ASIO_CHECK(ivi.index() == 0); BOOST_ASIO_CHECK(std::get<0>(ivi) == 0); ivi = co_await (int_ex() || void_ok() || int_1()); BOOST_ASIO_CHECK(ivi.index() == 1); iiv = co_await (int_0() || int_1() || void_ok()); BOOST_ASIO_CHECK(iiv.index() == 0); BOOST_ASIO_CHECK(std::get<0>(iiv) == 0); iiv = co_await (int_ex() || int_1() || void_ok()); BOOST_ASIO_CHECK(iiv.index() == 1); BOOST_ASIO_CHECK(std::get<0>(iiv) == 1); iiv = co_await (int_ex() || int_ex() || void_ok()); BOOST_ASIO_CHECK(iiv.index() == 2); iii = co_await (int_0() || int_1() || int_2()); BOOST_ASIO_CHECK(iii.index() == 0); BOOST_ASIO_CHECK(std::get<0>(iii) == 0); iii = co_await (int_ex() || int_1() || int_2()); BOOST_ASIO_CHECK(iii.index() == 1); BOOST_ASIO_CHECK(std::get<1>(iii) == 1); iii = co_await (int_ex() || int_ex() || int_2()); BOOST_ASIO_CHECK(iii.index() == 2); BOOST_ASIO_CHECK(std::get<2>(iii) == 2); std::variant<move_only, int> mi = co_await (move_only_0() || int_1()); BOOST_ASIO_CHECK(mi.index() == 0); BOOST_ASIO_CHECK(std::get<0>(mi).value == 0); mi = co_await (move_only_ex() || int_1()); BOOST_ASIO_CHECK(mi.index() == 1); BOOST_ASIO_CHECK(std::get<1>(mi) == 1); std::variant<move_only, move_only> mm = co_await (move_only_0() || move_only_1()); BOOST_ASIO_CHECK(mm.index() == 0); BOOST_ASIO_CHECK(std::get<0>(mm).value == 0); mm = co_await (move_only_ex() || move_only_1()); BOOST_ASIO_CHECK(mm.index() == 1); BOOST_ASIO_CHECK(std::get<1>(mm).value == 1); std::variant<move_only, move_only, move_only> mmm = co_await (move_only_0() || move_only_1() || move_only_2()); BOOST_ASIO_CHECK(mmm.index() == 0); BOOST_ASIO_CHECK(std::get<0>(mmm).value == 0); mmm = co_await (move_only_ex() || move_only_1() || move_only_2()); BOOST_ASIO_CHECK(mmm.index() == 1); BOOST_ASIO_CHECK(std::get<1>(mmm).value == 1); mmm = co_await (move_only_ex() || move_only_ex() || move_only_2()); BOOST_ASIO_CHECK(mmm.index() == 2); BOOST_ASIO_CHECK(std::get<2>(mmm).value == 2); } void test_or_awaitable_operator() { boost::asio::io_context ctx; co_spawn(ctx, do_test_or_awaitable_operator(), boost::asio::detached); ctx.run(); } BOOST_ASIO_TEST_SUITE ( "experimental/awaitable_operators", BOOST_ASIO_TEST_CASE(test_and_awaitable_operator) BOOST_ASIO_TEST_CASE(test_or_awaitable_operator) )
cpp
asio
data/projects/asio/test/experimental/co_composed.cpp
// // experimental/co_composed.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Prevent link dependency on the Boost.System library. #if !defined(BOOST_SYSTEM_NO_DEPRECATED) #define BOOST_SYSTEM_NO_DEPRECATED #endif // !defined(BOOST_SYSTEM_NO_DEPRECATED) // Test that header file is self-contained. #include <boost/asio/experimental/co_composed.hpp> #include <boost/asio/bind_cancellation_slot.hpp> #include <boost/asio/deferred.hpp> #include <boost/asio/detached.hpp> #include <boost/asio/io_context.hpp> #include <boost/asio/post.hpp> #include "../unit_test.hpp" template <typename CompletionToken> auto async_throw(CompletionToken&& token) { return boost::asio::async_initiate<CompletionToken, void()>( [](auto) { throw 42; }, token); } template <typename CompletionToken> auto throw_first(CompletionToken&& token) { return boost::asio::async_initiate<CompletionToken, void()>( boost::asio::experimental::co_composed( [](auto state) -> void { throw 42; co_yield state.complete(); }), token); } void test_throw_first() { try { throw_first(boost::asio::detached); BOOST_ASIO_CHECK(0); } catch (int) { } } template <typename CompletionToken> auto throw_after_await(boost::asio::io_context& ctx, CompletionToken&& token) { return boost::asio::async_initiate<CompletionToken, void()>( boost::asio::experimental::co_composed( [](auto state, boost::asio::io_context& ctx) -> void { co_await boost::asio::post(ctx, boost::asio::deferred); throw 42; co_yield state.complete(); }), token, std::ref(ctx)); } void test_throw_after_await() { try { boost::asio::io_context ctx(1); throw_after_await(ctx, boost::asio::detached); ctx.run(); BOOST_ASIO_CHECK(0); } catch (int) { } } template <typename CompletionToken> auto throw_in_first_suspend(CompletionToken&& token) { return boost::asio::async_initiate<CompletionToken, void()>( boost::asio::experimental::co_composed( [](auto state) -> void { co_await async_throw(boost::asio::deferred); co_yield state.complete(); }), token); } void test_throw_in_first_suspend() { try { throw_in_first_suspend(boost::asio::detached); BOOST_ASIO_CHECK(0); } catch (int) { } } template <typename CompletionToken> auto throw_in_suspend_after_await( boost::asio::io_context& ctx, CompletionToken&& token) { return boost::asio::async_initiate<CompletionToken, void()>( boost::asio::experimental::co_composed( [](auto state, boost::asio::io_context& ctx) -> void { co_await boost::asio::post(ctx, boost::asio::deferred); co_await async_throw(boost::asio::deferred); co_yield state.complete(); }), token, std::ref(ctx)); } void test_throw_in_suspend_after_await() { try { boost::asio::io_context ctx(1); throw_in_suspend_after_await(ctx, boost::asio::detached); ctx.run(); BOOST_ASIO_CHECK(0); } catch (int) { } } template <typename CompletionToken> auto post_loop(boost::asio::io_context& ctx, CompletionToken&& token) { return boost::asio::async_initiate<CompletionToken, void(int)>( boost::asio::experimental::co_composed( [](auto state, boost::asio::io_context& ctx) -> void { int i = 0; for (; i < 100; ++i) co_await boost::asio::post(ctx, boost::asio::deferred); co_yield state.complete(i); }, ctx), token, std::ref(ctx)); } void test_post_loop() { boost::asio::io_context ctx(1); int count = 0; post_loop(ctx, [&](int i){ count = i; }); ctx.run(); BOOST_ASIO_CHECK(count == 100); } template <typename CompletionToken> auto nested_post(boost::asio::io_context& ctx, CompletionToken&& token) { return boost::asio::async_initiate<CompletionToken, void()>( boost::asio::experimental::co_composed( [](auto state, boost::asio::io_context& ctx) -> void { co_await boost::asio::post(ctx, boost::asio::deferred); co_yield state.complete(); }, ctx), token, std::ref(ctx)); } template <typename CompletionToken> auto nested_post_loop(boost::asio::io_context& ctx, CompletionToken&& token) { return boost::asio::async_initiate<CompletionToken, void(int)>( boost::asio::experimental::co_composed( [](auto state, boost::asio::io_context& ctx) -> void { int i = 0; for (; i < 100; ++i) co_await nested_post(ctx, boost::asio::deferred); co_yield state.complete(i); }, ctx), token, std::ref(ctx)); } void test_nested_post_loop() { boost::asio::io_context ctx(1); int count = 0; nested_post_loop(ctx, [&](int i){ count = i; }); ctx.run(); BOOST_ASIO_CHECK(count == 100); } template <typename CompletionToken> auto post_loop_return_1_0(boost::asio::io_context& ctx, CompletionToken&& token) { return boost::asio::async_initiate<CompletionToken, void()>( boost::asio::experimental::co_composed<void()>( [](auto, boost::asio::io_context& ctx) -> void { int i = 0; for (; i < 100; ++i) co_await boost::asio::post(ctx, boost::asio::deferred); co_return {}; }, ctx), token, std::ref(ctx)); } void test_post_loop_return_1_0() { boost::asio::io_context ctx(1); bool done = false; post_loop_return_1_0(ctx, [&]{ done = true; }); ctx.run(); BOOST_ASIO_CHECK(done); } template <typename CompletionToken> auto post_loop_return_1_1(boost::asio::io_context& ctx, CompletionToken&& token) { return boost::asio::async_initiate<CompletionToken, void(int)>( boost::asio::experimental::co_composed<void(int)>( [](auto, boost::asio::io_context& ctx) -> void { int i = 0; for (; i < 100; ++i) co_await boost::asio::post(ctx, boost::asio::deferred); co_return {i}; }, ctx), token, std::ref(ctx)); } void test_post_loop_return_1_1() { boost::asio::io_context ctx(1); int count = 0; post_loop_return_1_1(ctx, [&](int i){ count = i; }); ctx.run(); BOOST_ASIO_CHECK(count == 100); } template <typename CompletionToken> auto post_loop_return_1_2(boost::asio::io_context& ctx, CompletionToken&& token) { return boost::asio::async_initiate<CompletionToken, void(int, char)>( boost::asio::experimental::co_composed<void(int, char)>( [](auto, boost::asio::io_context& ctx) -> void { int i = 0; for (; i < 100; ++i) co_await boost::asio::post(ctx, boost::asio::deferred); co_return {i, 'A'}; }, ctx), token, std::ref(ctx)); } void test_post_loop_return_1_2() { boost::asio::io_context ctx(1); int count = 0; char ch = 0; post_loop_return_1_2(ctx, [&](int i, char c){ count = i, ch = c; }); ctx.run(); BOOST_ASIO_CHECK(count == 100); BOOST_ASIO_CHECK(ch == 'A'); } template <typename CompletionToken> auto post_loop_return_2(boost::asio::io_context& ctx, CompletionToken&& token) { return boost::asio::async_initiate<CompletionToken, void(), void(int)>( boost::asio::experimental::co_composed<void(), void(int)>( [](auto, boost::asio::io_context& ctx) -> void { int i = 0; for (; i < 100; ++i) co_await boost::asio::post(ctx, boost::asio::deferred); co_return {i}; }, ctx), token, std::ref(ctx)); } void test_post_loop_return_2() { boost::asio::io_context ctx(1); int count = 0; post_loop_return_2(ctx, [&](int i = 0){ count = i; }); ctx.run(); BOOST_ASIO_CHECK(count == 100); } template <typename CompletionToken> auto complete_on_cancel(boost::asio::io_context& ctx, CompletionToken&& token) { return boost::asio::async_initiate< CompletionToken, void(boost::system::error_code, int)>( boost::asio::experimental::co_composed< void(boost::system::error_code, int)>( [](auto state, boost::asio::io_context& ctx) -> void { state.on_cancellation_complete_with( boost::asio::error::invalid_argument, 42); int i = 0; for (; i < 100; ++i) co_await boost::asio::post(ctx, boost::asio::deferred); co_return {boost::asio::error::eof, i}; }, ctx), token, std::ref(ctx)); } void test_complete_on_cancel() { boost::asio::io_context ctx(1); int count = 0; boost::system::error_code ec; boost::asio::cancellation_signal cancel; complete_on_cancel(ctx, [&](boost::system::error_code e, int i) { ec = e; count = i; }); ctx.run(); BOOST_ASIO_CHECK(ec == boost::asio::error::eof); BOOST_ASIO_CHECK(count == 100); complete_on_cancel(ctx, boost::asio::bind_cancellation_slot(cancel.slot(), [&](boost::system::error_code e, int i) { ec = e; count = i; })); ctx.restart(); ctx.run_one(); cancel.emit(boost::asio::cancellation_type::all); ctx.run(); BOOST_ASIO_CHECK(ec == boost::asio::error::invalid_argument); BOOST_ASIO_CHECK(count == 42); complete_on_cancel(ctx, boost::asio::bind_cancellation_slot(cancel.slot(), [&](boost::system::error_code e, int i) { ec = e; count = i; })); ctx.restart(); ctx.run(); BOOST_ASIO_CHECK(ec == boost::asio::error::eof); BOOST_ASIO_CHECK(count == 100); } template <typename CompletionToken> auto complete_with_default_on_cancel( boost::asio::io_context& ctx, CompletionToken&& token) { return boost::asio::async_initiate< CompletionToken, void(boost::system::error_code, int)>( boost::asio::experimental::co_composed< void(boost::system::error_code, int)>( [](auto, boost::asio::io_context& ctx) -> void { int i = 0; for (; i < 100; ++i) co_await boost::asio::post(ctx, boost::asio::deferred); co_return {boost::asio::error::eof, i}; }, ctx), token, std::ref(ctx)); } void test_complete_with_default_on_cancel() { boost::asio::io_context ctx(1); int count = 0; boost::system::error_code ec; boost::asio::cancellation_signal cancel; complete_with_default_on_cancel(ctx, [&](boost::system::error_code e, int i) { ec = e; count = i; }); ctx.run(); BOOST_ASIO_CHECK(ec == boost::asio::error::eof); BOOST_ASIO_CHECK(count == 100); complete_with_default_on_cancel(ctx, boost::asio::bind_cancellation_slot(cancel.slot(), [&](boost::system::error_code e, int i) { ec = e; count = i; })); ctx.restart(); ctx.run_one(); cancel.emit(boost::asio::cancellation_type::all); ctx.run(); BOOST_ASIO_CHECK(ec == boost::asio::error::operation_aborted); BOOST_ASIO_CHECK(count == 0); complete_with_default_on_cancel(ctx, boost::asio::bind_cancellation_slot(cancel.slot(), [&](boost::system::error_code e, int i) { ec = e; count = i; })); ctx.restart(); ctx.run(); BOOST_ASIO_CHECK(ec == boost::asio::error::eof); BOOST_ASIO_CHECK(count == 100); } template <typename CompletionToken> auto throw_on_cancel(boost::asio::io_context& ctx, CompletionToken&& token) { return boost::asio::async_initiate< CompletionToken, void(boost::system::error_code, int)>( boost::asio::experimental::co_composed< void(boost::system::error_code, int)>( [](auto state, boost::asio::io_context& ctx) -> void { try { state.throw_if_cancelled(true); int i = 0; for (; i < 100; ++i) co_await boost::asio::post(ctx, boost::asio::deferred); co_return {boost::asio::error::eof, i}; } catch (...) { co_return {boost::asio::error::invalid_argument, 42}; } }, ctx), token, std::ref(ctx)); } void test_throw_on_cancel() { boost::asio::io_context ctx(1); int count = 0; boost::system::error_code ec; boost::asio::cancellation_signal cancel; throw_on_cancel(ctx, [&](boost::system::error_code e, int i) { ec = e; count = i; }); ctx.run(); BOOST_ASIO_CHECK(ec == boost::asio::error::eof); BOOST_ASIO_CHECK(count == 100); throw_on_cancel(ctx, boost::asio::bind_cancellation_slot(cancel.slot(), [&](boost::system::error_code e, int i) { ec = e; count = i; })); ctx.restart(); ctx.run_one(); cancel.emit(boost::asio::cancellation_type::all); ctx.run(); BOOST_ASIO_CHECK(ec == boost::asio::error::invalid_argument); BOOST_ASIO_CHECK(count == 42); throw_on_cancel(ctx, boost::asio::bind_cancellation_slot(cancel.slot(), [&](boost::system::error_code e, int i) { ec = e; count = i; })); ctx.restart(); ctx.run(); BOOST_ASIO_CHECK(ec == boost::asio::error::eof); BOOST_ASIO_CHECK(count == 100); } BOOST_ASIO_TEST_SUITE ( "experimental/co_composed", BOOST_ASIO_TEST_CASE(test_throw_first) BOOST_ASIO_TEST_CASE(test_throw_after_await) BOOST_ASIO_TEST_CASE(test_throw_in_first_suspend) BOOST_ASIO_TEST_CASE(test_throw_in_suspend_after_await) BOOST_ASIO_TEST_CASE(test_post_loop) BOOST_ASIO_TEST_CASE(test_nested_post_loop) BOOST_ASIO_TEST_CASE(test_post_loop_return_1_0) BOOST_ASIO_TEST_CASE(test_post_loop_return_1_1) BOOST_ASIO_TEST_CASE(test_post_loop_return_1_2) BOOST_ASIO_TEST_CASE(test_post_loop_return_2) BOOST_ASIO_TEST_CASE(test_complete_on_cancel) BOOST_ASIO_TEST_CASE(test_complete_with_default_on_cancel) BOOST_ASIO_TEST_CASE(test_throw_on_cancel) )
cpp
asio
data/projects/asio/test/experimental/parallel_group.cpp
// // experimental/parallel_group.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/experimental/parallel_group.hpp> #include "../unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "experimental/parallel_group", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/experimental/channel_traits.cpp
// // experimental/channel_traits.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/experimental/channel_traits.hpp> #include "../unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "experimental/channel_traits", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/experimental/basic_concurrent_channel.cpp
// // experimental/basic_concurrent_channel.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/experimental/basic_concurrent_channel.hpp> #include "../unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "experimental/basic_concurrent_channel", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/experimental/channel.cpp
// // experimental/channel.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/experimental/channel.hpp> #include <utility> #include <boost/asio/any_completion_handler.hpp> #include <boost/asio/bind_executor.hpp> #include <boost/asio/bind_immediate_executor.hpp> #include <boost/asio/error.hpp> #include <boost/asio/io_context.hpp> #include <boost/asio/system_executor.hpp> #include "../unit_test.hpp" using namespace boost::asio; using namespace boost::asio::experimental; void unbuffered_channel_test() { io_context ctx; channel<void(boost::system::error_code, std::string)> ch1(ctx); BOOST_ASIO_CHECK(ch1.is_open()); BOOST_ASIO_CHECK(!ch1.ready()); bool b1 = ch1.try_send(boost::asio::error::eof, "hello"); BOOST_ASIO_CHECK(!b1); std::string s1 = "abcdefghijklmnopqrstuvwxyz"; bool b2 = ch1.try_send(boost::asio::error::eof, std::move(s1)); BOOST_ASIO_CHECK(!b2); BOOST_ASIO_CHECK(!s1.empty()); boost::system::error_code ec1; std::string s2; ch1.async_receive( [&](boost::system::error_code ec, std::string s) { ec1 = ec; s2 = std::move(s); }); bool b3 = ch1.try_send(boost::asio::error::eof, std::move(s1)); BOOST_ASIO_CHECK(b3); BOOST_ASIO_CHECK(s1.empty()); ctx.run(); BOOST_ASIO_CHECK(ec1 == boost::asio::error::eof); BOOST_ASIO_CHECK(s2 == "abcdefghijklmnopqrstuvwxyz"); bool b4 = ch1.try_receive([](boost::system::error_code, std::string){}); BOOST_ASIO_CHECK(!b4); boost::system::error_code ec2 = boost::asio::error::would_block; std::string s3 = "zyxwvutsrqponmlkjihgfedcba"; ch1.async_send(boost::asio::error::eof, std::move(s3), [&](boost::system::error_code ec) { ec2 = ec; }); boost::system::error_code ec3; std::string s4; bool b5 = ch1.try_receive( [&](boost::system::error_code ec, std::string s) { ec3 = ec; s4 = s; }); BOOST_ASIO_CHECK(b5); BOOST_ASIO_CHECK(ec3 == boost::asio::error::eof); BOOST_ASIO_CHECK(s4 == "zyxwvutsrqponmlkjihgfedcba"); ctx.restart(); ctx.run(); BOOST_ASIO_CHECK(!ec2); } void buffered_channel_test() { io_context ctx; channel<void(boost::system::error_code, std::string)> ch1(ctx, 1); BOOST_ASIO_CHECK(ch1.is_open()); BOOST_ASIO_CHECK(!ch1.ready()); bool b1 = ch1.try_send(boost::asio::error::eof, "hello"); BOOST_ASIO_CHECK(b1); std::string s1 = "abcdefghijklmnopqrstuvwxyz"; bool b2 = ch1.try_send(boost::asio::error::eof, std::move(s1)); BOOST_ASIO_CHECK(!b2); BOOST_ASIO_CHECK(!s1.empty()); boost::system::error_code ec1; std::string s2; ch1.async_receive( [&](boost::system::error_code ec, std::string s) { ec1 = ec; s2 = std::move(s); }); ctx.run(); BOOST_ASIO_CHECK(ec1 == boost::asio::error::eof); BOOST_ASIO_CHECK(s2 == "hello"); bool b4 = ch1.try_receive([](boost::system::error_code, std::string){}); BOOST_ASIO_CHECK(!b4); boost::system::error_code ec2 = boost::asio::error::would_block; std::string s3 = "zyxwvutsrqponmlkjihgfedcba"; ch1.async_send(boost::asio::error::eof, std::move(s3), [&](boost::system::error_code ec) { ec2 = ec; }); boost::system::error_code ec3; std::string s4; bool b5 = ch1.try_receive( [&](boost::system::error_code ec, std::string s) { ec3 = ec; s4 = s; }); BOOST_ASIO_CHECK(b5); BOOST_ASIO_CHECK(ec3 == boost::asio::error::eof); BOOST_ASIO_CHECK(s4 == "zyxwvutsrqponmlkjihgfedcba"); ctx.restart(); ctx.run(); BOOST_ASIO_CHECK(!ec2); bool b6 = ch1.try_send(boost::system::error_code(), "goodbye"); BOOST_ASIO_CHECK(b6); ch1.close(); boost::system::error_code ec4; std::string s5; ch1.async_receive( [&](boost::system::error_code ec, std::string s) { ec4 = ec; s5 = std::move(s); }); ctx.restart(); ctx.run(); BOOST_ASIO_CHECK(!ec4); BOOST_ASIO_CHECK(s5 == "goodbye"); boost::system::error_code ec5; std::string s6; ch1.async_receive( [&](boost::system::error_code ec, std::string s) { ec5 = ec; s6 = std::move(s); }); ctx.restart(); ctx.run(); BOOST_ASIO_CHECK(ec5 == boost::asio::experimental::channel_errc::channel_closed); BOOST_ASIO_CHECK(s6.empty()); } void buffered_error_channel_test() { io_context ctx; channel<void(boost::system::error_code)> ch1(ctx, 1); BOOST_ASIO_CHECK(ch1.is_open()); BOOST_ASIO_CHECK(!ch1.ready()); bool b1 = ch1.try_send(boost::asio::error::eof); BOOST_ASIO_CHECK(b1); bool b2 = ch1.try_send(boost::asio::error::eof); BOOST_ASIO_CHECK(!b2); boost::system::error_code ec1; ch1.async_receive( [&](boost::system::error_code ec) { ec1 = ec; }); ctx.run(); BOOST_ASIO_CHECK(ec1 == boost::asio::error::eof); bool b4 = ch1.try_receive([](boost::system::error_code){}); BOOST_ASIO_CHECK(!b4); boost::system::error_code ec2 = boost::asio::error::would_block; ch1.async_send(boost::asio::error::eof, [&](boost::system::error_code ec) { ec2 = ec; }); boost::system::error_code ec3; bool b5 = ch1.try_receive( [&](boost::system::error_code ec) { ec3 = ec; }); BOOST_ASIO_CHECK(b5); BOOST_ASIO_CHECK(ec3 == boost::asio::error::eof); ctx.restart(); ctx.run(); BOOST_ASIO_CHECK(!ec2); } void unbuffered_non_immediate_receive() { io_context ctx; channel<void(boost::system::error_code, std::string)> ch1(ctx); boost::system::error_code ec1 = boost::asio::error::would_block; std::string s1 = "0123456789"; ch1.async_send(boost::asio::error::eof, std::move(s1), [&](boost::system::error_code ec) { ec1 = ec; }); BOOST_ASIO_CHECK(ec1 == boost::asio::error::would_block); boost::system::error_code ec2 = boost::asio::error::would_block; std::string s2; ch1.async_receive( [&](boost::system::error_code ec, std::string s) { ec2 = ec; s2 = std::move(s); }); BOOST_ASIO_CHECK(ec2 == boost::asio::error::would_block); ctx.run(); BOOST_ASIO_CHECK(!ec1); BOOST_ASIO_CHECK(ec2 == boost::asio::error::eof); BOOST_ASIO_CHECK(s2 == "0123456789"); } void unbuffered_immediate_receive() { io_context ctx; channel<void(boost::system::error_code, std::string)> ch1(ctx); boost::system::error_code ec1 = boost::asio::error::would_block; std::string s1 = "0123456789"; ch1.async_send(boost::asio::error::eof, std::move(s1), [&](boost::system::error_code ec) { ec1 = ec; }); BOOST_ASIO_CHECK(ec1 == boost::asio::error::would_block); boost::system::error_code ec2 = boost::asio::error::would_block; std::string s2; ch1.async_receive( bind_immediate_executor(system_executor(), [&](boost::system::error_code ec, std::string s) { ec2 = ec; s2 = std::move(s); })); BOOST_ASIO_CHECK(ec1 == boost::asio::error::would_block); BOOST_ASIO_CHECK(ec2 == boost::asio::error::eof); BOOST_ASIO_CHECK(s2 == "0123456789"); ctx.run(); BOOST_ASIO_CHECK(!ec1); } void unbuffered_executor_receive() { io_context ctx; io_context ctx2; channel<void(boost::system::error_code, std::string)> ch1(ctx); boost::system::error_code ec1 = boost::asio::error::would_block; std::string s1 = "0123456789"; ch1.async_send(boost::asio::error::eof, std::move(s1), [&](boost::system::error_code ec) { ec1 = ec; }); BOOST_ASIO_CHECK(ec1 == boost::asio::error::would_block); boost::system::error_code ec2 = boost::asio::error::would_block; std::string s2; ch1.async_receive( bind_executor(ctx2, [&](boost::system::error_code ec, std::string s) { ec2 = ec; s2 = std::move(s); })); BOOST_ASIO_CHECK(ec1 == boost::asio::error::would_block); BOOST_ASIO_CHECK(ec2 == boost::asio::error::would_block); ctx.run(); BOOST_ASIO_CHECK(!ec1); BOOST_ASIO_CHECK(ec2 == boost::asio::error::would_block); ctx2.run(); BOOST_ASIO_CHECK(ec2 == boost::asio::error::eof); BOOST_ASIO_CHECK(s2 == "0123456789"); } void unbuffered_non_immediate_send() { io_context ctx; channel<void(boost::system::error_code, std::string)> ch1(ctx); boost::system::error_code ec1 = boost::asio::error::would_block; std::string s1; ch1.async_receive( [&](boost::system::error_code ec, std::string s) { ec1 = ec; s1 = std::move(s); }); BOOST_ASIO_CHECK(ec1 == boost::asio::error::would_block); boost::system::error_code ec2 = boost::asio::error::would_block; std::string s2 = "0123456789"; ch1.async_send(boost::asio::error::eof, std::move(s2), [&](boost::system::error_code ec) { ec2 = ec; }); BOOST_ASIO_CHECK(ec2 == boost::asio::error::would_block); ctx.run(); BOOST_ASIO_CHECK(ec1 == boost::asio::error::eof); BOOST_ASIO_CHECK(s1 == "0123456789"); BOOST_ASIO_CHECK(!ec2); } void unbuffered_immediate_send() { io_context ctx; channel<void(boost::system::error_code, std::string)> ch1(ctx); boost::system::error_code ec1 = boost::asio::error::would_block; std::string s1; ch1.async_receive( [&](boost::system::error_code ec, std::string s) { ec1 = ec; s1 = std::move(s); }); BOOST_ASIO_CHECK(ec1 == boost::asio::error::would_block); boost::system::error_code ec2 = boost::asio::error::would_block; std::string s2 = "0123456789"; ch1.async_send(boost::asio::error::eof, std::move(s2), bind_immediate_executor(system_executor(), [&](boost::system::error_code ec) { ec2 = ec; })); BOOST_ASIO_CHECK(ec1 == boost::asio::error::would_block); BOOST_ASIO_CHECK(!ec2); ctx.run(); BOOST_ASIO_CHECK(ec1 == boost::asio::error::eof); BOOST_ASIO_CHECK(s1 == "0123456789"); } void unbuffered_executor_send() { io_context ctx; io_context ctx2; channel<void(boost::system::error_code, std::string)> ch1(ctx); boost::system::error_code ec1 = boost::asio::error::would_block; std::string s1; ch1.async_receive( [&](boost::system::error_code ec, std::string s) { ec1 = ec; s1 = std::move(s); }); BOOST_ASIO_CHECK(ec1 == boost::asio::error::would_block); boost::system::error_code ec2 = boost::asio::error::would_block; std::string s2 = "0123456789"; ch1.async_send(boost::asio::error::eof, std::move(s2), bind_executor(ctx2, [&](boost::system::error_code ec) { ec2 = ec; })); BOOST_ASIO_CHECK(ec1 == boost::asio::error::would_block); BOOST_ASIO_CHECK(ec2 == boost::asio::error::would_block); ctx.run(); BOOST_ASIO_CHECK(ec1 == boost::asio::error::eof); BOOST_ASIO_CHECK(s1 == "0123456789"); BOOST_ASIO_CHECK(ec2 == boost::asio::error::would_block); ctx2.run(); BOOST_ASIO_CHECK(!ec2); } void buffered_non_immediate_receive() { io_context ctx; channel<void(boost::system::error_code, std::string)> ch1(ctx, 1); boost::system::error_code ec1 = boost::asio::error::would_block; std::string s1 = "0123456789"; ch1.async_send(boost::asio::error::eof, std::move(s1), [&](boost::system::error_code ec) { ec1 = ec; }); BOOST_ASIO_CHECK(ec1 == boost::asio::error::would_block); ctx.run(); BOOST_ASIO_CHECK(!ec1); boost::system::error_code ec2 = boost::asio::error::would_block; std::string s2; ch1.async_receive( [&](boost::system::error_code ec, std::string s) { ec2 = ec; s2 = std::move(s); }); BOOST_ASIO_CHECK(ec2 == boost::asio::error::would_block); ctx.restart(); ctx.run(); BOOST_ASIO_CHECK(ec2 == boost::asio::error::eof); BOOST_ASIO_CHECK(s2 == "0123456789"); } void buffered_immediate_receive() { io_context ctx; channel<void(boost::system::error_code, std::string)> ch1(ctx, 1); boost::system::error_code ec1 = boost::asio::error::would_block; std::string s1 = "0123456789"; ch1.async_send(boost::asio::error::eof, std::move(s1), [&](boost::system::error_code ec) { ec1 = ec; }); BOOST_ASIO_CHECK(ec1 == boost::asio::error::would_block); ctx.run(); BOOST_ASIO_CHECK(!ec1); boost::system::error_code ec2 = boost::asio::error::would_block; std::string s2; ch1.async_receive( bind_immediate_executor(system_executor(), [&](boost::system::error_code ec, std::string s) { ec2 = ec; s2 = std::move(s); })); BOOST_ASIO_CHECK(ec2 == boost::asio::error::eof); BOOST_ASIO_CHECK(s2 == "0123456789"); ctx.restart(); ctx.run(); } void buffered_executor_receive() { io_context ctx; io_context ctx2; channel<void(boost::system::error_code, std::string)> ch1(ctx, 1); boost::system::error_code ec1 = boost::asio::error::would_block; std::string s1 = "0123456789"; ch1.async_send(boost::asio::error::eof, std::move(s1), [&](boost::system::error_code ec) { ec1 = ec; }); BOOST_ASIO_CHECK(ec1 == boost::asio::error::would_block); ctx.run(); BOOST_ASIO_CHECK(!ec1); boost::system::error_code ec2 = boost::asio::error::would_block; std::string s2; ch1.async_receive( bind_executor(ctx2, [&](boost::system::error_code ec, std::string s) { ec2 = ec; s2 = std::move(s); })); BOOST_ASIO_CHECK(ec2 == boost::asio::error::would_block); ctx.restart(); ctx.run(); BOOST_ASIO_CHECK(ec2 == boost::asio::error::would_block); ctx2.run(); BOOST_ASIO_CHECK(ec2 == boost::asio::error::eof); BOOST_ASIO_CHECK(s2 == "0123456789"); } void buffered_non_immediate_send() { io_context ctx; channel<void(boost::system::error_code, std::string)> ch1(ctx, 1); boost::system::error_code ec1 = boost::asio::error::would_block; std::string s1 = "0123456789"; ch1.async_send(boost::asio::error::eof, std::move(s1), [&](boost::system::error_code ec) { ec1 = ec; }); BOOST_ASIO_CHECK(ec1 == boost::asio::error::would_block); ctx.run(); BOOST_ASIO_CHECK(!ec1); } void buffered_immediate_send() { io_context ctx; channel<void(boost::system::error_code, std::string)> ch1(ctx, 1); boost::system::error_code ec1 = boost::asio::error::would_block; std::string s1 = "0123456789"; ch1.async_send(boost::asio::error::eof, std::move(s1), bind_immediate_executor(system_executor(), [&](boost::system::error_code ec) { ec1 = ec; })); BOOST_ASIO_CHECK(!ec1); ctx.run(); } void buffered_executor_send() { io_context ctx; io_context ctx2; channel<void(boost::system::error_code, std::string)> ch1(ctx, 1); boost::system::error_code ec1 = boost::asio::error::would_block; std::string s1 = "0123456789"; ch1.async_send(boost::asio::error::eof, std::move(s1), bind_executor(ctx2, [&](boost::system::error_code ec) { ec1 = ec; })); BOOST_ASIO_CHECK(ec1 == boost::asio::error::would_block); ctx.run(); BOOST_ASIO_CHECK(ec1 == boost::asio::error::would_block); ctx2.run(); BOOST_ASIO_CHECK(!ec1); } void try_send_via_dispatch() { io_context ctx; channel<void(boost::system::error_code, std::string)> ch1(ctx); boost::system::error_code ec1 = boost::asio::error::would_block; std::string s1; ch1.async_receive( bind_executor(boost::asio::system_executor(), [&](boost::system::error_code ec, std::string s) { ec1 = ec; s1 = std::move(s); })); BOOST_ASIO_CHECK(ec1 == boost::asio::error::would_block); ctx.poll(); BOOST_ASIO_CHECK(ec1 == boost::asio::error::would_block); std::string s2 = "0123456789"; ch1.try_send_via_dispatch(boost::asio::error::eof, std::move(s2)); BOOST_ASIO_CHECK(ec1 == boost::asio::error::eof); BOOST_ASIO_CHECK(s1 == "0123456789"); BOOST_ASIO_CHECK(s2.empty()); } void try_send_n_via_dispatch() { io_context ctx; channel<void(boost::system::error_code, std::string)> ch1(ctx); boost::system::error_code ec1 = boost::asio::error::would_block; std::string s1; ch1.async_receive( bind_executor(boost::asio::system_executor(), [&](boost::system::error_code ec, std::string s) { ec1 = ec; s1 = std::move(s); })); BOOST_ASIO_CHECK(ec1 == boost::asio::error::would_block); boost::system::error_code ec2 = boost::asio::error::would_block; std::string s2; ch1.async_receive( bind_executor(boost::asio::system_executor(), [&](boost::system::error_code ec, std::string s) { ec2 = ec; s2 = std::move(s); })); BOOST_ASIO_CHECK(ec1 == boost::asio::error::would_block); ctx.poll(); BOOST_ASIO_CHECK(ec1 == boost::asio::error::would_block); BOOST_ASIO_CHECK(ec2 == boost::asio::error::would_block); std::string s3 = "0123456789"; ch1.try_send_n_via_dispatch(2, boost::asio::error::eof, std::move(s3)); BOOST_ASIO_CHECK(ec1 == boost::asio::error::eof); BOOST_ASIO_CHECK(s1 == "0123456789"); BOOST_ASIO_CHECK(ec2 == boost::asio::error::eof); BOOST_ASIO_CHECK(s2 == "0123456789"); BOOST_ASIO_CHECK(s3.empty()); } struct multi_signature_handler { std::string* s_; boost::system::error_code* ec_; void operator()(std::string s) { *s_ = s; } void operator()(boost::system::error_code ec) { *ec_ = ec; } }; void implicit_error_signature_channel_test() { io_context ctx; channel<void(std::string)> ch1(ctx); BOOST_ASIO_CHECK(ch1.is_open()); BOOST_ASIO_CHECK(!ch1.ready()); bool b1 = ch1.try_send("hello"); BOOST_ASIO_CHECK(!b1); std::string s1 = "abcdefghijklmnopqrstuvwxyz"; bool b2 = ch1.try_send(std::move(s1)); BOOST_ASIO_CHECK(!b2); BOOST_ASIO_CHECK(!s1.empty()); std::string s2; boost::system::error_code ec1 = boost::asio::error::would_block; multi_signature_handler h1 = {&s2, &ec1}; ch1.async_receive(h1); bool b3 = ch1.try_send(std::move(s1)); BOOST_ASIO_CHECK(b3); BOOST_ASIO_CHECK(s1.empty()); ctx.run(); BOOST_ASIO_CHECK(s2 == "abcdefghijklmnopqrstuvwxyz"); BOOST_ASIO_CHECK(ec1 == boost::asio::error::would_block); std::string s3; boost::system::error_code ec2; multi_signature_handler h2 = {&s3, &ec2}; bool b4 = ch1.try_receive(h2); BOOST_ASIO_CHECK(!b4); std::string s4 = "zyxwvutsrqponmlkjihgfedcba"; boost::system::error_code ec3; ch1.async_send(std::move(s4), [&](boost::system::error_code ec) { ec3 = ec; }); std::string s5; boost::system::error_code ec4 = boost::asio::error::would_block; multi_signature_handler h3 = {&s5, &ec4}; bool b5 = ch1.try_receive(h3); BOOST_ASIO_CHECK(b5); BOOST_ASIO_CHECK(ec4 == boost::asio::error::would_block); BOOST_ASIO_CHECK(s5 == "zyxwvutsrqponmlkjihgfedcba"); ctx.restart(); ctx.run(); BOOST_ASIO_CHECK(!ec3); std::string s6; boost::system::error_code ec5 = boost::asio::error::would_block; multi_signature_handler h4 = {&s6, &ec5}; ch1.async_receive(h4); ch1.close(); ctx.restart(); ctx.run(); BOOST_ASIO_CHECK(s6.empty()); BOOST_ASIO_CHECK(ec5 == boost::asio::experimental::channel_errc::channel_closed); } void channel_with_any_completion_handler_test() { io_context ctx; channel<void(boost::system::error_code, std::string)> ch1(ctx); boost::system::error_code ec1 = boost::asio::error::would_block; std::string s1; ch1.async_receive( boost::asio::any_completion_handler< void(boost::system::error_code, std::string)>( [&](boost::system::error_code ec, std::string s) { ec1 = ec; s1 = std::move(s); })); boost::system::error_code ec2 = boost::asio::error::would_block; std::string s2 = "zyxwvutsrqponmlkjihgfedcba"; ch1.async_send(boost::asio::error::eof, std::move(s2), boost::asio::any_completion_handler<void(boost::system::error_code)>( [&](boost::system::error_code ec) { ec2 = ec; })); BOOST_ASIO_CHECK(ec1 == boost::asio::error::would_block); BOOST_ASIO_CHECK(ec2 == boost::asio::error::would_block); ctx.run(); BOOST_ASIO_CHECK(ec1 == boost::asio::error::eof); BOOST_ASIO_CHECK(s1 == "zyxwvutsrqponmlkjihgfedcba"); BOOST_ASIO_CHECK(!ec2); } BOOST_ASIO_TEST_SUITE ( "experimental/channel", BOOST_ASIO_TEST_CASE(unbuffered_channel_test) BOOST_ASIO_TEST_CASE(buffered_channel_test) BOOST_ASIO_TEST_CASE(buffered_error_channel_test) BOOST_ASIO_TEST_CASE(unbuffered_non_immediate_receive) BOOST_ASIO_TEST_CASE(unbuffered_immediate_receive) BOOST_ASIO_TEST_CASE(unbuffered_executor_receive) BOOST_ASIO_TEST_CASE(unbuffered_non_immediate_send) BOOST_ASIO_TEST_CASE(unbuffered_immediate_send) BOOST_ASIO_TEST_CASE(unbuffered_executor_send) BOOST_ASIO_TEST_CASE(buffered_non_immediate_receive) BOOST_ASIO_TEST_CASE(buffered_immediate_receive) BOOST_ASIO_TEST_CASE(buffered_executor_receive) BOOST_ASIO_TEST_CASE(buffered_non_immediate_send) BOOST_ASIO_TEST_CASE(buffered_immediate_send) BOOST_ASIO_TEST_CASE(buffered_executor_send) BOOST_ASIO_TEST_CASE(try_send_via_dispatch) BOOST_ASIO_TEST_CASE(try_send_n_via_dispatch) BOOST_ASIO_TEST_CASE(implicit_error_signature_channel_test) BOOST_ASIO_TEST_CASE(channel_with_any_completion_handler_test) )
cpp
asio
data/projects/asio/test/experimental/concurrent_channel.cpp
// // experimental/concurrent_channel.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/experimental/concurrent_channel.hpp> #include <utility> #include <boost/asio/error.hpp> #include <boost/asio/io_context.hpp> #include "../unit_test.hpp" using namespace boost::asio; using namespace boost::asio::experimental; void unbuffered_concurrent_channel_test() { io_context ctx; concurrent_channel<void(boost::system::error_code, std::string)> ch1(ctx); BOOST_ASIO_CHECK(ch1.is_open()); BOOST_ASIO_CHECK(!ch1.ready()); bool b1 = ch1.try_send(boost::asio::error::eof, "hello"); BOOST_ASIO_CHECK(!b1); std::string s1 = "abcdefghijklmnopqrstuvwxyz"; bool b2 = ch1.try_send(boost::asio::error::eof, std::move(s1)); BOOST_ASIO_CHECK(!b2); BOOST_ASIO_CHECK(!s1.empty()); boost::system::error_code ec1; std::string s2; ch1.async_receive( [&](boost::system::error_code ec, std::string s) { ec1 = ec; s2 = std::move(s); }); bool b3 = ch1.try_send(boost::asio::error::eof, std::move(s1)); BOOST_ASIO_CHECK(b3); BOOST_ASIO_CHECK(s1.empty()); ctx.run(); BOOST_ASIO_CHECK(ec1 == boost::asio::error::eof); BOOST_ASIO_CHECK(s2 == "abcdefghijklmnopqrstuvwxyz"); bool b4 = ch1.try_receive([](boost::system::error_code, std::string){}); BOOST_ASIO_CHECK(!b4); boost::system::error_code ec2 = boost::asio::error::would_block; std::string s3 = "zyxwvutsrqponmlkjihgfedcba"; ch1.async_send(boost::asio::error::eof, std::move(s3), [&](boost::system::error_code ec) { ec2 = ec; }); boost::system::error_code ec3; std::string s4; bool b5 = ch1.try_receive( [&](boost::system::error_code ec, std::string s) { ec3 = ec; s4 = s; }); BOOST_ASIO_CHECK(b5); BOOST_ASIO_CHECK(ec3 == boost::asio::error::eof); BOOST_ASIO_CHECK(s4 == "zyxwvutsrqponmlkjihgfedcba"); ctx.restart(); ctx.run(); BOOST_ASIO_CHECK(!ec2); }; void buffered_concurrent_channel_test() { io_context ctx; concurrent_channel<void(boost::system::error_code, std::string)> ch1(ctx, 1); BOOST_ASIO_CHECK(ch1.is_open()); BOOST_ASIO_CHECK(!ch1.ready()); bool b1 = ch1.try_send(boost::asio::error::eof, "hello"); BOOST_ASIO_CHECK(b1); std::string s1 = "abcdefghijklmnopqrstuvwxyz"; bool b2 = ch1.try_send(boost::asio::error::eof, std::move(s1)); BOOST_ASIO_CHECK(!b2); BOOST_ASIO_CHECK(!s1.empty()); boost::system::error_code ec1; std::string s2; ch1.async_receive( [&](boost::system::error_code ec, std::string s) { ec1 = ec; s2 = std::move(s); }); ctx.run(); BOOST_ASIO_CHECK(ec1 == boost::asio::error::eof); BOOST_ASIO_CHECK(s2 == "hello"); bool b4 = ch1.try_receive([](boost::system::error_code, std::string){}); BOOST_ASIO_CHECK(!b4); boost::system::error_code ec2 = boost::asio::error::would_block; std::string s3 = "zyxwvutsrqponmlkjihgfedcba"; ch1.async_send(boost::asio::error::eof, std::move(s3), [&](boost::system::error_code ec) { ec2 = ec; }); boost::system::error_code ec3; std::string s4; bool b5 = ch1.try_receive( [&](boost::system::error_code ec, std::string s) { ec3 = ec; s4 = s; }); BOOST_ASIO_CHECK(b5); BOOST_ASIO_CHECK(ec3 == boost::asio::error::eof); BOOST_ASIO_CHECK(s4 == "zyxwvutsrqponmlkjihgfedcba"); ctx.restart(); ctx.run(); BOOST_ASIO_CHECK(!ec2); }; BOOST_ASIO_TEST_SUITE ( "experimental/concurrent_channel", BOOST_ASIO_TEST_CASE(unbuffered_concurrent_channel_test) BOOST_ASIO_TEST_CASE(buffered_concurrent_channel_test) )
cpp
asio
data/projects/asio/test/experimental/coro/executor.cpp
// // experimental/coro/executor.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2021-2023 Klemens D. Morgenstern // (klemens dot morgenstern at gmx dot net) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/experimental/coro.hpp> #include <boost/asio/thread_pool.hpp> #include <boost/asio/io_context.hpp> #include "../../unit_test.hpp" using namespace boost::asio::experimental; namespace coro { #define BOOST_ASIO_CHECKPOINT() \ BOOST_ASIO_TEST_IOSTREAM << __FILE__ << "(" << __LINE__ << "): " \ << boost::asio::detail::test_name() << ": " \ << "Checkpoint" << std::endl; template <typename T> void different_execs() { boost::asio::thread_pool th_ctx{1u}; boost::asio::io_context ctx; auto o = std::make_optional( boost::asio::prefer(th_ctx.get_executor(), boost::asio::execution::outstanding_work.tracked)); static bool ran_inner = false, ran_outer = false; struct c_inner_t { auto operator()(boost::asio::any_io_executor e) -> boost::asio::experimental::coro<T> { auto p = e.target<boost::asio::thread_pool::executor_type>(); BOOST_ASIO_CHECKPOINT(); BOOST_ASIO_CHECK(p); BOOST_ASIO_CHECK(p->running_in_this_thread()); ran_inner = true; co_return; }; }; c_inner_t c_inner; struct c_outer_t { auto operator()(boost::asio::any_io_executor e, int, boost::asio::experimental::coro<T> tp) -> boost::asio::experimental::coro<void> { auto p = e.target<boost::asio::io_context::executor_type>(); BOOST_ASIO_CHECK(p); BOOST_ASIO_CHECK(p->running_in_this_thread()); BOOST_ASIO_CHECKPOINT(); co_await tp; BOOST_ASIO_CHECKPOINT(); BOOST_ASIO_CHECK(p->running_in_this_thread()); ran_outer = true; }; }; c_outer_t c_outer; bool ran = false; std::exception_ptr ex; auto c = c_outer(ctx.get_executor(), 10, c_inner(th_ctx.get_executor())); c.async_resume( [&](std::exception_ptr e) { BOOST_ASIO_CHECK(!e); BOOST_ASIO_CHECKPOINT(); ran = true; }); BOOST_ASIO_CHECK(!ran); ctx.run(); o.reset(); BOOST_ASIO_CHECK(ran); BOOST_ASIO_CHECK(ran_inner); BOOST_ASIO_CHECK(ran_outer); BOOST_ASIO_CHECK(!ex); th_ctx.stop(); th_ctx.join(); } } // namespace coro BOOST_ASIO_TEST_SUITE ( "coro/partial", BOOST_ASIO_TEST_CASE(::coro::different_execs<void>) BOOST_ASIO_TEST_CASE(::coro::different_execs<int()>) )
cpp
asio
data/projects/asio/test/experimental/coro/use_coro.cpp
// // experimental/coro/use_coro.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2021-2023 Klemens D. Morgenstern // (klemens dot morgenstern at gmx dot net) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/experimental/use_coro.hpp> #include <boost/asio/steady_timer.hpp> #include <iostream> #include "../../unit_test.hpp" using namespace boost::asio::experimental; namespace coro { boost::asio::experimental::coro<void(), int> awaiter(boost::asio::any_io_executor exec) { boost::asio::steady_timer timer{exec}; co_await timer.async_wait(use_coro); co_return 42; } boost::asio::experimental::coro<void() noexcept, int> awaiter_noexcept(boost::asio::any_io_executor exec) { boost::asio::steady_timer timer{exec}; auto ec = co_await timer.async_wait(boost::asio::deferred); BOOST_ASIO_CHECK(ec == boost::system::error_code{}); co_return 42; } void stack_test2() { bool done = false; boost::asio::io_context ctx; auto k = awaiter(ctx.get_executor()); auto k2 = awaiter_noexcept(ctx.get_executor()); k.async_resume( [&](std::exception_ptr ex, int res) { BOOST_ASIO_CHECK(!ex); BOOST_ASIO_CHECK(res == 42); done = true; }); k2.async_resume([&](int res) { BOOST_ASIO_CHECK(res == 42); done = true; }); ctx.run(); BOOST_ASIO_CHECK(done); } } // namespace coro BOOST_ASIO_TEST_SUITE ( "coro/use_coro", BOOST_ASIO_TEST_CASE(::coro::stack_test2) )
cpp
asio
data/projects/asio/test/experimental/coro/co_spawn.cpp
// // experimental/coro/co_spawn.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2021-2023 Klemens D. Morgenstern // (klemens dot morgenstern at gmx dot net) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/experimental/co_spawn.hpp> #include <iostream> #include <boost/asio/io_context.hpp> #include <boost/asio/steady_timer.hpp> #include <boost/asio/this_coro.hpp> #include "../../unit_test.hpp" using namespace boost::asio::experimental; namespace this_coro = boost::asio::this_coro; namespace coro { auto coro_simple_co_spawn_impl(boost::asio::io_context& , bool &done) noexcept -> boost::asio::experimental::coro<void() noexcept, int> { boost::asio::steady_timer timer( co_await this_coro::executor, std::chrono::milliseconds(10)); done = true; co_return 42; } void coro_co_spawn() { boost::asio::io_context ctx; bool done1 = false; bool done2 = false; int res = 0; co_spawn(coro_simple_co_spawn_impl(ctx, done1), [&](int r){done2= true; res = r;}); ctx.run(); BOOST_ASIO_CHECK(done1); BOOST_ASIO_CHECK(done2); BOOST_ASIO_CHECK(res == 42); } } // namespace coro BOOST_ASIO_TEST_SUITE ( "coro/co_spawn", BOOST_ASIO_TEST_CASE(::coro::coro_co_spawn) )
cpp
asio
data/projects/asio/test/experimental/coro/exception.cpp
// // experimental/coro/exception.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2021-2023 Klemens D. Morgenstern // (klemens dot morgenstern at gmx dot net) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/experimental/coro.hpp> #include <boost/asio/co_spawn.hpp> #include <boost/asio/detached.hpp> #include <boost/asio/io_context.hpp> #include <boost/asio/use_awaitable.hpp> #include <boost/asio/awaitable.hpp> #include "../../unit_test.hpp" using namespace boost::asio::experimental; namespace coro { template <typename Func> struct on_scope_exit { Func func; static_assert(noexcept(func())); on_scope_exit(const Func &f) : func(static_cast< Func && >(f)) { } on_scope_exit(Func &&f) : func(f) { } on_scope_exit(const on_scope_exit &) = delete; ~on_scope_exit() { func(); } }; boost::asio::experimental::coro<int> throwing_generator( boost::asio::any_io_executor, int &last, bool &destroyed) { on_scope_exit x = [&]() noexcept { destroyed = true; }; (void)x; int i = 0; while (i < 3) co_yield last = ++i; throw std::runtime_error("throwing-generator"); } boost::asio::awaitable<void> throwing_generator_test() { int val = 0; bool destr = false; { auto gi = throwing_generator( co_await boost::asio::this_coro::executor, val, destr); bool caught = false; try { for (int i = 0; i < 10; i++) { BOOST_ASIO_CHECK(val == i); const auto next = co_await gi.async_resume(boost::asio::use_awaitable); BOOST_ASIO_CHECK(next); BOOST_ASIO_CHECK(val == *next); BOOST_ASIO_CHECK(val == i + 1); } } catch (std::runtime_error &err) { caught = true; using std::operator ""sv; BOOST_ASIO_CHECK(err.what() == "throwing-generator"sv); } BOOST_ASIO_CHECK(val == 3); BOOST_ASIO_CHECK(caught); } BOOST_ASIO_CHECK(destr); }; void run_throwing_generator_test() { boost::asio::io_context ctx; boost::asio::co_spawn(ctx, throwing_generator_test(), boost::asio::detached); ctx.run(); } boost::asio::experimental::coro<int(int)> throwing_stacked( boost::asio::any_io_executor exec, int &val, bool &destroyed_inner, bool &destroyed) { BOOST_ASIO_CHECK((co_await boost::asio::this_coro::throw_if_cancelled())); on_scope_exit x = [&]() noexcept { destroyed = true; }; (void)x; auto gen = throwing_generator(exec, val, destroyed_inner); while (auto next = co_await gen) // 1, 2, 4, 8, ... BOOST_ASIO_CHECK(42 ==(co_yield *next)); // offset is delayed by one cycle } boost::asio::awaitable<void> throwing_generator_stacked_test() { int val = 0; bool destr = false, destr_inner = false; { auto gi = throwing_stacked( co_await boost::asio::this_coro::executor, val, destr, destr_inner); bool caught = false; try { for (int i = 0; i < 10; i++) { BOOST_ASIO_CHECK(val == i); const auto next = co_await gi.async_resume(42, boost::asio::use_awaitable); BOOST_ASIO_CHECK(next); BOOST_ASIO_CHECK(val == *next); BOOST_ASIO_CHECK(val == i + 1); } } catch (std::runtime_error &err) { caught = true; using std::operator ""sv; BOOST_ASIO_CHECK(err.what() == "throwing-generator"sv); } BOOST_ASIO_CHECK(val == 3); BOOST_ASIO_CHECK(caught); } BOOST_ASIO_CHECK(destr); BOOST_ASIO_CHECK(destr_inner); }; void run_throwing_generator_stacked_test() { boost::asio::io_context ctx; boost::asio::co_spawn(ctx, throwing_generator_stacked_test, boost::asio::detached); ctx.run(); } } // namespace coro BOOST_ASIO_TEST_SUITE ( "coro/exception", BOOST_ASIO_TEST_CASE(::coro::run_throwing_generator_stacked_test) BOOST_ASIO_TEST_CASE(::coro::run_throwing_generator_test) )
cpp
asio
data/projects/asio/test/experimental/coro/cancel.cpp
// // experimental/coro/cancel.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2021-2023 Klemens D. Morgenstern // (klemens dot morgenstern at gmx dot net) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/experimental/coro.hpp> #include <iostream> #include <boost/asio/bind_cancellation_slot.hpp> #include <boost/asio/io_context.hpp> #include <boost/asio/steady_timer.hpp> #include <boost/asio/this_coro.hpp> #include "../../unit_test.hpp" using namespace boost::asio::experimental; namespace this_coro = boost::asio::this_coro; namespace coro { auto coro_simple_cancel_impl(boost::asio::io_context& ) noexcept -> boost::asio::experimental::coro<void() noexcept, boost::system::error_code> { BOOST_ASIO_CHECK( !(co_await this_coro::cancellation_state).cancelled()); boost::asio::steady_timer timer{ co_await this_coro::executor, std::chrono::seconds(1)}; BOOST_ASIO_CHECK( !(co_await this_coro::cancellation_state).cancelled()); auto ec = co_await timer; BOOST_ASIO_CHECK( (co_await this_coro::cancellation_state).cancelled()); co_return ec; } void coro_simple_cancel() { boost::asio::io_context ctx; boost::asio::cancellation_signal sig; auto k = coro_simple_cancel_impl(ctx); boost::system::error_code res_ec; k.async_resume( boost::asio::bind_cancellation_slot(sig.slot(), [&](boost::system::error_code ec) {res_ec = ec;})); boost::asio::post(ctx, [&]{sig.emit(boost::asio::cancellation_type::all);}); BOOST_ASIO_CHECK(!res_ec); ctx.run(); BOOST_ASIO_CHECK(res_ec == boost::asio::error::operation_aborted); } auto coro_throw_cancel_impl(boost::asio::io_context& ) -> boost::asio::experimental::coro<void() , void> { boost::asio::steady_timer timer{ co_await this_coro::executor, std::chrono::seconds(1)}; co_await timer; } void coro_throw_cancel() { boost::asio::io_context ctx; boost::asio::cancellation_signal sig; auto k = coro_throw_cancel_impl(ctx); std::exception_ptr res_ex; k.async_resume( boost::asio::bind_cancellation_slot(sig.slot(), [&](std::exception_ptr ex) {res_ex = ex;})); boost::asio::post(ctx, [&]{sig.emit(boost::asio::cancellation_type::all);}); BOOST_ASIO_CHECK(!res_ex); ctx.run(); BOOST_ASIO_CHECK(res_ex); try { if (res_ex) std::rethrow_exception(res_ex); } catch (boost::system::system_error& se) { BOOST_ASIO_CHECK(se.code() == boost::asio::error::operation_aborted); } } auto coro_simple_cancel_nested_k(boost::asio::io_context&, int& cnt) noexcept -> boost::asio::experimental::coro< void() noexcept, boost::system::error_code> { boost::asio::steady_timer timer{ co_await this_coro::executor, std::chrono::milliseconds(100)}; BOOST_ASIO_CHECK(!(co_await this_coro::cancellation_state).cancelled()); auto ec = co_await timer; cnt++; BOOST_ASIO_CHECK((co_await this_coro::cancellation_state).cancelled()); co_return ec; } auto coro_simple_cancel_nested_kouter( boost::asio::io_context& ctx, int& cnt) noexcept -> boost::asio::experimental::coro< boost::system::error_code() noexcept, boost::system::error_code> { BOOST_ASIO_CHECK(cnt == 0); co_yield co_await coro_simple_cancel_nested_k(ctx, cnt); BOOST_ASIO_CHECK(cnt == 1); auto ec = co_await coro_simple_cancel_nested_k(ctx, cnt); BOOST_ASIO_CHECK(cnt == 2); co_return ec; } void coro_simple_cancel_nested() { boost::asio::io_context ctx; boost::asio::cancellation_signal sig; int cnt = 0; auto kouter = coro_simple_cancel_nested_kouter(ctx, cnt); boost::system::error_code res_ec; kouter.async_resume( boost::asio::bind_cancellation_slot(sig.slot(), [&](boost::system::error_code ec) {res_ec = ec;})); boost::asio::post(ctx, [&]{sig.emit(boost::asio::cancellation_type::all);}); BOOST_ASIO_CHECK(!res_ec); ctx.run(); BOOST_ASIO_CHECK(res_ec == boost::asio::error::operation_aborted); ctx.restart(); res_ec = {}; kouter.async_resume( boost::asio::bind_cancellation_slot(sig.slot(), [&](boost::system::error_code ec) {res_ec = ec;})); boost::asio::post(ctx, [&]{sig.emit(boost::asio::cancellation_type::all);}); BOOST_ASIO_CHECK(!res_ec); ctx.run(); BOOST_ASIO_CHECK(res_ec == boost::asio::error::operation_aborted); BOOST_ASIO_CHECK(cnt == 2); } } // namespace coro BOOST_ASIO_TEST_SUITE ( "coro/cancel", BOOST_ASIO_TEST_CASE(::coro::coro_simple_cancel) BOOST_ASIO_TEST_CASE(::coro::coro_throw_cancel) BOOST_ASIO_TEST_CASE(::coro::coro_simple_cancel_nested) )
cpp
asio
data/projects/asio/test/experimental/coro/partial.cpp
// // experimental/coro/partial.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2021-2023 Klemens D. Morgenstern // (klemens dot morgenstern at gmx dot net) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/experimental/coro.hpp> #include <boost/asio/io_context.hpp> #include "../../unit_test.hpp" using namespace boost::asio::experimental; namespace coro { void partial() { boost::asio::io_context ctx; bool ran = false; auto p = detail::post_coroutine(ctx, [&]{ran = true;}).handle; BOOST_ASIO_CHECK(!ran); p.resume(); BOOST_ASIO_CHECK(!ran); ctx.run(); BOOST_ASIO_CHECK(ran); } } // namespace coro BOOST_ASIO_TEST_SUITE ( "coro/partial", BOOST_ASIO_TEST_CASE(::coro::partial) )
cpp
asio
data/projects/asio/test/experimental/coro/stack_test.cpp
// // experimental/coro/stack_test.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2021-2023 Klemens D. Morgenstern // (klemens dot morgenstern at gmx dot net) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/experimental/coro.hpp> #include <boost/asio/detached.hpp> #include <boost/asio/io_context.hpp> #include <iostream> #include "../../unit_test.hpp" using namespace boost::asio::experimental; namespace coro { boost::asio::experimental::coro<int()> stack_generator(boost::asio::any_io_executor, int i = 1) { for (;;) { co_yield i; i *= 2; } } boost::asio::experimental::coro<int(int)> stack_accumulate(boost::asio::any_io_executor exec) { auto gen = stack_generator(exec); int offset = 0; while (auto next = co_await gen) // 1, 2, 4, 8, ... offset = co_yield *next + offset; // offset is delayed by one cycle } boost::asio::experimental::coro<int> main_stack_coro(boost::asio::io_context&, bool & done) { auto g = stack_accumulate(co_await boost::asio::this_coro::executor); BOOST_ASIO_CHECK(g.is_open()); BOOST_ASIO_CHECK(1 == (co_await g(1000)).value_or(-1)); BOOST_ASIO_CHECK(2002 == (co_await g(2000)).value_or(-1)); BOOST_ASIO_CHECK(3004 == (co_await g(3000)).value_or(-1)); BOOST_ASIO_CHECK(4008 == (co_await g(4000)).value_or(-1)); BOOST_ASIO_CHECK(5016 == (co_await g(5000)).value_or(-1)); BOOST_ASIO_CHECK(6032 == (co_await g(6000)).value_or(-1)); BOOST_ASIO_CHECK(7064 == (co_await g(7000)).value_or(-1)); BOOST_ASIO_CHECK(8128 == (co_await g(8000)).value_or(-1)); BOOST_ASIO_CHECK(9256 == (co_await g(9000)).value_or(-1)); BOOST_ASIO_CHECK(511 == (co_await g(-1)).value_or(-1)); done = true; } void stack_test() { bool done = false; boost::asio::io_context ctx; auto k = main_stack_coro(ctx, done); k.async_resume(boost::asio::detached); ctx.run(); BOOST_ASIO_CHECK(done); } } // namespace coro BOOST_ASIO_TEST_SUITE ( "coro/stack_test", BOOST_ASIO_TEST_CASE(::coro::stack_test) )
cpp
asio
data/projects/asio/test/experimental/coro/allocator.cpp
// // experimental/coro/partial.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2021-2023 Klemens D. Morgenstern // (klemens dot morgenstern at gmx dot net) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/experimental/coro.hpp> #include <vector> #include <boost/asio/io_context.hpp> #include "../../unit_test.hpp" namespace exp = boost::asio::experimental; namespace coro { template<typename Value = void> struct tracked_allocator { using value_type = Value; std::vector<std::pair<void*, std::size_t>> & allocs, &deallocs; tracked_allocator(std::vector<std::pair<void*, std::size_t>> & allocs, std::vector<std::pair<void*, std::size_t>> & deallocs) : allocs(allocs), deallocs(deallocs) {} template<typename T> tracked_allocator(const tracked_allocator<T> & a) : allocs(a.allocs), deallocs(a.deallocs) {} value_type* allocate(std::size_t n) { auto p = new char[n * sizeof(Value)]; allocs.emplace_back(p, n); return reinterpret_cast<value_type*>(p); } void deallocate(void* p, std::size_t n) { deallocs.emplace_back(p, n); delete[] static_cast<char*>(p); // BOOST_ASIO_CHECK(allocs.back() == deallocs.back()); } bool operator==(const tracked_allocator & rhs) const { return &allocs == &rhs.allocs && &deallocs == &rhs.deallocs; } }; exp::coro<void, void, boost::asio::any_io_executor, tracked_allocator<void>> alloc_test_impl(boost::asio::io_context & ctx, int, std::allocator_arg_t, tracked_allocator<void> ta, double) { co_return ; } void alloc_test() { std::vector<std::pair<void*, std::size_t>> allocs, deallocs; boost::asio::io_context ctx; bool ran = false; { auto pp = alloc_test_impl(ctx, 42, std::allocator_arg, {allocs, deallocs}, 42.); BOOST_ASIO_CHECK(allocs.size() == 1u); BOOST_ASIO_CHECK(deallocs.empty()); pp.async_resume([&](auto e){ran = true; BOOST_ASIO_CHECK(!e);}); ctx.run(); BOOST_ASIO_CHECK(deallocs.size() == 0u); } ctx.restart(); ctx.run(); BOOST_ASIO_CHECK(deallocs.size() == 1u); BOOST_ASIO_CHECK(allocs == deallocs); BOOST_ASIO_CHECK(ran); ran = false; auto p = boost::asio::experimental::detail::post_coroutine( ctx, boost::asio::bind_allocator(tracked_allocator{allocs, deallocs}, [&]{ran = true;})).handle; BOOST_ASIO_CHECK(allocs.size() == 2u); BOOST_ASIO_CHECK(deallocs.size() == 1u); p.resume(); BOOST_ASIO_CHECK(allocs.size() == 3u); BOOST_ASIO_CHECK(deallocs.size() == 2u); ctx.restart(); ctx.run(); BOOST_ASIO_CHECK(allocs == deallocs); } } // namespace coro BOOST_ASIO_TEST_SUITE ( "coro/allocate", BOOST_ASIO_TEST_CASE(::coro::alloc_test) )
cpp
asio
data/projects/asio/test/experimental/coro/simple_test.cpp
// // experimental/coro/simple_test.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2021-2023 Klemens D. Morgenstern // (klemens dot morgenstern at gmx dot net) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/experimental/coro.hpp> #include <boost/asio/co_spawn.hpp> #include <boost/asio/detached.hpp> #include <boost/asio/io_context.hpp> #include <boost/asio/use_awaitable.hpp> #include <iostream> #include <vector> #include "../../unit_test.hpp" using namespace boost::asio::experimental; namespace boost { namespace asio { namespace experimental { template struct coro<void(), void, any_io_executor>; template struct coro<int(), void, any_io_executor>; template struct coro<void(), int, any_io_executor>; template struct coro<int(int), void, any_io_executor>; template struct coro<int(), int, any_io_executor>; template struct coro<int(int), int, any_io_executor>; template struct coro<void() noexcept, void, any_io_executor>; template struct coro<int() noexcept, void, any_io_executor>; template struct coro<void() noexcept, int, any_io_executor>; template struct coro<int(int) noexcept, void, any_io_executor>; template struct coro<int() noexcept, int, any_io_executor>; template struct coro<int(int) noexcept, int, any_io_executor>; } // namespace experimental } // namespace asio } // namespace boost namespace coro { template <typename Func> struct on_scope_exit { Func func; static_assert(noexcept(func())); on_scope_exit(const Func &f) : func(static_cast< Func && >(f)) { } on_scope_exit(Func &&f) : func(f) { } on_scope_exit(const on_scope_exit &) = delete; ~on_scope_exit() { func(); } }; boost::asio::experimental::coro<int> generator_impl( boost::asio::any_io_executor, int& last, bool& destroyed) { on_scope_exit x = [&]() noexcept { destroyed = true; }; (void)x; int i = 0; while (true) co_yield last = ++i; } boost::asio::awaitable<void> generator_test() { int val = 0; bool destr = false; { auto gi = generator_impl( co_await boost::asio::this_coro::executor, val, destr); for (int i = 0; i < 10; i++) { BOOST_ASIO_CHECK(val == i); const auto next = co_await gi.async_resume(boost::asio::use_awaitable); BOOST_ASIO_CHECK(next); BOOST_ASIO_CHECK(val == *next); BOOST_ASIO_CHECK(val == i + 1); } BOOST_ASIO_CHECK(!destr); } BOOST_ASIO_CHECK(destr); }; void run_generator_test() { boost::asio::io_context ctx; boost::asio::co_spawn(ctx, generator_test, boost::asio::detached); ctx.run(); } boost::asio::experimental::coro<void, int> task_test(boost::asio::io_context&) { co_return 42; } boost::asio::experimental::coro<void, int> task_throw(boost::asio::io_context&) { throw std::logic_error(__func__); co_return 42; } void run_task_test() { boost::asio::io_context ctx; bool tt1 = false; bool tt2 = false; bool tt3 = false; bool tt4 = false; auto tt = task_test(ctx); tt.async_resume( [&](std::exception_ptr pt, int i) { tt1 = true; BOOST_ASIO_CHECK(!pt); BOOST_ASIO_CHECK(i == 42); tt.async_resume( [&](std::exception_ptr pt, int) { tt2 = true; BOOST_ASIO_CHECK(pt); }); }); auto tt_2 = task_throw(ctx); tt_2.async_resume( [&](std::exception_ptr pt, int) { tt3 = true; BOOST_ASIO_CHECK(pt); tt.async_resume( [&](std::exception_ptr pt, int) { tt4 = true; BOOST_ASIO_CHECK(pt); }); }); ctx.run(); BOOST_ASIO_CHECK(tt1); BOOST_ASIO_CHECK(tt2); BOOST_ASIO_CHECK(tt3); BOOST_ASIO_CHECK(tt4); } boost::asio::experimental::coro<char> completion_generator_test_impl( boost::asio::any_io_executor, int limit) { for (int i = 0; i < limit; i++) co_yield i; } boost::asio::awaitable<void> completion_generator_test() { std::vector<int> res; auto g = completion_generator_test_impl( co_await boost::asio::this_coro::executor, 10); BOOST_ASIO_CHECK(g.is_open()); while (auto val = co_await g.async_resume(boost::asio::use_awaitable)) res.push_back(*val); BOOST_ASIO_CHECK(!g.is_open()); BOOST_ASIO_CHECK((res == std::vector{0,1,2,3,4,5,6,7,8,9})); }; void run_completion_generator_test() { boost::asio::io_context ctx; boost::asio::co_spawn(ctx, completion_generator_test, boost::asio::detached); ctx.run(); } boost::asio::experimental::coro<int(int)> symmetrical_test_impl(boost::asio::any_io_executor) { int i = 0; while (true) i = (co_yield i) + i; } boost::asio::awaitable<void> symmetrical_test() { auto g = symmetrical_test_impl(co_await boost::asio::this_coro::executor); BOOST_ASIO_CHECK(g.is_open()); BOOST_ASIO_CHECK(0 == (co_await g.async_resume(0, boost::asio::use_awaitable)).value_or(-1)); BOOST_ASIO_CHECK(1 == (co_await g.async_resume(1, boost::asio::use_awaitable)).value_or(-1)); BOOST_ASIO_CHECK(3 == (co_await g.async_resume(2, boost::asio::use_awaitable)).value_or(-1)); BOOST_ASIO_CHECK(6 == (co_await g.async_resume(3, boost::asio::use_awaitable)).value_or(-1)); BOOST_ASIO_CHECK(10 == (co_await g.async_resume(4, boost::asio::use_awaitable)).value_or(-1)); BOOST_ASIO_CHECK(15 == (co_await g.async_resume(5, boost::asio::use_awaitable)).value_or(-1)); BOOST_ASIO_CHECK(21 == (co_await g.async_resume(6, boost::asio::use_awaitable)).value_or(-1)); BOOST_ASIO_CHECK(28 == (co_await g.async_resume(7, boost::asio::use_awaitable)).value_or(-1)); BOOST_ASIO_CHECK(36 == (co_await g.async_resume(8, boost::asio::use_awaitable)).value_or(-1)); BOOST_ASIO_CHECK(45 == (co_await g.async_resume(9, boost::asio::use_awaitable)).value_or(-1)); }; void run_symmetrical_test() { boost::asio::io_context ctx; boost::asio::co_spawn(ctx, symmetrical_test, boost::asio::detached); ctx.run(); } } // namespace coro BOOST_ASIO_TEST_SUITE ( "coro/simple_test", BOOST_ASIO_TEST_CASE(::coro::run_generator_test) BOOST_ASIO_TEST_CASE(::coro::run_task_test) BOOST_ASIO_TEST_CASE(::coro::run_symmetrical_test) BOOST_ASIO_TEST_CASE(::coro::run_completion_generator_test) )
cpp
asio
data/projects/asio/test/local/datagram_protocol.cpp
// // datagram_protocol.cpp // ~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/local/datagram_protocol.hpp> #include <cstring> #include <boost/asio/io_context.hpp> #include "../unit_test.hpp" //------------------------------------------------------------------------------ // local_datagram_protocol_socket_compile test // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // The following test checks that all public member functions on the class // local::datagram_socket::socket compile and link correctly. Runtime failures // are ignored. namespace local_datagram_protocol_socket_compile { void connect_handler(const boost::system::error_code&) { } void send_handler(const boost::system::error_code&, std::size_t) { } void receive_handler(const boost::system::error_code&, std::size_t) { } void test() { #if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) using namespace boost::asio; namespace local = boost::asio::local; typedef local::datagram_protocol dp; try { io_context ioc; const io_context::executor_type ioc_ex = ioc.get_executor(); char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; socket_base::message_flags in_flags = 0; socket_base::send_buffer_size socket_option; socket_base::bytes_readable io_control_command; boost::system::error_code ec; // basic_datagram_socket constructors. dp::socket socket1(ioc); dp::socket socket2(ioc, dp()); dp::socket socket3(ioc, dp::endpoint("")); int native_socket1 = ::socket(AF_UNIX, SOCK_DGRAM, 0); dp::socket socket4(ioc, dp(), native_socket1); dp::socket socket5(ioc_ex); dp::socket socket6(ioc_ex, dp()); dp::socket socket7(ioc_ex, dp::endpoint("")); int native_socket2 = ::socket(AF_UNIX, SOCK_DGRAM, 0); dp::socket socket8(ioc_ex, dp(), native_socket2); // basic_io_object functions. dp::socket::executor_type ex = socket1.get_executor(); (void)ex; // basic_socket functions. dp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer(); (void)lowest_layer; socket1.open(dp()); socket1.open(dp(), ec); int native_socket3 = ::socket(AF_UNIX, SOCK_DGRAM, 0); socket1.assign(dp(), native_socket3); int native_socket4 = ::socket(AF_UNIX, SOCK_DGRAM, 0); socket1.assign(dp(), native_socket4, ec); bool is_open = socket1.is_open(); (void)is_open; socket1.close(); socket1.close(ec); dp::socket::native_handle_type native_socket5 = socket1.native_handle(); (void)native_socket5; socket1.cancel(); socket1.cancel(ec); bool at_mark1 = socket1.at_mark(); (void)at_mark1; bool at_mark2 = socket1.at_mark(ec); (void)at_mark2; std::size_t available1 = socket1.available(); (void)available1; std::size_t available2 = socket1.available(ec); (void)available2; socket1.bind(dp::endpoint("")); socket1.bind(dp::endpoint(""), ec); socket1.connect(dp::endpoint("")); socket1.connect(dp::endpoint(""), ec); socket1.async_connect(dp::endpoint(""), connect_handler); socket1.set_option(socket_option); socket1.set_option(socket_option, ec); socket1.get_option(socket_option); socket1.get_option(socket_option, ec); socket1.io_control(io_control_command); socket1.io_control(io_control_command, ec); dp::endpoint endpoint1 = socket1.local_endpoint(); (void)endpoint1; dp::endpoint endpoint2 = socket1.local_endpoint(ec); (void)endpoint2; dp::endpoint endpoint3 = socket1.remote_endpoint(); (void)endpoint3; dp::endpoint endpoint4 = socket1.remote_endpoint(ec); (void)endpoint4; socket1.shutdown(socket_base::shutdown_both); socket1.shutdown(socket_base::shutdown_both, ec); // basic_datagram_socket functions. socket1.send(buffer(mutable_char_buffer)); socket1.send(buffer(const_char_buffer)); socket1.send(null_buffers()); socket1.send(buffer(mutable_char_buffer), in_flags); socket1.send(buffer(const_char_buffer), in_flags); socket1.send(null_buffers(), in_flags); socket1.send(buffer(mutable_char_buffer), in_flags, ec); socket1.send(buffer(const_char_buffer), in_flags, ec); socket1.send(null_buffers(), in_flags, ec); socket1.async_send(buffer(mutable_char_buffer), send_handler); socket1.async_send(buffer(const_char_buffer), send_handler); socket1.async_send(null_buffers(), send_handler); socket1.async_send(buffer(mutable_char_buffer), in_flags, send_handler); socket1.async_send(buffer(const_char_buffer), in_flags, send_handler); socket1.async_send(null_buffers(), in_flags, send_handler); socket1.send_to(buffer(mutable_char_buffer), dp::endpoint("")); socket1.send_to(buffer(const_char_buffer), dp::endpoint("")); socket1.send_to(null_buffers(), dp::endpoint("")); socket1.send_to(buffer(mutable_char_buffer), dp::endpoint(""), in_flags); socket1.send_to(buffer(const_char_buffer), dp::endpoint(""), in_flags); socket1.send_to(null_buffers(), dp::endpoint(""), in_flags); socket1.send_to(buffer(mutable_char_buffer), dp::endpoint(""), in_flags, ec); socket1.send_to(buffer(const_char_buffer), dp::endpoint(""), in_flags, ec); socket1.send_to(null_buffers(), dp::endpoint(""), in_flags, ec); socket1.async_send_to(buffer(mutable_char_buffer), dp::endpoint(""), send_handler); socket1.async_send_to(buffer(const_char_buffer), dp::endpoint(""), send_handler); socket1.async_send_to(null_buffers(), dp::endpoint(""), send_handler); socket1.async_send_to(buffer(mutable_char_buffer), dp::endpoint(""), in_flags, send_handler); socket1.async_send_to(buffer(const_char_buffer), dp::endpoint(""), in_flags, send_handler); socket1.async_send_to(null_buffers(), dp::endpoint(""), in_flags, send_handler); socket1.receive(buffer(mutable_char_buffer)); socket1.receive(null_buffers()); socket1.receive(buffer(mutable_char_buffer), in_flags); socket1.receive(null_buffers(), in_flags); socket1.receive(buffer(mutable_char_buffer), in_flags, ec); socket1.receive(null_buffers(), in_flags, ec); socket1.async_receive(buffer(mutable_char_buffer), receive_handler); socket1.async_receive(null_buffers(), receive_handler); socket1.async_receive(buffer(mutable_char_buffer), in_flags, receive_handler); socket1.async_receive(null_buffers(), in_flags, receive_handler); dp::endpoint endpoint; socket1.receive_from(buffer(mutable_char_buffer), endpoint); socket1.receive_from(null_buffers(), endpoint); socket1.receive_from(buffer(mutable_char_buffer), endpoint, in_flags); socket1.receive_from(null_buffers(), endpoint, in_flags); socket1.receive_from(buffer(mutable_char_buffer), endpoint, in_flags, ec); socket1.receive_from(null_buffers(), endpoint, in_flags, ec); socket1.async_receive_from(buffer(mutable_char_buffer), endpoint, receive_handler); socket1.async_receive_from(null_buffers(), endpoint, receive_handler); socket1.async_receive_from(buffer(mutable_char_buffer), endpoint, in_flags, receive_handler); socket1.async_receive_from(null_buffers(), endpoint, in_flags, receive_handler); } catch (std::exception&) { } #endif // defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) } } // namespace local_datagram_protocol_socket_compile //------------------------------------------------------------------------------ BOOST_ASIO_TEST_SUITE ( "local/datagram_protocol", BOOST_ASIO_COMPILE_TEST_CASE(local_datagram_protocol_socket_compile::test) )
cpp
asio
data/projects/asio/test/local/basic_endpoint.cpp
// // basic_endpoint.cpp // ~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/local/basic_endpoint.hpp> #include "../unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "local/basic_endpoint", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/local/stream_protocol.cpp
// // stream_protocol.cpp // ~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/local/stream_protocol.hpp> #include <cstring> #include <boost/asio/io_context.hpp> #include "../unit_test.hpp" //------------------------------------------------------------------------------ // local_stream_protocol_socket_compile test // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // The following test checks that all public member functions on the class // local::stream_protocol::socket compile and link correctly. Runtime failures // are ignored. namespace local_stream_protocol_socket_compile { void connect_handler(const boost::system::error_code&) { } void send_handler(const boost::system::error_code&, std::size_t) { } void receive_handler(const boost::system::error_code&, std::size_t) { } void write_some_handler(const boost::system::error_code&, std::size_t) { } void read_some_handler(const boost::system::error_code&, std::size_t) { } void test() { #if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) using namespace boost::asio; namespace local = boost::asio::local; typedef local::stream_protocol sp; try { io_context ioc; const io_context::executor_type ioc_ex = ioc.get_executor(); char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; socket_base::message_flags in_flags = 0; socket_base::keep_alive socket_option; socket_base::bytes_readable io_control_command; boost::system::error_code ec; // basic_stream_socket constructors. sp::socket socket1(ioc); sp::socket socket2(ioc, sp()); sp::socket socket3(ioc, sp::endpoint("")); int native_socket1 = ::socket(AF_UNIX, SOCK_STREAM, 0); sp::socket socket4(ioc, sp(), native_socket1); sp::socket socket5(ioc_ex); sp::socket socket6(ioc_ex, sp()); sp::socket socket7(ioc_ex, sp::endpoint("")); int native_socket2 = ::socket(AF_UNIX, SOCK_STREAM, 0); sp::socket socket8(ioc_ex, sp(), native_socket2); // basic_io_object functions. sp::socket::executor_type ex = socket1.get_executor(); (void)ex; // basic_socket functions. sp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer(); (void)lowest_layer; socket1.open(sp()); socket1.open(sp(), ec); int native_socket3 = ::socket(AF_UNIX, SOCK_STREAM, 0); socket1.assign(sp(), native_socket3); int native_socket4 = ::socket(AF_UNIX, SOCK_STREAM, 0); socket1.assign(sp(), native_socket4, ec); bool is_open = socket1.is_open(); (void)is_open; socket1.close(); socket1.close(ec); sp::socket::native_handle_type native_socket5 = socket1.native_handle(); (void)native_socket5; socket1.cancel(); socket1.cancel(ec); bool at_mark1 = socket1.at_mark(); (void)at_mark1; bool at_mark2 = socket1.at_mark(ec); (void)at_mark2; std::size_t available1 = socket1.available(); (void)available1; std::size_t available2 = socket1.available(ec); (void)available2; socket1.bind(sp::endpoint("")); socket1.bind(sp::endpoint(""), ec); socket1.connect(sp::endpoint("")); socket1.connect(sp::endpoint(""), ec); socket1.async_connect(sp::endpoint(""), connect_handler); socket1.set_option(socket_option); socket1.set_option(socket_option, ec); socket1.get_option(socket_option); socket1.get_option(socket_option, ec); socket1.io_control(io_control_command); socket1.io_control(io_control_command, ec); sp::endpoint endpoint1 = socket1.local_endpoint(); (void)endpoint1; sp::endpoint endpoint2 = socket1.local_endpoint(ec); (void)endpoint2; sp::endpoint endpoint3 = socket1.remote_endpoint(); (void)endpoint3; sp::endpoint endpoint4 = socket1.remote_endpoint(ec); (void)endpoint4; socket1.shutdown(socket_base::shutdown_both); socket1.shutdown(socket_base::shutdown_both, ec); // basic_stream_socket functions. socket1.send(buffer(mutable_char_buffer)); socket1.send(buffer(const_char_buffer)); socket1.send(null_buffers()); socket1.send(buffer(mutable_char_buffer), in_flags); socket1.send(buffer(const_char_buffer), in_flags); socket1.send(null_buffers(), in_flags); socket1.send(buffer(mutable_char_buffer), in_flags, ec); socket1.send(buffer(const_char_buffer), in_flags, ec); socket1.send(null_buffers(), in_flags, ec); socket1.async_send(buffer(mutable_char_buffer), send_handler); socket1.async_send(buffer(const_char_buffer), send_handler); socket1.async_send(null_buffers(), send_handler); socket1.async_send(buffer(mutable_char_buffer), in_flags, send_handler); socket1.async_send(buffer(const_char_buffer), in_flags, send_handler); socket1.async_send(null_buffers(), in_flags, send_handler); socket1.receive(buffer(mutable_char_buffer)); socket1.receive(null_buffers()); socket1.receive(buffer(mutable_char_buffer), in_flags); socket1.receive(null_buffers(), in_flags); socket1.receive(buffer(mutable_char_buffer), in_flags, ec); socket1.receive(null_buffers(), in_flags, ec); socket1.async_receive(buffer(mutable_char_buffer), receive_handler); socket1.async_receive(null_buffers(), receive_handler); socket1.async_receive(buffer(mutable_char_buffer), in_flags, receive_handler); socket1.async_receive(null_buffers(), in_flags, receive_handler); socket1.write_some(buffer(mutable_char_buffer)); socket1.write_some(buffer(const_char_buffer)); socket1.write_some(null_buffers()); socket1.write_some(buffer(mutable_char_buffer), ec); socket1.write_some(buffer(const_char_buffer), ec); socket1.write_some(null_buffers(), ec); socket1.async_write_some(buffer(mutable_char_buffer), write_some_handler); socket1.async_write_some(buffer(const_char_buffer), write_some_handler); socket1.async_write_some(null_buffers(), write_some_handler); socket1.read_some(buffer(mutable_char_buffer)); socket1.read_some(buffer(mutable_char_buffer), ec); socket1.read_some(null_buffers(), ec); socket1.async_read_some(buffer(mutable_char_buffer), read_some_handler); socket1.async_read_some(null_buffers(), read_some_handler); } catch (std::exception&) { } #endif // defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) } } // namespace local_stream_protocol_socket_compile //------------------------------------------------------------------------------ BOOST_ASIO_TEST_SUITE ( "local/stream_protocol", BOOST_ASIO_COMPILE_TEST_CASE(local_stream_protocol_socket_compile::test) )
cpp
asio
data/projects/asio/test/local/connect_pair.cpp
// // connect_pair.cpp // ~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/local/connect_pair.hpp> #include <boost/asio/io_context.hpp> #include <boost/asio/local/datagram_protocol.hpp> #include <boost/asio/local/stream_protocol.hpp> #include "../unit_test.hpp" //------------------------------------------------------------------------------ // local_connect_pair_compile test // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // The following test checks that all host_name functions compile and link // correctly. Runtime failures are ignored. namespace local_connect_pair_compile { void test() { #if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) using namespace boost::asio; namespace local = boost::asio::local; typedef local::datagram_protocol dp; typedef local::stream_protocol sp; try { boost::asio::io_context io_context; boost::system::error_code ec1; dp::socket s1(io_context); dp::socket s2(io_context); local::connect_pair(s1, s2); dp::socket s3(io_context); dp::socket s4(io_context); local::connect_pair(s3, s4, ec1); sp::socket s5(io_context); sp::socket s6(io_context); local::connect_pair(s5, s6); sp::socket s7(io_context); sp::socket s8(io_context); local::connect_pair(s7, s8, ec1); } catch (std::exception&) { } #endif // defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) } } // namespace local_connect_pair_compile //------------------------------------------------------------------------------ BOOST_ASIO_TEST_SUITE ( "local/connect_pair", BOOST_ASIO_COMPILE_TEST_CASE(local_connect_pair_compile::test) )
cpp
asio
data/projects/asio/test/local/seq_packet_protocol.cpp
// // local/seq_packet_protocol.cpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Test that header file is self-contained. #include <boost/asio/local/seq_packet_protocol.hpp> #include <cstring> #include <boost/asio/io_context.hpp> #include "../unit_test.hpp" #include "../archetypes/async_result.hpp" #if defined(__cplusplus_cli) || defined(__cplusplus_winrt) # define local cpp_local #endif //------------------------------------------------------------------------------ // local_seq_packet_protocol_socket_compile test // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // The following test checks that all public member functions on the class // local::seq_packet_socket::socket compile and link correctly. Runtime // failures are ignored. namespace local_seq_packet_protocol_socket_compile { void connect_handler(const boost::system::error_code&) { } void send_handler(const boost::system::error_code&, std::size_t) { } void receive_handler(const boost::system::error_code&, std::size_t) { } void test() { using namespace boost::asio; namespace local = boost::asio::local; typedef local::seq_packet_protocol spp; try { io_context ioc; char mutable_char_buffer[128] = ""; const char const_char_buffer[128] = ""; const socket_base::message_flags in_flags = 0; socket_base::message_flags out_flags = 0; socket_base::send_buffer_size socket_option; socket_base::bytes_readable io_control_command; archetypes::immediate_handler immediate; boost::system::error_code ec; // basic_seq_packet_socket constructors. spp::socket socket1(ioc); spp::socket socket2(ioc, spp()); spp::socket socket3(ioc, spp::endpoint()); #if !defined(BOOST_ASIO_WINDOWS_RUNTIME) spp::socket::native_handle_type native_socket1 = ::socket(AF_UNIX, SOCK_SEQPACKET, 0); spp::socket socket4(ioc, spp(), native_socket1); #endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME) spp::socket socket5(std::move(socket4)); // basic_seq_packet_socket operators. socket1 = spp::socket(ioc); socket1 = std::move(socket2); // basic_io_object functions. spp::socket::executor_type ex = socket1.get_executor(); (void)ex; // basic_socket functions. spp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer(); (void)lowest_layer; socket1.open(spp()); socket1.open(spp(), ec); #if !defined(BOOST_ASIO_WINDOWS_RUNTIME) spp::socket::native_handle_type native_socket2 = ::socket(AF_UNIX, SOCK_SEQPACKET, 0); socket1.assign(spp(), native_socket2); spp::socket::native_handle_type native_socket3 = ::socket(AF_UNIX, SOCK_SEQPACKET, 0); socket1.assign(spp(), native_socket3, ec); #endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME) bool is_open = socket1.is_open(); (void)is_open; socket1.close(); socket1.close(ec); spp::socket::native_handle_type native_socket4 = socket1.native_handle(); (void)native_socket4; socket1.cancel(); socket1.cancel(ec); bool at_mark1 = socket1.at_mark(); (void)at_mark1; bool at_mark2 = socket1.at_mark(ec); (void)at_mark2; std::size_t available1 = socket1.available(); (void)available1; std::size_t available2 = socket1.available(ec); (void)available2; socket1.bind(spp::endpoint()); socket1.bind(spp::endpoint(), ec); socket1.connect(spp::endpoint()); socket1.connect(spp::endpoint(), ec); socket1.async_connect(spp::endpoint(), connect_handler); socket1.async_connect(spp::endpoint(), immediate); socket1.set_option(socket_option); socket1.set_option(socket_option, ec); socket1.get_option(socket_option); socket1.get_option(socket_option, ec); socket1.io_control(io_control_command); socket1.io_control(io_control_command, ec); spp::endpoint endpoint1 = socket1.local_endpoint(); (void)endpoint1; spp::endpoint endpoint2 = socket1.local_endpoint(ec); (void)endpoint2; spp::endpoint endpoint3 = socket1.remote_endpoint(); (void)endpoint3; spp::endpoint endpoint4 = socket1.remote_endpoint(ec); (void)endpoint4; socket1.shutdown(socket_base::shutdown_both); socket1.shutdown(socket_base::shutdown_both, ec); // basic_seq_packet_socket functions. socket1.send(buffer(mutable_char_buffer), in_flags); socket1.send(buffer(const_char_buffer), in_flags); socket1.send(null_buffers(), in_flags); socket1.send(buffer(mutable_char_buffer), in_flags, ec); socket1.send(buffer(const_char_buffer), in_flags, ec); socket1.send(null_buffers(), in_flags, ec); socket1.async_send(buffer(mutable_char_buffer), in_flags, send_handler); socket1.async_send(buffer(const_char_buffer), in_flags, send_handler); socket1.async_send(null_buffers(), in_flags, send_handler); socket1.async_send(buffer(mutable_char_buffer), in_flags, immediate); socket1.async_send(buffer(const_char_buffer), in_flags, immediate); socket1.async_send(null_buffers(), in_flags, immediate); socket1.receive(buffer(mutable_char_buffer), out_flags); socket1.receive(null_buffers(), out_flags); socket1.receive(buffer(mutable_char_buffer), in_flags, out_flags); socket1.receive(null_buffers(), in_flags, out_flags); socket1.receive(buffer(mutable_char_buffer), in_flags, out_flags, ec); socket1.receive(null_buffers(), in_flags, out_flags, ec); socket1.async_receive(buffer(mutable_char_buffer), out_flags, receive_handler); socket1.async_receive(null_buffers(), out_flags, receive_handler); socket1.async_receive(buffer(mutable_char_buffer), in_flags, out_flags, receive_handler); socket1.async_receive(null_buffers(), in_flags, out_flags, receive_handler); socket1.async_receive(buffer(mutable_char_buffer), out_flags, immediate); socket1.async_receive(null_buffers(), out_flags, immediate); socket1.async_receive(buffer(mutable_char_buffer), in_flags, out_flags, immediate); socket1.async_receive(null_buffers(), in_flags, out_flags, immediate); } catch (std::exception&) { } } } // namespace local_seq_packet_protocol_socket_compile //------------------------------------------------------------------------------ BOOST_ASIO_TEST_SUITE ( "local/seq_packet_protocol", BOOST_ASIO_COMPILE_TEST_CASE(local_seq_packet_protocol_socket_compile::test) )
cpp
asio
data/projects/asio/test/ts/executor.cpp
// // executor.cpp // ~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Prevent link dependency on the Boost.System library. #if !defined(BOOST_SYSTEM_NO_DEPRECATED) #define BOOST_SYSTEM_NO_DEPRECATED #endif // !defined(BOOST_SYSTEM_NO_DEPRECATED) // Test that header file is self-contained. #include <boost/asio/ts/executor.hpp> #include "../unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "ts/executor", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/ts/timer.cpp
// // timer.cpp // ~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Prevent link dependency on the Boost.System library. #if !defined(BOOST_SYSTEM_NO_DEPRECATED) #define BOOST_SYSTEM_NO_DEPRECATED #endif // !defined(BOOST_SYSTEM_NO_DEPRECATED) // Test that header file is self-contained. #include <boost/asio/ts/timer.hpp> #include "../unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "ts/timer", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/ts/netfwd.cpp
// // netfwd.cpp // ~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Prevent link dependency on the Boost.System library. #if !defined(BOOST_SYSTEM_NO_DEPRECATED) #define BOOST_SYSTEM_NO_DEPRECATED #endif // !defined(BOOST_SYSTEM_NO_DEPRECATED) // Test that header file is self-contained. #include <boost/asio/ts/netfwd.hpp> // Test that forward declarations don't conflict with full declarations. #include <boost/asio/ts/net.hpp> #include "../unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "ts/netfwd", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/ts/internet.cpp
// // internet.cpp // ~~~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Prevent link dependency on the Boost.System library. #if !defined(BOOST_SYSTEM_NO_DEPRECATED) #define BOOST_SYSTEM_NO_DEPRECATED #endif // !defined(BOOST_SYSTEM_NO_DEPRECATED) // Test that header file is self-contained. #include <boost/asio/ts/internet.hpp> #include "../unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "ts/internet", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/ts/buffer.cpp
// // buffer.cpp // ~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Prevent link dependency on the Boost.System library. #if !defined(BOOST_SYSTEM_NO_DEPRECATED) #define BOOST_SYSTEM_NO_DEPRECATED #endif // !defined(BOOST_SYSTEM_NO_DEPRECATED) // Test that header file is self-contained. #include <boost/asio/ts/buffer.hpp> #include "../unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "ts/buffer", BOOST_ASIO_TEST_CASE(null_test) )
cpp
asio
data/projects/asio/test/ts/socket.cpp
// // socket.cpp // ~~~~~~~~~~ // // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // Disable autolinking for unit tests. #if !defined(BOOST_ALL_NO_LIB) #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) // Prevent link dependency on the Boost.System library. #if !defined(BOOST_SYSTEM_NO_DEPRECATED) #define BOOST_SYSTEM_NO_DEPRECATED #endif // !defined(BOOST_SYSTEM_NO_DEPRECATED) // Test that header file is self-contained. #include <boost/asio/ts/socket.hpp> #include "../unit_test.hpp" BOOST_ASIO_TEST_SUITE ( "ts/socket", BOOST_ASIO_TEST_CASE(null_test) )
cpp