1//
2// connect_pair.cpp
3// ~~~~~~~~~~~~~~~~
4//
5// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
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
19#include <boost/asio/io_service.hpp>
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 {
43 boost::asio::io_service io_service;
44 boost::system::error_code ec1;
45 boost::system::error_code ec2;
46
47 dp::socket s1(io_service);
48 dp::socket s2(io_service);
49 local::connect_pair(socket1&: s1, socket2&: s2);
50
51 dp::socket s3(io_service);
52 dp::socket s4(io_service);
53 ec1 = local::connect_pair(socket1&: s3, socket2&: s4, ec&: ec2);
54
55 sp::socket s5(io_service);
56 sp::socket s6(io_service);
57 local::connect_pair(socket1&: s5, socket2&: s6);
58
59 sp::socket s7(io_service);
60 sp::socket s8(io_service);
61 ec1 = local::connect_pair(socket1&: s7, socket2&: s8, ec&: ec2);
62 }
63 catch (std::exception&)
64 {
65 }
66#endif // defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
67}
68
69} // namespace local_connect_pair_compile
70
71//------------------------------------------------------------------------------
72
73BOOST_ASIO_TEST_SUITE
74(
75 "local/connect_pair",
76 BOOST_ASIO_TEST_CASE(local_connect_pair_compile::test)
77)
78

source code of boost/libs/asio/test/local/connect_pair.cpp