Davide Pesavento | 248d6bd | 2014-03-09 10:24:08 +0100 | [diff] [blame^] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (C) 2014 Named Data Networking Project |
| 4 | * See COPYING for copyright and distribution information. |
| 5 | */ |
| 6 | |
| 7 | #include "core/network-interface.hpp" |
| 8 | #include "tests/test-common.hpp" |
| 9 | |
| 10 | #include <boost/foreach.hpp> |
| 11 | |
| 12 | namespace nfd { |
| 13 | namespace tests { |
| 14 | |
| 15 | BOOST_FIXTURE_TEST_SUITE(CoreNetworkInterface, BaseFixture) |
| 16 | |
| 17 | BOOST_AUTO_TEST_CASE(ListNetworkInterfaces) |
| 18 | { |
| 19 | std::list< shared_ptr<NetworkInterfaceInfo> > netifs; |
| 20 | BOOST_CHECK_NO_THROW(netifs = listNetworkInterfaces()); |
| 21 | |
| 22 | BOOST_FOREACH(shared_ptr<NetworkInterfaceInfo> netif, netifs) |
| 23 | { |
| 24 | BOOST_TEST_MESSAGE(netif->index << ": " << netif->name); |
| 25 | BOOST_TEST_MESSAGE("\tether " << netif->etherAddress); |
| 26 | BOOST_FOREACH(boost::asio::ip::address_v4 address, netif->ipv4Addresses) |
| 27 | BOOST_TEST_MESSAGE("\tinet " << address); |
| 28 | BOOST_FOREACH(boost::asio::ip::address_v6 address, netif->ipv6Addresses) |
| 29 | BOOST_TEST_MESSAGE("\tinet6 " << address); |
| 30 | BOOST_TEST_MESSAGE("\tloopback : " << netif->isLoopback()); |
| 31 | BOOST_TEST_MESSAGE("\tmulticast : " << netif->isMulticastCapable()); |
| 32 | BOOST_TEST_MESSAGE("\tup : " << netif->isUp()); |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | BOOST_AUTO_TEST_SUITE_END() |
| 37 | |
| 38 | } // namespace tests |
| 39 | } // namespace nfd |