Improve and simplify code with modern C++ features

Change-Id: I83bf5513c2a1f90ba5a59e93c473306864b27d94
diff --git a/tests/daemon/face/factory-test-common.hpp b/tests/daemon/face/factory-test-common.hpp
index 7b7bdf6..f92d388 100644
--- a/tests/daemon/face/factory-test-common.hpp
+++ b/tests/daemon/face/factory-test-common.hpp
@@ -34,24 +34,6 @@
 namespace face {
 namespace tests {
 
-struct TestFaceParams : public FaceParams
-{
-  TestFaceParams(ndn::nfd::FacePersistency persistency,
-                 optional<time::nanoseconds> baseCongestionMarkingInterval,
-                 optional<uint64_t> defaultCongestionThreshold,
-                 bool wantLocalFields,
-                 bool wantLpReliability,
-                 boost::logic::tribool wantCongestionMarking) noexcept
-  {
-    this->persistency = persistency;
-    this->baseCongestionMarkingInterval = baseCongestionMarkingInterval;
-    this->defaultCongestionThreshold = defaultCongestionThreshold;
-    this->wantLocalFields = wantLocalFields;
-    this->wantLpReliability = wantLpReliability;
-    this->wantCongestionMarking = wantCongestionMarking;
-  }
-};
-
 struct CreateFaceExpectedResult
 {
   enum { FAILURE, SUCCESS } result;
@@ -63,7 +45,7 @@
 createFace(ProtocolFactory& factory,
            const FaceUri& remoteUri,
            const optional<FaceUri>& localUri,
-           const TestFaceParams& params,
+           const FaceParams& params,
            const CreateFaceExpectedResult& expected,
            const std::function<void(const Face&)>& extraChecks = nullptr)
 {
diff --git a/tests/daemon/face/generic-link-service.t.cpp b/tests/daemon/face/generic-link-service.t.cpp
index dfb048c..2192622 100644
--- a/tests/daemon/face/generic-link-service.t.cpp
+++ b/tests/daemon/face/generic-link-service.t.cpp
@@ -57,9 +57,9 @@
     : service(nullptr)
     , transport(nullptr)
   {
-    this->initialize(GenericLinkService::Options());
     // By default, GenericLinkService is created with default options.
     // Test cases may invoke .initialize with alternate options.
+    this->initialize({});
   }
 
   void
@@ -67,14 +67,14 @@
              ssize_t mtu = MTU_UNLIMITED,
              ssize_t sendQueueCapacity = QUEUE_UNSUPPORTED)
   {
-    face.reset(new Face(make_unique<GenericLinkService>(options),
-                        make_unique<DummyTransport>("dummy://",
-                                                    "dummy://",
-                                                    ndn::nfd::FACE_SCOPE_NON_LOCAL,
-                                                    ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-                                                    ndn::nfd::LINK_TYPE_POINT_TO_POINT,
-                                                    mtu,
-                                                    sendQueueCapacity)));
+    face = make_unique<Face>(make_unique<GenericLinkService>(options),
+                             make_unique<DummyTransport>("dummy://",
+                                                         "dummy://",
+                                                         ndn::nfd::FACE_SCOPE_NON_LOCAL,
+                                                         ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
+                                                         ndn::nfd::LINK_TYPE_POINT_TO_POINT,
+                                                         mtu,
+                                                         sendQueueCapacity));
     service = static_cast<GenericLinkService*>(face->getLinkService());
     transport = static_cast<DummyTransport*>(face->getTransport());
 
@@ -347,7 +347,7 @@
   lp::Packet packet(interest->wireEncode());
 
   // fragment the packet
-  LpFragmenter fragmenter;
+  LpFragmenter fragmenter({});
   size_t mtu = 100;
   bool isOk = false;
   std::vector<lp::Packet> frags;
diff --git a/tests/daemon/face/lp-fragmenter.t.cpp b/tests/daemon/face/lp-fragmenter.t.cpp
index 4bc7022..b3ee8d6 100644
--- a/tests/daemon/face/lp-fragmenter.t.cpp
+++ b/tests/daemon/face/lp-fragmenter.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015,  Regents of the University of California,
+/*
+ * Copyright (c) 2014-2018,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -33,14 +33,13 @@
 
 using namespace nfd::tests;
 
-BOOST_AUTO_TEST_SUITE(Face)
-
-class LpFragmenterFixture
+class LpFragmenterFixture : public BaseFixture
 {
-public:
-  LpFragmenter fragmenter;
+protected:
+  LpFragmenter fragmenter{{}};
 };
 
+BOOST_AUTO_TEST_SUITE(Face)
 BOOST_FIXTURE_TEST_SUITE(TestLpFragmenter, LpFragmenterFixture)
 
 BOOST_AUTO_TEST_CASE(FragmentSingleFragment)
diff --git a/tests/daemon/face/lp-reassembler.t.cpp b/tests/daemon/face/lp-reassembler.t.cpp
index 9cfa8dd..b1140d8 100644
--- a/tests/daemon/face/lp-reassembler.t.cpp
+++ b/tests/daemon/face/lp-reassembler.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016,  Regents of the University of California,
+/*
+ * Copyright (c) 2014-2018,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -40,13 +40,13 @@
   {
     reassembler.beforeTimeout.connect(
       [this] (Transport::EndpointId remoteEp, size_t nDroppedFragments) {
-        timeoutHistory.push_back(std::make_tuple(remoteEp, nDroppedFragments));
+        timeoutHistory.push_back({remoteEp, nDroppedFragments});
       });
   }
 
 protected:
-  LpReassembler reassembler;
-  std::vector<std::tuple<Transport::EndpointId, size_t>> timeoutHistory;
+  LpReassembler reassembler{{}};
+  std::vector<std::pair<Transport::EndpointId, size_t>> timeoutHistory;
 
   static const uint8_t data[10];
 };
diff --git a/tests/daemon/face/websocket-transport-fixture.hpp b/tests/daemon/face/websocket-transport-fixture.hpp
index 6fd8e70..374f922 100644
--- a/tests/daemon/face/websocket-transport-fixture.hpp
+++ b/tests/daemon/face/websocket-transport-fixture.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2017,  Regents of the University of California,
+ * Copyright (c) 2014-2018,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -110,7 +110,7 @@
 
     face = make_unique<Face>(
              make_unique<DummyReceiveLinkService>(),
-             make_unique<WebSocketTransport>(serverHdl, ref(server), pingInterval));
+             make_unique<WebSocketTransport>(serverHdl, std::ref(server), pingInterval));
     transport = static_cast<WebSocketTransport*>(face->getTransport());
     serverReceivedPackets = &static_cast<DummyReceiveLinkService*>(face->getLinkService())->receivedPackets;
 
diff --git a/tests/daemon/fw/topology-tester.cpp b/tests/daemon/fw/topology-tester.cpp
index fef3080..41d5d8c 100644
--- a/tests/daemon/fw/topology-tester.cpp
+++ b/tests/daemon/fw/topology-tester.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017,  Regents of the University of California,
+/*
+ * Copyright (c) 2014-2018,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -24,9 +24,10 @@
  */
 
 #include "topology-tester.hpp"
-#include <ndn-cxx/encoding/encoding-buffer-fwd.hpp>
 #include "face/generic-link-service.hpp"
 
+#include <ndn-cxx/encoding/encoding-buffer-fwd.hpp>
+
 namespace nfd {
 namespace fw {
 namespace tests {
@@ -247,8 +248,8 @@
 TopologyTester::addEchoProducer(ndn::Face& face, const Name& prefix)
 {
   face.setInterestFilter(prefix,
-      [&face] (const ndn::InterestFilter&, const Interest& interest) {
-        shared_ptr<Data> data = makeData(interest.getName());
+      [&face] (const auto&, const Interest& interest) {
+        auto data = makeData(interest.getName());
         face.put(*data);
       });
 }
@@ -266,12 +267,12 @@
     name.appendTimestamp();
   }
 
-  shared_ptr<Interest> interest = makeInterest(name);
+  auto interest = makeInterest(name);
   face.expressInterest(*interest, nullptr, nullptr, nullptr);
 
   if (n > 1) {
-    scheduler::schedule(interval, bind(&TopologyTester::addIntervalConsumer, this,
-                                       ref(face), prefix, interval, n - 1, seq));
+    scheduler::schedule(interval,
+                        [=, &face] { addIntervalConsumer(face, prefix, interval, n - 1, seq); });
   }
 }
 
diff --git a/tests/limited-io.cpp b/tests/limited-io.cpp
index 66a0946..9f8f4dc 100644
--- a/tests/limited-io.cpp
+++ b/tests/limited-io.cpp
@@ -56,8 +56,8 @@
 
   m_reason = NO_WORK;
   m_nOpsRemaining = nOpsLimit;
-  if (timeLimit >= time::nanoseconds::zero()) {
-    m_timeout = scheduler::schedule(timeLimit, bind(&LimitedIo::afterTimeout, this));
+  if (timeLimit >= 0_ns) {
+    m_timeout = scheduler::schedule(timeLimit, [this] { afterTimeout(); });
   }
 
   try {