]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/asio/test/local/connect_pair.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / asio / test / local / connect_pair.cpp
CommitLineData
7c673cae
FG
1//
2// connect_pair.cpp
3// ~~~~~~~~~~~~~~~~
4//
92f5a8d4 5// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7c673cae
FG
6//
7// Distributed under the Boost Software License, Version 1.0. (See accompanying
8// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9//
10
11// Disable autolinking for unit tests.
12#if !defined(BOOST_ALL_NO_LIB)
13#define BOOST_ALL_NO_LIB 1
14#endif // !defined(BOOST_ALL_NO_LIB)
15
16// Test that header file is self-contained.
17#include <boost/asio/local/connect_pair.hpp>
18
b32b8144 19#include <boost/asio/io_context.hpp>
7c673cae
FG
20#include <boost/asio/local/datagram_protocol.hpp>
21#include <boost/asio/local/stream_protocol.hpp>
22#include "../unit_test.hpp"
23
24//------------------------------------------------------------------------------
25
26// local_connect_pair_compile test
27// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28// The following test checks that all host_name functions compile and link
29// correctly. Runtime failures are ignored.
30
31namespace local_connect_pair_compile {
32
33void test()
34{
35#if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
36 using namespace boost::asio;
37 namespace local = boost::asio::local;
38 typedef local::datagram_protocol dp;
39 typedef local::stream_protocol sp;
40
41 try
42 {
b32b8144 43 boost::asio::io_context io_context;
7c673cae 44 boost::system::error_code ec1;
7c673cae 45
b32b8144
FG
46 dp::socket s1(io_context);
47 dp::socket s2(io_context);
7c673cae
FG
48 local::connect_pair(s1, s2);
49
b32b8144
FG
50 dp::socket s3(io_context);
51 dp::socket s4(io_context);
52 local::connect_pair(s3, s4, ec1);
7c673cae 53
b32b8144
FG
54 sp::socket s5(io_context);
55 sp::socket s6(io_context);
7c673cae
FG
56 local::connect_pair(s5, s6);
57
b32b8144
FG
58 sp::socket s7(io_context);
59 sp::socket s8(io_context);
60 local::connect_pair(s7, s8, ec1);
7c673cae
FG
61 }
62 catch (std::exception&)
63 {
64 }
65#endif // defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
66}
67
68} // namespace local_connect_pair_compile
69
70//------------------------------------------------------------------------------
71
72BOOST_ASIO_TEST_SUITE
73(
74 "local/connect_pair",
75 BOOST_ASIO_TEST_CASE(local_connect_pair_compile::test)
76)