forked from boostorg/beast
Add make_strand
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user