From 51aa614a103817e71d844ac729ac7e36905540e2 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Mon, 6 Feb 2017 10:56:37 -0500 Subject: [PATCH] Tidy up tests and docs: * Add handler_ptr test and increase coverage * Add test for prepare_buffer * Move is_call_possible tests to a .cpp file * Tidy up docs and declarations --- CHANGELOG.md | 2 + doc/master.qbk | 7 +- doc/reference.xsl | 3 + include/beast/core/bind_handler.hpp | 36 +++-- include/beast/core/buffer_cat.hpp | 5 +- include/beast/core/consuming_buffers.hpp | 19 ++- include/beast/core/detail/bind_handler.hpp | 7 +- .../beast/core/detail/is_call_possible.hpp | 47 +----- include/beast/core/dynabuf_readstream.hpp | 150 +++++++++++++----- include/beast/core/handler_alloc.hpp | 25 +-- include/beast/core/placeholders.hpp | 6 +- test/Jamfile | 2 + test/core/CMakeLists.txt | 2 + test/core/bind_handler.cpp | 10 +- test/core/handler_alloc.cpp | 33 +++- test/core/handler_ptr.cpp | 71 +++++++++ test/core/is_call_possible.cpp | 56 +++++++ test/core/prepare_buffer.cpp | 9 ++ test/core/to_string.cpp | 18 +++ 19 files changed, 372 insertions(+), 136 deletions(-) create mode 100644 test/core/is_call_possible.cpp create mode 100644 test/core/prepare_buffer.cpp diff --git a/CHANGELOG.md b/CHANGELOG.md index 95ec785e..73f6979c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ 1.0.0-b27 +* Tidy up tests and docs + API Changes: * Invoke callback on pings and pongs diff --git a/doc/master.qbk b/doc/master.qbk index d8155f2d..3b3389ec 100644 --- a/doc/master.qbk +++ b/doc/master.qbk @@ -29,15 +29,16 @@ [def __asio_handler_invoke__ [@http://www.boost.org/doc/libs/1_61_0/doc/html/boost_asio/reference/asio_handler_invoke.html `asio_handler_invoke`]] [def __asio_handler_allocate__ [@http://www.boost.org/doc/libs/1_61_0/doc/html/boost_asio/reference/asio_handler_allocate.html `asio_handler_allocate`]] -[def __void_or_deduced__ [@http://www.boost.org/doc/libs/1_60_0/doc/html/boost_asio/reference/asynchronous_operations.html#boost_asio.reference.asynchronous_operations.return_type_of_an_initiating_function ['void-or-deduced]]] +[def __void_or_deduced__ [@http://www.boost.org/doc/libs/1_61_0/doc/html/boost_asio/reference/asynchronous_operations.html#boost_asio.reference.asynchronous_operations.return_type_of_an_initiating_function ['void-or-deduced]]] [def __AsyncReadStream__ [@http://www.boost.org/doc/libs/1_61_0/doc/html/boost_asio/reference/AsyncReadStream.html [*AsyncReadStream]]] [def __AsyncWriteStream__ [@http://www.boost.org/doc/libs/1_61_0/doc/html/boost_asio/reference/AsyncWriteStream.html [*AsyncWriteStream]]] -[def __CompletionHandler__ [@http://www.boost.org/doc/libs/1_60_0/doc/html/boost_asio/reference/CompletionHandler.html [*CompletionHandler]]] +[def __CompletionHandler__ [@http://www.boost.org/doc/libs/1_61_0/doc/html/boost_asio/reference/CompletionHandler.html [*CompletionHandler]]] [def __ConstBufferSequence__ [@http://www.boost.org/doc/libs/1_61_0/doc/html/boost_asio/reference/ConstBufferSequence.html [*ConstBufferSequence]]] +[def __Handler__ [@http://www.boost.org/doc/libs/1_61_0/doc/html/boost_asio/reference/Handler.html [*Handler]]] [def __MutableBufferSequence__ [@http://www.boost.org/doc/libs/1_61_0/doc/html/boost_asio/reference/MutableBufferSequence.html [*MutableBufferSequence]]] [def __SyncReadStream__ [@http://www.boost.org/doc/libs/1_61_0/doc/html/boost_asio/reference/SyncReadStream.html [*SyncReadStream]]] -[def __SyncWriteStream__ [@http://www.boost.org/doc/libs/1_60_0/doc/html/boost_asio/reference/SyncWriteStream.html [*SyncWriteStream]]] +[def __SyncWriteStream__ [@http://www.boost.org/doc/libs/1_61_0/doc/html/boost_asio/reference/SyncWriteStream.html [*SyncWriteStream]]] [def __Body__ [link beast.ref.Body [*`Body`]]] [def __DynamicBuffer__ [link beast.ref.DynamicBuffer [*DynamicBuffer]]] diff --git a/doc/reference.xsl b/doc/reference.xsl index ffa66952..eab68147 100644 --- a/doc/reference.xsl +++ b/doc/reference.xsl @@ -1580,6 +1580,9 @@ class ``[link beast.ref.DynamicBuffer [*DynamicBuffer]]`` + + class __Handler__ + class __MutableBufferSequence__ diff --git a/include/beast/core/bind_handler.hpp b/include/beast/core/bind_handler.hpp index b01365e7..f45e95f1 100644 --- a/include/beast/core/bind_handler.hpp +++ b/include/beast/core/bind_handler.hpp @@ -15,21 +15,23 @@ namespace beast { -/** Bind parameters to a completion handler, creating a wrapped handler. +/** Bind parameters to a completion handler, creating a new handler. This function creates a new handler which, when invoked with no - parameters, calls the original handler with the list of bound arguments. - The passed handler and arguments are forwarded into the returned handler, - which provides the same `io_service` execution guarantees as the original - handler. + parameters, calls the original handler with the list of bound + arguments. The passed handler and arguments are forwarded into + the returned handler, which provides the same `io_service` + execution guarantees as the original handler. - Unlike `io_service::wrap`, the returned handler can be used in a - subsequent call to `io_service::post` instead of `io_service::dispatch`, - to ensure that the handler will not be invoked immediately by the - calling function. + Unlike `io_service::wrap`, the returned handler can be used in + a subsequent call to `io_service::post` instead of + `io_service::dispatch`, to ensure that the handler will not be + invoked immediately by the calling function. Example: + @code + template void do_cancel(AsyncReadStream& stream, ReadHandler&& handler) @@ -38,6 +40,7 @@ namespace beast { bind_handler(std::forward(handler), boost::asio::error::operation_aborted, 0)); } + @endcode @param handler The handler to wrap. @@ -45,22 +48,21 @@ namespace beast { @param args A list of arguments to bind to the handler. The arguments are forwarded into the returned object. */ -template +template #if GENERATING_DOCS implementation_defined #else detail::bound_handler< - typename std::decay::type, Args...> + typename std::decay::type, Args...> #endif -bind_handler(CompletionHandler&& handler, Args&&... args) +bind_handler(Handler&& handler, Args&&... args) { static_assert(is_CompletionHandler< - CompletionHandler, void(Args...)>::value, - "CompletionHandler requirements not met"); + Handler, void(Args...)>::value, + "Handler requirements not met"); return detail::bound_handler::type, Args...>(std::forward< - CompletionHandler>(handler), - std::forward(args)...); + Handler>::type, Args...>(std::forward< + Handler>(handler), std::forward(args)...); } } // beast diff --git a/include/beast/core/buffer_cat.hpp b/include/beast/core/buffer_cat.hpp index d8c24b44..939521b8 100644 --- a/include/beast/core/buffer_cat.hpp +++ b/include/beast/core/buffer_cat.hpp @@ -24,8 +24,9 @@ namespace beast { This function returns a constant or mutable buffer sequence which, when iterated, efficiently concatenates the input buffer sequences. Copies of the arguments passed will be made; however, the returned - object does not take ownership of the underlying memory. The application - is still responsible for managing the lifetime of the referenced memory. + object does not take ownership of the underlying memory. The + application is still responsible for managing the lifetime of the + referenced memory. @param buffers The list of buffer sequences to concatenate. diff --git a/include/beast/core/consuming_buffers.hpp b/include/beast/core/consuming_buffers.hpp index 87c3b841..2b78608f 100644 --- a/include/beast/core/consuming_buffers.hpp +++ b/include/beast/core/consuming_buffers.hpp @@ -30,12 +30,6 @@ namespace beast { is still responsible for managing its lifetime. @tparam BufferSequence The buffer sequence to wrap. - - @tparam ValueType The type of buffer of the final buffer sequence. This - can be different from the buffer type of the wrapped sequence. For - example, a `MutableBufferSequence` can be transformed into a - consumable `ConstBufferSequence`. Violations of buffer const safety - are not permitted, and will result in a compile error. */ template class consuming_buffers @@ -45,6 +39,7 @@ class consuming_buffers BufferSequence bs_; iter_type begin_; + iter_type end_; std::size_t skip_ = 0; template @@ -56,13 +51,23 @@ class consuming_buffers } public: - /// The type for each element in the list of buffers. + /** The type for each element in the list of buffers. + + If the buffers in the underlying sequence are convertible to + `boost::asio::mutable_buffer`, then this type will be + `boost::asio::mutable_buffer`, else this type will be + `boost::asio::const_buffer`. + */ +#if GENERATING_DOCS + using value_type = ...; +#else using value_type = typename std::conditional< std::is_convertible::value_type, boost::asio::mutable_buffer>::value, boost::asio::mutable_buffer, boost::asio::const_buffer>::type; +#endif #if GENERATING_DOCS /// A bidirectional iterator type that may be used to read elements. diff --git a/include/beast/core/detail/bind_handler.hpp b/include/beast/core/detail/bind_handler.hpp index f53b1efa..bbeee8f4 100644 --- a/include/beast/core/detail/bind_handler.hpp +++ b/include/beast/core/detail/bind_handler.hpp @@ -42,7 +42,8 @@ public: template explicit - bound_handler(DeducedHandler&& handler, Args&&... args) + bound_handler( + DeducedHandler&& handler, Args&&... args) : h_(std::forward(handler)) , args_(std::forward(args)...) { @@ -102,9 +103,11 @@ public: } // beast #include + namespace std { template -void bind(beast::detail::bound_handler< +void +bind(beast::detail::bound_handler< Handler, Args...>, ...) = delete; } // std diff --git a/include/beast/core/detail/is_call_possible.hpp b/include/beast/core/detail/is_call_possible.hpp index 247eb48f..a4c02f7b 100644 --- a/include/beast/core/detail/is_call_possible.hpp +++ b/include/beast/core/detail/is_call_possible.hpp @@ -26,8 +26,12 @@ std::false_type is_call_possible_test(C&& c, long, A&& ...a); /** Metafunction returns `true` if F callable as R(A...) + Example: + + @code is_call_possible + @endcode */ /** @{ */ template @@ -44,49 +48,6 @@ struct is_call_possible }; /** @} */ -namespace test { - -struct is_call_possible_udt1 -{ - void operator()(int) const; -}; - -struct is_call_possible_udt2 -{ - int operator()(int) const; -}; - -struct is_call_possible_udt3 -{ - int operator()(int); -}; - -#ifndef __INTELLISENSE__ -// VFALCO Fails to compile with Intellisense -static_assert(is_call_possible< - is_call_possible_udt1, void(int)>::value, ""); - -static_assert(! is_call_possible< - is_call_possible_udt1, void(void)>::value, ""); - -static_assert(is_call_possible< - is_call_possible_udt2, int(int)>::value, ""); - -static_assert(! is_call_possible< - is_call_possible_udt2, int(void)>::value, ""); - -static_assert(! is_call_possible< - is_call_possible_udt2, void(void)>::value, ""); - -static_assert(is_call_possible< - is_call_possible_udt3, int(int)>::value, ""); - -static_assert(! is_call_possible< - is_call_possible_udt3 const, int(int)>::value, ""); -#endif - -} // test - } // detail } // beast diff --git a/include/beast/core/dynabuf_readstream.hpp b/include/beast/core/dynabuf_readstream.hpp index 32c545cc..d01ec304 100644 --- a/include/beast/core/dynabuf_readstream.hpp +++ b/include/beast/core/dynabuf_readstream.hpp @@ -179,13 +179,7 @@ public: return sb_; } - /** Access the internal buffer. - - The internal buffer is returned. It is possible for the - caller to break invariants with this function. For example, - by causing the internal buffer size to increase beyond - the caller defined maximum. - */ + /// Access the internal buffer DynamicBuffer const& buffer() const { @@ -213,8 +207,83 @@ public: capacity_ = size; } - /// Write the given data to the stream. Returns the number of bytes written. - /// Throws an exception on failure. + /** Read some data from the stream. + + This function is used to read data from the stream. + The function call will block until one or more bytes of + data has been read successfully, or until an error occurs. + + @param buffers One or more buffers into which the data will be read. + + @return The number of bytes read. + + @throws system_error Thrown on failure. + */ + template + std::size_t + read_some(MutableBufferSequence const& buffers); + + /** Read some data from the stream. + + This function is used to read data from the stream. + The function call will block until one or more bytes of + data has been read successfully, or until an error occurs. + + @param buffers One or more buffers into which the data will be read. + + @param ec Set to the error, if any occurred. + + @return The number of bytes read, or 0 on error. + */ + template + std::size_t + read_some(MutableBufferSequence const& buffers, + error_code& ec); + + /** Start an asynchronous read. + + This function is used to asynchronously read data from + the stream. The function call always returns immediately. + + @param buffers One or more buffers into which the data + will be read. Although the buffers object may be copied + as necessary, ownership of the underlying memory blocks + is retained by the caller, which must guarantee that they + remain valid until the handler is called. + + @param handler The handler to be called when the operation + completes. Copies will be made of the handler as required. + The equivalent function signature of the handler must be: + @code void handler( + error_code const& error, // result of operation + std::size_t bytes_transferred // number of bytes transferred + ); @endcode + Regardless of whether the asynchronous operation completes + immediately or not, the handler will not be invoked from within + this function. Invocation of the handler will be performed in a + manner equivalent to using `boost::asio::io_service::post`. + */ + template +#if GENERATING_DOCS + void_or_deduced +#else + typename async_completion::result_type +#endif + async_read_some(MutableBufferSequence const& buffers, + ReadHandler&& handler); + + /** Write some data to the stream. + + This function is used to write data to the stream. + The function call will block until one or more bytes of the + data has been written successfully, or until an error occurs. + + @param buffers One or more data buffers to be written to the stream. + + @return The number of bytes written. + + @throws system_error Thrown on failure. + */ template std::size_t write_some(ConstBufferSequence const& buffers) @@ -224,8 +293,18 @@ public: return next_layer_.write_some(buffers); } - /// Write the given data to the stream. Returns the number of bytes written, - /// or 0 if an error occurred. + /** Write some data to the stream. + + This function is used to write data to the stream. + The function call will block until one or more bytes of the + data has been written successfully, or until an error occurs. + + @param buffers One or more data buffers to be written to the stream. + + @param ec Set to the error, if any occurred. + + @return The number of bytes written. + */ template std::size_t write_some(ConstBufferSequence const& buffers, @@ -236,8 +315,29 @@ public: return next_layer_.write_some(buffers, ec); } - /// Start an asynchronous write. The data being written must be valid for the - /// lifetime of the asynchronous operation. + /** Start an asynchronous write. + + This function is used to asynchronously write data from + the stream. The function call always returns immediately. + + @param buffers One or more data buffers to be written to + the stream. Although the buffers object may be copied as + necessary, ownership of the underlying memory blocks is + retained by the caller, which must guarantee that they + remain valid until the handler is called. + + @param handler The handler to be called when the operation + completes. Copies will be made of the handler as required. + The equivalent function signature of the handler must be: + @code void handler( + error_code const& error, // result of operation + std::size_t bytes_transferred // number of bytes transferred + ); @endcode + Regardless of whether the asynchronous operation completes + immediately or not, the handler will not be invoked from within + this function. Invocation of the handler will be performed in a + manner equivalent to using `boost::asio::io_service::post`. + */ template #if GENERATING_DOCS void_or_deduced @@ -246,30 +346,6 @@ public: #endif async_write_some(ConstBufferSequence const& buffers, WriteHandler&& handler); - - /// Read some data from the stream. Returns the number of bytes read. - /// Throws an exception on failure. - template - std::size_t - read_some(MutableBufferSequence const& buffers); - - /// Read some data from the stream. Returns the number of bytes read - /// or 0 if an error occurred. - template - std::size_t - read_some(MutableBufferSequence const& buffers, - error_code& ec); - - /// Start an asynchronous read. The buffer into which the data will be read - /// must be valid for the lifetime of the asynchronous operation. - template -#if GENERATING_DOCS - void_or_deduced -#else - typename async_completion::result_type -#endif - async_read_some(MutableBufferSequence const& buffers, - ReadHandler&& handler); }; } // beast diff --git a/include/beast/core/handler_alloc.hpp b/include/beast/core/handler_alloc.hpp index 814fee31..72974d8b 100644 --- a/include/beast/core/handler_alloc.hpp +++ b/include/beast/core/handler_alloc.hpp @@ -28,28 +28,29 @@ namespace beast { @tparam T The type of objects allocated by the allocator. - @tparam CompletionHandler The type of handler. + @tparam Handler The type of handler. @note Memory allocated by this allocator must be freed before - the handler is invoked or undefined behavior results. + the handler is invoked or undefined behavior results. This behavior + is described as the "deallocate before invocation" Asio guarantee. */ #if GENERATING_DOCS -template +template class handler_alloc; #else -template +template class handler_alloc { private: // We want a partial template specialization as a friend // but that isn't allowed so we friend all versions. This - // should produce a compile error if CompletionHandler is not + // should produce a compile error if Handler is not // constructible from H. // template friend class handler_alloc; - CompletionHandler& h_; + Handler& h_; public: using value_type = T; @@ -58,7 +59,7 @@ public: template struct rebind { - using other = handler_alloc; + using other = handler_alloc; }; handler_alloc() = delete; @@ -73,7 +74,7 @@ public: remain valid for at least the lifetime of the allocator. */ explicit - handler_alloc(CompletionHandler& h) + handler_alloc(Handler& h) : h_(h) { } @@ -81,7 +82,7 @@ public: /// Copy constructor template handler_alloc( - handler_alloc const& other) + handler_alloc const& other) : h_(other.h_) { } @@ -118,7 +119,7 @@ public: friend bool operator==(handler_alloc const& lhs, - handler_alloc const& rhs) + handler_alloc const& rhs) { return true; } @@ -127,9 +128,9 @@ public: friend bool operator!=(handler_alloc const& lhs, - handler_alloc const& rhs) + handler_alloc const& rhs) { - return !(lhs == rhs); + return ! (lhs == rhs); } }; #endif diff --git a/include/beast/core/placeholders.hpp b/include/beast/core/placeholders.hpp index 2ba1a7af..68b613fd 100644 --- a/include/beast/core/placeholders.hpp +++ b/include/beast/core/placeholders.hpp @@ -21,9 +21,9 @@ static auto const bytes_transferred (std::placeholders::_2); static auto const iterator (std::placeholders::_2); static auto const signal_number (std::placeholders::_2); } -} +} // placeholders -} -} +} // asio +} // beast #endif diff --git a/test/Jamfile b/test/Jamfile index 6b8c52c1..056aceac 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -28,6 +28,7 @@ unit-test core-tests : core/handler_concepts.cpp core/handler_ptr.cpp core/placeholders.cpp + core/prepare_buffer.cpp core/prepare_buffers.cpp core/static_streambuf.cpp core/static_string.cpp @@ -38,6 +39,7 @@ unit-test core-tests : core/base64.cpp core/empty_base_optimization.cpp core/get_lowest_layer.cpp + core/is_call_possible.cpp core/sha1.cpp ; diff --git a/test/core/CMakeLists.txt b/test/core/CMakeLists.txt index ad5aa722..2d575cd8 100644 --- a/test/core/CMakeLists.txt +++ b/test/core/CMakeLists.txt @@ -22,6 +22,7 @@ add_executable (core-tests handler_concepts.cpp handler_ptr.cpp placeholders.cpp + prepare_buffer.cpp prepare_buffers.cpp static_streambuf.cpp static_string.cpp @@ -32,6 +33,7 @@ add_executable (core-tests base64.cpp empty_base_optimization.cpp get_lowest_layer.cpp + is_call_possible.cpp sha1.cpp ) diff --git a/test/core/bind_handler.cpp b/test/core/bind_handler.cpp index 84c00973..5540eda7 100644 --- a/test/core/bind_handler.cpp +++ b/test/core/bind_handler.cpp @@ -16,15 +16,17 @@ namespace beast { class bind_handler_test : public unit_test::suite { public: - static void foo (int) + void + callback(int v) { + BEAST_EXPECT(v == 42); } void run() { - auto f (bind_handler ( - std::bind (&foo, std::placeholders::_1), - 42)); + auto f = bind_handler(std::bind( + &bind_handler_test::callback, this, + std::placeholders::_1), 42); f(); pass(); } diff --git a/test/core/handler_alloc.cpp b/test/core/handler_alloc.cpp index 620a409b..b1d3b32b 100644 --- a/test/core/handler_alloc.cpp +++ b/test/core/handler_alloc.cpp @@ -6,23 +6,44 @@ // // Test that header file is self-contained. -#include +#include #include -#include +#include namespace beast { -class to_string_test : public beast::unit_test::suite +class handler_alloc_test : public beast::unit_test::suite { public: - void run() + struct handler { - BEAST_EXPECT(to_string(boost::asio::const_buffers_1("x", 1)) == "x"); + void + operator()() const + { + } + }; + + void + run() override + { + handler h; + handler h2; + handler_alloc a1{h}; + handler_alloc a2{h2}; + BEAST_EXPECT(a2 == a1); + auto a3 = a1; + BEAST_EXPECT(a3 == a1); + { + std::vector> v(a1); + v.reserve(32); + v.resize(10); + } } }; -BEAST_DEFINE_TESTSUITE(to_string,core,beast); +BEAST_DEFINE_TESTSUITE(handler_alloc,core,beast); } // beast diff --git a/test/core/handler_ptr.cpp b/test/core/handler_ptr.cpp index 8cd2a8d6..8d6722ad 100644 --- a/test/core/handler_ptr.cpp +++ b/test/core/handler_ptr.cpp @@ -7,3 +7,74 @@ // Test that header file is self-contained. #include + +#include +#include +#include + +namespace beast { + +class handler_ptr_test : public beast::unit_test::suite +{ +public: + struct handler + { + handler() = default; + handler(handler const&) = default; + + void + operator()(bool& b) const + { + b = true; + } + }; + + struct T + { + T(handler&) + { + } + + ~T() + { + } + }; + + struct U + { + U(handler&) + { + throw std::exception{}; + } + }; + + void + run() override + { + handler h; + handler_ptr p1{h}; + handler_ptr p2{p1}; + try + { + handler_ptr p3{h}; + fail(); + } + catch(std::exception const&) + { + pass(); + } + catch(...) + { + fail(); + } + handler_ptr p4{std::move(h)}; + bool b = false; + p4.invoke(std::ref(b)); + BEAST_EXPECT(b); + } +}; + +BEAST_DEFINE_TESTSUITE(handler_ptr,core,beast); + +} // beast + diff --git a/test/core/is_call_possible.cpp b/test/core/is_call_possible.cpp new file mode 100644 index 00000000..401f8306 --- /dev/null +++ b/test/core/is_call_possible.cpp @@ -0,0 +1,56 @@ +// +// Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail 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) +// + +// Test that header file is self-contained. +#include + +namespace beast { +namespace detail { +namespace { + +struct is_call_possible_udt1 +{ + void operator()(int) const; +}; + +struct is_call_possible_udt2 +{ + int operator()(int) const; +}; + +struct is_call_possible_udt3 +{ + int operator()(int); +}; + +#ifndef __INTELLISENSE__ +// VFALCO Fails to compile with Intellisense +static_assert(is_call_possible< + is_call_possible_udt1, void(int)>::value, ""); + +static_assert(! is_call_possible< + is_call_possible_udt1, void(void)>::value, ""); + +static_assert(is_call_possible< + is_call_possible_udt2, int(int)>::value, ""); + +static_assert(! is_call_possible< + is_call_possible_udt2, int(void)>::value, ""); + +static_assert(! is_call_possible< + is_call_possible_udt2, void(void)>::value, ""); + +static_assert(is_call_possible< + is_call_possible_udt3, int(int)>::value, ""); + +static_assert(! is_call_possible< + is_call_possible_udt3 const, int(int)>::value, ""); +#endif + +} +} // detail +} // beast diff --git a/test/core/prepare_buffer.cpp b/test/core/prepare_buffer.cpp new file mode 100644 index 00000000..3ac53d25 --- /dev/null +++ b/test/core/prepare_buffer.cpp @@ -0,0 +1,9 @@ +// +// Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail 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) +// + +// Test that header file is self-contained. +#include diff --git a/test/core/to_string.cpp b/test/core/to_string.cpp index 660e643f..620a409b 100644 --- a/test/core/to_string.cpp +++ b/test/core/to_string.cpp @@ -8,3 +8,21 @@ // Test that header file is self-contained. #include +#include +#include + +namespace beast { + +class to_string_test : public beast::unit_test::suite +{ +public: + void run() + { + BEAST_EXPECT(to_string(boost::asio::const_buffers_1("x", 1)) == "x"); + } +}; + +BEAST_DEFINE_TESTSUITE(to_string,core,beast); + +} // beast +