Yuanzhi Gao | dd516fe | 2015-04-23 04:18:24 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (c) 2011-2015 Regents of the University of California. |
| 4 | * |
| 5 | * This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and |
| 6 | * contributors. |
| 7 | * |
| 8 | * ndnSIM is free software: you can redistribute it and/or modify it under the terms |
| 9 | * of the GNU General Public License as published by the Free Software Foundation, |
| 10 | * either version 3 of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * ndnSIM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 13 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 14 | * PURPOSE. See the GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License along with |
| 17 | * ndnSIM, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 18 | **/ |
| 19 | |
| 20 | #include "helper/ndn-face-container.hpp" |
| 21 | |
| 22 | #include "ns3/node-container.h" |
| 23 | #include "ns3/point-to-point-net-device.h" |
| 24 | #include "ns3/node.h" |
| 25 | #include "ns3/core-module.h" |
| 26 | #include "ns3/network-module.h" |
| 27 | #include "ns3/point-to-point-module.h" |
| 28 | #include "ns3/ndnSIM-module.h" |
| 29 | |
| 30 | #include "../tests-common.hpp" |
| 31 | |
| 32 | namespace ns3 { |
| 33 | namespace ndn { |
| 34 | |
| 35 | BOOST_FIXTURE_TEST_SUITE(HelperNdnFaceContainer, CleanupFixture) |
| 36 | |
| 37 | BOOST_AUTO_TEST_CASE(AddAll) |
| 38 | { |
| 39 | NodeContainer nodes; |
| 40 | nodes.Create(4); |
| 41 | |
| 42 | PointToPointHelper p2p; |
| 43 | p2p.Install(nodes.Get(0), nodes.Get(1)); |
| 44 | p2p.Install(nodes.Get(0), nodes.Get(2)); |
| 45 | p2p.Install(nodes.Get(0), nodes.Get(3)); |
| 46 | |
| 47 | StackHelper ndnHelper; |
| 48 | ndnHelper.SetDefaultRoutes(true); |
| 49 | |
| 50 | Ptr<FaceContainer> a = ndnHelper.InstallAll(); |
| 51 | FaceContainer b; |
| 52 | b.AddAll(a); |
| 53 | |
| 54 | BOOST_CHECK_EQUAL_COLLECTIONS(a->Begin(), a->Begin() + a->GetN(), |
| 55 | b.Begin(), b.End()); |
| 56 | } |
| 57 | |
| 58 | BOOST_AUTO_TEST_SUITE_END() |
| 59 | |
| 60 | } // namespace ndn |
| 61 | } // namespace ns3 |