diff options
Diffstat (limited to '3rdparty/asio/src/tests/unit/write.cpp')
-rw-r--r-- | 3rdparty/asio/src/tests/unit/write.cpp | 84 |
1 files changed, 6 insertions, 78 deletions
diff --git a/3rdparty/asio/src/tests/unit/write.cpp b/3rdparty/asio/src/tests/unit/write.cpp index 0343c02c71e..470972217c1 100644 --- a/3rdparty/asio/src/tests/unit/write.cpp +++ b/3rdparty/asio/src/tests/unit/write.cpp @@ -2,7 +2,7 @@ // write.cpp // ~~~~~~~~~ // -// Copyright (c) 2003-2021 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// 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) @@ -16,7 +16,9 @@ // Test that header file is self-contained. #include "asio/write.hpp" +#include <array> #include <cstring> +#include <functional> #include <vector> #include "archetypes/async_result.hpp" #include "asio/io_context.hpp" @@ -24,20 +26,10 @@ #include "asio/streambuf.hpp" #include "unit_test.hpp" -#if defined(ASIO_HAS_BOOST_BIND) -# include <boost/bind/bind.hpp> -#else // defined(ASIO_HAS_BOOST_BIND) -# include <functional> -#endif // defined(ASIO_HAS_BOOST_BIND) - #if defined(ASIO_HAS_BOOST_ARRAY) #include <boost/array.hpp> #endif // defined(ASIO_HAS_BOOST_ARRAY) -#if defined(ASIO_HAS_STD_ARRAY) -# include <array> -#endif // defined(ASIO_HAS_STD_ARRAY) - using namespace std; // For memcmp, memcpy and memset. class test_stream @@ -54,7 +46,7 @@ public: memset(data_, 0, max_length); } - executor_type get_executor() ASIO_NOEXCEPT + executor_type get_executor() noexcept { return io_context_.get_executor(); } @@ -121,12 +113,12 @@ public: template <typename Const_Buffers, typename Handler> void async_write_some(const Const_Buffers& buffers, - ASIO_MOVE_ARG(Handler) handler) + Handler&& handler) { size_t bytes_transferred = write_some(buffers); asio::post(get_executor(), asio::detail::bind_handler( - ASIO_MOVE_CAST(Handler)(handler), + static_cast<Handler&&>(handler), asio::error_code(), bytes_transferred)); } @@ -409,11 +401,7 @@ bool old_style_transfer_all(const asio::error_code& ec, struct short_transfer { short_transfer() {} -#if defined(ASIO_HAS_MOVE) short_transfer(short_transfer&&) {} -#else // defined(ASIO_HAS_MOVE) - short_transfer(const short_transfer&) {} -#endif // defined(ASIO_HAS_MOVE) size_t operator()(const asio::error_code& ec, size_t /*bytes_transferred*/) { @@ -2173,11 +2161,7 @@ void async_write_handler(const asio::error_code& e, void test_3_arg_const_buffer_async_write() { -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; @@ -2228,11 +2212,7 @@ void test_3_arg_const_buffer_async_write() void test_3_arg_mutable_buffer_async_write() { -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; @@ -2283,11 +2263,7 @@ void test_3_arg_mutable_buffer_async_write() void test_3_arg_boost_array_buffers_async_write() { -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; @@ -2341,15 +2317,10 @@ void test_3_arg_boost_array_buffers_async_write() void test_3_arg_std_array_buffers_async_write() { -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; -#if defined(ASIO_HAS_STD_ARRAY) asio::io_context ioc; test_stream s(ioc); std::array<asio::const_buffer, 2> buffers = { { @@ -2394,16 +2365,11 @@ void test_3_arg_std_array_buffers_async_write() ioc.restart(); ioc.run(); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); -#endif // defined(ASIO_HAS_STD_ARRAY) } void test_3_arg_vector_buffers_async_write() { -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; @@ -2456,11 +2422,7 @@ void test_3_arg_vector_buffers_async_write() void test_3_arg_dynamic_string_async_write() { -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; @@ -2520,11 +2482,7 @@ void test_3_arg_dynamic_string_async_write() void test_3_arg_streambuf_async_write() { #if !defined(ASIO_NO_DYNAMIC_BUFFER_V1) -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; @@ -2585,11 +2543,7 @@ void test_3_arg_streambuf_async_write() void test_4_arg_const_buffer_async_write() { -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; @@ -2897,11 +2851,7 @@ void test_4_arg_const_buffer_async_write() void test_4_arg_mutable_buffer_async_write() { -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; @@ -3209,11 +3159,7 @@ void test_4_arg_mutable_buffer_async_write() void test_4_arg_boost_array_buffers_async_write() { -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; @@ -3524,15 +3470,10 @@ void test_4_arg_boost_array_buffers_async_write() void test_4_arg_std_array_buffers_async_write() { -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; -#if defined(ASIO_HAS_STD_ARRAY) asio::io_context ioc; test_stream s(ioc); std::array<asio::const_buffer, 2> buffers = { { @@ -3834,16 +3775,11 @@ void test_4_arg_std_array_buffers_async_write() ioc.restart(); ioc.run(); ASIO_CHECK(s.check_buffers(buffers, sizeof(write_data))); -#endif // defined(ASIO_HAS_STD_ARRAY) } void test_4_arg_vector_buffers_async_write() { -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; @@ -4153,11 +4089,7 @@ void test_4_arg_vector_buffers_async_write() void test_4_arg_dynamic_string_async_write() { -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; @@ -4498,11 +4430,7 @@ void test_4_arg_dynamic_string_async_write() void test_4_arg_streambuf_async_write() { #if !defined(ASIO_NO_DYNAMIC_BUFFER_V1) -#if defined(ASIO_HAS_BOOST_BIND) - namespace bindns = boost; -#else // defined(ASIO_HAS_BOOST_BIND) namespace bindns = std; -#endif // defined(ASIO_HAS_BOOST_BIND) using bindns::placeholders::_1; using bindns::placeholders::_2; |