Add make_strand

This commit is contained in:
Vinnie Falco
2019-02-19 16:23:30 -08:00
parent bc436da9c5
commit ac24e58fb3
7 changed files with 115 additions and 1 deletions
+1
View File
@@ -55,6 +55,7 @@ add_executable (tests-beast-core
flat_stream.cpp
handler_ptr.cpp
make_printable.cpp
make_strand.cpp
multi_buffer.cpp
ostream.cpp
read_size.cpp
+1
View File
@@ -43,6 +43,7 @@ local SOURCES =
flat_stream.cpp
handler_ptr.cpp
make_printable.cpp
make_strand.cpp
multi_buffer.cpp
ostream.cpp
read_size.cpp
+49
View File
@@ -0,0 +1,49 @@
//
// Copyright (c) 2016-2017 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 <boost/beast/core/make_strand.hpp>
#include <boost/beast/_experimental/unit_test/suite.hpp>
#include <boost/asio/executor.hpp>
#include <boost/asio/io_context.hpp>
namespace boost {
namespace beast {
class make_strand_test : public beast::unit_test::suite
{
public:
void
testFunction()
{
net::io_context ioc;
make_strand(ioc);
make_strand(ioc.get_executor());
make_strand(make_strand(ioc));
net::executor ex(ioc.get_executor());
make_strand(ex);
// this *should-not* compile
//make_strand(ex.context());
}
void
run() override
{
testFunction();
pass();
}
};
BEAST_DEFINE_TESTSUITE(beast,core,make_strand);
} // beast
} // boost