// // Copyright (c) 2018 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) // // Official repository: https://github.com/boostorg/beast // // Test that header file is self-contained. #include #include "stream_tests.hpp" #include #include namespace boost { namespace beast { class stranded_stream_test : public beast::unit_test::suite { public: using tcp = net::ip::tcp; void testStream() { net::io_context ioc; { using ex_t = net::io_context::executor_type; auto ex = ioc.get_executor(); stranded_stream s1(ioc); stranded_stream s2(ex); stranded_stream s3(ioc, tcp::v4()); stranded_stream s4(std::move(s1)); s2.next_layer() = tcp::socket(ioc); BEAST_EXPECT(s1.get_executor() == ex); BEAST_EXPECT(s2.get_executor() == ex); BEAST_EXPECT(s3.get_executor() == ex); BEAST_EXPECT(s4.get_executor() == ex); } { using ex_t = net::io_context::strand; auto ex = ex_t{ioc}; stranded_stream s1(ex); stranded_stream s2(ex, tcp::v4()); stranded_stream s3(std::move(s1)); s2.next_layer() = tcp::socket(ioc); BEAST_EXPECT(s1.get_executor() == ex); BEAST_EXPECT(s2.get_executor() == ex); BEAST_EXPECT(s3.get_executor() == ex); } { using ex_t = net::io_context::executor_type; test_sync_stream>(); test_async_stream>(); } } void testJavadocs() { } //-------------------------------------------------------------------------- void run() { testStream(); testJavadocs(); pass(); } }; BEAST_DEFINE_TESTSUITE(beast,core,stranded_stream); } // beast } // boost