blob: cbc0e8a8aa892dbf57b607a448f87ca0f02f322e [file] [log] [blame]
Alexander Afanasyeve6c65e22015-01-28 19:56:03 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Davide Pesavento537dc3a2016-02-18 19:35:26 +01003 * Copyright (c) 2013-2016 Regents of the University of California.
Alexander Afanasyeve6c65e22015-01-28 19:56:03 -08004 *
5 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6 *
7 * ndn-cxx library is free software: you can redistribute it and/or modify it under the
8 * terms of the GNU Lesser General Public License as published by the Free Software
9 * Foundation, either version 3 of the License, or (at your option) any later version.
10 *
11 * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14 *
15 * You should have received copies of the GNU General Public License and GNU Lesser
16 * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20 */
21
22#define BOOST_TEST_MAIN 1
23#define BOOST_TEST_DYN_LINK 1
24#define BOOST_TEST_MODULE ndn-cxx Integrated Tests (Network Monitor)
25
26#include "util/network-monitor.hpp"
27
Alexander Afanasyeve6c65e22015-01-28 19:56:03 -080028#include "util/time.hpp"
29
Davide Pesavento537dc3a2016-02-18 19:35:26 +010030#include "boost-test.hpp"
31
32#include <boost/asio/io_service.hpp>
33#include <iostream>
34
Alexander Afanasyeve6c65e22015-01-28 19:56:03 -080035namespace ndn {
36namespace util {
37
38BOOST_AUTO_TEST_SUITE(UtilNetworkMonitor)
39
40BOOST_AUTO_TEST_CASE(Basic)
41{
42 boost::asio::io_service io;
43 BOOST_REQUIRE_NO_THROW((NetworkMonitor(io)));
44
45 NetworkMonitor monitor(io);
46
47 monitor.onNetworkStateChanged.connect([] {
48 std::cout << time::toString(time::system_clock::now())
49 << "\tReceived network state change event" << std::endl;
50 });
51
52 io.run();
53}
54
55BOOST_AUTO_TEST_SUITE_END()
56
57} // namespace util
58} // namespace ndn