blob: bdfd21fba180d69f333060c9f94375caa18fc951 [file] [log] [blame]
Davide Pesavento248d6bd2014-03-09 10:24:08 +01001/* -*- 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
12namespace nfd {
13namespace tests {
14
15BOOST_FIXTURE_TEST_SUITE(CoreNetworkInterface, BaseFixture)
16
17BOOST_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
36BOOST_AUTO_TEST_SUITE_END()
37
38} // namespace tests
39} // namespace nfd