helper+tests: API change and test case improvements of FaceContainer

Change-Id: Idf0c15907b7492404b83c9eb78a4cbeb9c721951
diff --git a/tests/unit-tests/helper/ndn-face-container.t.cpp b/tests/unit-tests/helper/ndn-face-container.t.cpp
index 59df4b9..5d0800d 100644
--- a/tests/unit-tests/helper/ndn-face-container.t.cpp
+++ b/tests/unit-tests/helper/ndn-face-container.t.cpp
@@ -27,6 +27,8 @@
 #include "ns3/point-to-point-module.h"
 #include "ns3/ndnSIM-module.h"
 
+#include "NFD/daemon/face/null-face.hpp"
+
 #include "../tests-common.hpp"
 
 namespace ns3 {
@@ -34,25 +36,63 @@
 
 BOOST_FIXTURE_TEST_SUITE(HelperNdnFaceContainer, CleanupFixture)
 
+BOOST_AUTO_TEST_CASE(Basic)
+{
+  FaceContainer c1;
+  BOOST_CHECK_EQUAL(c1.GetN(), 0);
+
+  c1.Add(std::make_shared<nfd::NullFace>(FaceUri("null://1")));
+  BOOST_CHECK_EQUAL(c1.GetN(), 1);
+
+  c1.Add(std::make_shared<nfd::NullFace>(FaceUri("null://2")));
+  BOOST_CHECK_EQUAL(c1.GetN(), 2);
+
+  FaceContainer c2(c1);
+  BOOST_CHECK_EQUAL(c2.GetN(), c1.GetN());
+
+  FaceContainer c3;
+  BOOST_CHECK_EQUAL(c3.GetN(), 0);
+
+  c3 = c1;
+  BOOST_CHECK_EQUAL(c3.GetN(), c1.GetN());
+
+  for (size_t i = 0; i < c1.GetN(); ++i) {
+    BOOST_CHECK_EQUAL(c1.Get(i)->getLocalUri(), c2.Get(i)->getLocalUri());
+    BOOST_CHECK_EQUAL(c1.Get(i)->getLocalUri(), c3.Get(i)->getLocalUri());
+  }
+
+  size_t pos = 0;
+  for (FaceContainer::Iterator i = c1.Begin(); i != c1.End(); ++i, ++pos) {
+    BOOST_CHECK_EQUAL((*i)->getLocalUri(), c2.Get(pos)->getLocalUri());
+    BOOST_CHECK_EQUAL((*i)->getLocalUri(), c3.Get(pos)->getLocalUri());
+  }
+}
+
 BOOST_AUTO_TEST_CASE(AddAll)
 {
- NodeContainer nodes;
- nodes.Create(4);
+  FaceContainer c1;
+  c1.Add(std::make_shared<nfd::NullFace>(FaceUri("null://1")));
+  c1.Add(std::make_shared<nfd::NullFace>(FaceUri("null://2")));
 
- PointToPointHelper p2p;
- p2p.Install(nodes.Get(0), nodes.Get(1));
- p2p.Install(nodes.Get(0), nodes.Get(2));
- p2p.Install(nodes.Get(0), nodes.Get(3));
+  FaceContainer c2(c1);
+  c2.AddAll(c1);
+  BOOST_CHECK_EQUAL(c2.GetN(), 4);
 
- StackHelper ndnHelper;
- ndnHelper.SetDefaultRoutes(true);
+  FaceContainer c3(c1);
+  c3.AddAll(c3);
+  BOOST_CHECK_EQUAL(c3.GetN(), 4);
 
- Ptr<FaceContainer> a = ndnHelper.InstallAll();
- FaceContainer b;
- b.AddAll(a);
+  Ptr<FaceContainer> c4 = Create<FaceContainer>(c1);
+  c4->AddAll(c4);
 
- BOOST_CHECK_EQUAL_COLLECTIONS(a->Begin(), a->Begin() + a->GetN(),
-                               b.Begin(), b.End());
+  BOOST_CHECK_EQUAL_COLLECTIONS(c2.Begin(), c2.Begin() + c1.GetN(),
+                                c1.Begin(), c1.End());
+
+  BOOST_CHECK_EQUAL_COLLECTIONS(c2.Begin() + c1.GetN(), c2.End(),
+                                c1.Begin(), c1.End());
+
+  BOOST_CHECK_EQUAL_COLLECTIONS(c2.Begin(), c2.End(), c3.Begin(), c3.End());
+  BOOST_CHECK_EQUAL_COLLECTIONS(c2.Begin(), c2.End(), c4->Begin(), c4->End());
 }
 
 BOOST_AUTO_TEST_SUITE_END()