• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // (c) Copyright Juergen Hunold 2012
2 // Use, modification and distribution is subject to the Boost Software
3 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 
6 #define BOOST_TEST_MODULE QtNetwork
7 
8 #include <QHostInfo>
9 
10 #include <QTextStream>
11 
12 #include <boost/test/unit_test.hpp>
13 
14 #include <iostream>
15 
BOOST_AUTO_TEST_CASE(defines)16 BOOST_AUTO_TEST_CASE (defines)
17 {
18     BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_CORE_LIB), true);
19     BOOST_CHECK_EQUAL(BOOST_IS_DEFINED(QT_NETWORK_LIB), true);
20 }
21 
BOOST_AUTO_TEST_CASE(hostname)22 BOOST_AUTO_TEST_CASE( hostname )
23 {
24     QHostInfo info(QHostInfo::fromName("www.boost.org")); //blocking lookup
25 
26     QTextStream stream(stdout, QIODevice::WriteOnly);
27 
28     Q_FOREACH(QHostAddress address, info.addresses())
29     {
30         BOOST_CHECK_EQUAL(address.isNull(), false);
31         stream << address.toString() << endl;
32     }
33 }
34