]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // |
2 | // host_name.cpp | |
3 | // ~~~~~~~~~~~~~ | |
4 | // | |
b32b8144 | 5 | // Copyright (c) 2003-2017 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/ip/host_name.hpp> | |
18 | ||
19 | #include "../unit_test.hpp" | |
20 | ||
21 | //------------------------------------------------------------------------------ | |
22 | ||
23 | // ip_host_name_compile test | |
24 | // ~~~~~~~~~~~~~~~~~~~~~~~~~ | |
25 | // The following test checks that all host_name functions compile and link | |
26 | // correctly. Runtime failures are ignored. | |
27 | ||
28 | namespace ip_host_name_compile { | |
29 | ||
30 | void test() | |
31 | { | |
32 | using namespace boost::asio; | |
33 | namespace ip = boost::asio::ip; | |
34 | ||
35 | try | |
36 | { | |
37 | boost::system::error_code ec; | |
38 | ||
39 | std::string host_name = ip::host_name(); | |
40 | std::string host_name2 = ip::host_name(ec); | |
41 | } | |
42 | catch (std::exception&) | |
43 | { | |
44 | } | |
45 | } | |
46 | ||
47 | } // namespace ip_host_name_compile | |
48 | ||
49 | //------------------------------------------------------------------------------ | |
50 | ||
51 | BOOST_ASIO_TEST_SUITE | |
52 | ( | |
53 | "ip/host_name", | |
54 | BOOST_ASIO_TEST_CASE(ip_host_name_compile::test) | |
55 | ) |