Minor code cleanups

Change-Id: I2b67216754ba30563a65a2697e6801e363986da1
diff --git a/tests/test-consumer.cpp b/tests/test-consumer.cpp
index 373a8ca..79ee495 100644
--- a/tests/test-consumer.cpp
+++ b/tests/test-consumer.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020,  The University of Memphis
+ * Copyright (c) 2014-2022,  The University of Memphis
  *
  * This file is part of PSync.
  * See AUTHORS.md for complete list of PSync authors and contributors.
@@ -22,7 +22,6 @@
 #include "tests/boost-test.hpp"
 #include "tests/io-fixture.hpp"
 
-#include <ndn-cxx/name.hpp>
 #include <ndn-cxx/util/dummy-client-face.hpp>
 
 namespace psync {
@@ -31,18 +30,9 @@
 
 BOOST_AUTO_TEST_SUITE(TestConsumer)
 
-BOOST_AUTO_TEST_CASE(Constructor)
-{
-  util::DummyClientFace face({true, true});
-  BOOST_REQUIRE_NO_THROW(Consumer(Name("/psync"), face,
-                                  [] (const auto&) {},
-                                  [] (const auto&) {},
-                                  40, 0.001));
-}
-
 BOOST_AUTO_TEST_CASE(AddSubscription)
 {
-  util::DummyClientFace face({true, true});
+  util::DummyClientFace face;
   Consumer consumer(Name("/psync"), face,
                     [] (const auto&) {},
                     [] (const auto&) {},
@@ -57,7 +47,7 @@
 
 BOOST_FIXTURE_TEST_CASE(ConstantTimeoutForFirstSegment, tests::IoFixture)
 {
-  util::DummyClientFace face(m_io, {true, true});
+  util::DummyClientFace face(m_io);
   Consumer consumer(Name("/psync"), face,
                     [] (const auto&) {},
                     [] (const auto&) {},
diff --git a/tests/test-full-sync.cpp b/tests/test-full-sync.cpp
index 81a4aef..e0b9bc9 100644
--- a/tests/test-full-sync.cpp
+++ b/tests/test-full-sync.cpp
@@ -41,18 +41,18 @@
   {
     BOOST_ASSERT(id >= 0 && id < MAX_NODES);
     userPrefixes[id] = "/userPrefix" + std::to_string(id);
-    faces[id] = std::make_shared<util::DummyClientFace>(m_io, m_keyChain,
+    faces[id] = std::make_unique<util::DummyClientFace>(m_io, m_keyChain,
                                                         util::DummyClientFace::Options{true, true});
-    nodes[id] = std::make_shared<FullProducer>(*faces[id], m_keyChain, 40, syncPrefix, userPrefixes[id],
+    nodes[id] = std::make_unique<FullProducer>(*faces[id], m_keyChain, 40, syncPrefix, userPrefixes[id],
                                                [] (const auto&) {});
   }
 
   void
   clearNodes()
   {
-    faces.fill(nullptr);
-    userPrefixes.fill(Name());
-    nodes.fill(nullptr);
+    nodes = {};
+    faces = {};
+    userPrefixes = {};
   }
 
   /**
@@ -60,8 +60,8 @@
    * @param id update originator node index.
    * @param i user prefix index.
    */
-  Name
-  makeSubPrefix(int id, int i) const
+  static Name
+  makeSubPrefix(int id, int i)
   {
     return "/userNode" + std::to_string(id) + "-" + std::to_string(i);
   }
@@ -141,15 +141,16 @@
    * @param maxTotalUpdates maximum totalUpdates parameter.
    * @param f test function.
    *
-   * This method searches for totalUpdates∈[minTotalUpdates,maxTotalUpdates] until there is
-   * at least one execution that caused an IBF decode failure above threshold.
-   * If such an execution is never achieved within the range, fail the test case.
+   * This method searches for totalUpdates ∈ [minTotalUpdates,maxTotalUpdates] until
+   * there is at least one execution that caused an IBF decode failure above threshold.
+   * If such an execution never occurs within the range, the test case fails.
    *
    * Current FullSync logic cannot reliably recover from an IBF decode failure below threshold.
    * Hence, that condition is not tested.
    */
   void
-  searchIbfDecodeFailures(int minTotalUpdates, int maxTotalUpdates, std::function<void(int totalUpdates)> f)
+  searchIbfDecodeFailures(int minTotalUpdates, int maxTotalUpdates,
+                          const std::function<void(int totalUpdates)>& f)
   {
     bool hasAboveThreshold = false;
     for (int totalUpdates = minTotalUpdates; totalUpdates <= maxTotalUpdates; ++totalUpdates) {
@@ -173,8 +174,8 @@
   const Name syncPrefix = "/psync";
   static constexpr int MAX_NODES = 4;
   std::array<Name, MAX_NODES> userPrefixes;
-  std::array<std::shared_ptr<util::DummyClientFace>, MAX_NODES> faces;
-  std::array<std::shared_ptr<FullProducer>, MAX_NODES> nodes;
+  std::array<std::unique_ptr<util::DummyClientFace>, MAX_NODES> faces;
+  std::array<std::unique_ptr<FullProducer>, MAX_NODES> nodes;
   static constexpr uint64_t NOT_EXIST = std::numeric_limits<uint64_t>::max();
 };
 
@@ -466,7 +467,7 @@
 
   int i = 0;
   detail::State state;
-  std::shared_ptr<ndn::Buffer> compressed;
+  std::shared_ptr<Buffer> compressed;
   do {
     auto prefixToPublish = makeSubPrefix(0, i++);
     nodes[0]->addUserNode(prefixToPublish);
@@ -476,7 +477,7 @@
 
     auto block = state.wireEncode();
     compressed = detail::compress(nodes[0]->m_contentCompression, block);
-  } while (compressed->size() < (ndn::MAX_NDN_PACKET_SIZE >> 1));
+  } while (compressed->size() < (MAX_NDN_PACKET_SIZE >> 1));
 
   advanceClocks(10_ms, 100);
 
@@ -484,7 +485,7 @@
   detail::IBLT iblt(40, nodes[0]->m_ibltCompression);
   iblt.appendToName(syncInterestName);
 
-  nodes[0]->onSyncInterest(syncPrefix, ndn::Interest(syncInterestName));
+  nodes[0]->onSyncInterest(syncPrefix, Interest(syncInterestName));
 
   advanceClocks(10_ms);
 
@@ -500,7 +501,7 @@
   interestName.appendSegment(1);
   faces[0]->sentData.clear();
 
-  nodes[0]->onSyncInterest(syncPrefix, ndn::Interest(interestName));
+  nodes[0]->onSyncInterest(syncPrefix, Interest(interestName));
   advanceClocks(10_ms);
 
   // Should have repopulated SegmentPublisher
diff --git a/tests/test-partial-sync.cpp b/tests/test-partial-sync.cpp
index d7a0b4f..801d061 100644
--- a/tests/test-partial-sync.cpp
+++ b/tests/test-partial-sync.cpp
@@ -24,7 +24,7 @@
 #include "tests/io-fixture.hpp"
 #include "tests/key-chain-fixture.hpp"
 
-#include <ndn-cxx/name.hpp>
+#include <array>
 #include <ndn-cxx/util/dummy-client-face.hpp>
 
 namespace psync {
@@ -33,10 +33,10 @@
 
 class PartialSyncFixture : public tests::IoFixture, public tests::KeyChainFixture
 {
-public:
+protected:
   PartialSyncFixture()
   {
-    producer = make_shared<PartialProducer>(face, m_keyChain, 40, syncPrefix, userPrefix);
+    producer = std::make_unique<PartialProducer>(face, m_keyChain, 40, syncPrefix, userPrefix);
     addUserNodes("testUser", 10);
   }
 
@@ -52,13 +52,13 @@
   void
   addConsumer(int id, const std::vector<std::string>& subscribeTo, bool linkToProducer = true)
   {
-    consumerFaces[id] = std::make_shared<util::DummyClientFace>(m_io, m_keyChain,
+    consumerFaces[id] = std::make_unique<util::DummyClientFace>(m_io, m_keyChain,
                                                                 util::DummyClientFace::Options{true, true});
     if (linkToProducer) {
       face.linkTo(*consumerFaces[id]);
     }
 
-    consumers[id] = std::make_shared<Consumer>(syncPrefix, *consumerFaces[id],
+    consumers[id] = std::make_unique<Consumer>(syncPrefix, *consumerFaces[id],
                       [&, id] (const auto& availableSubs) {
                         numHelloDataRcvd++;
                         BOOST_CHECK(checkSubList(availableSubs));
@@ -133,14 +133,14 @@
 
 protected:
   util::DummyClientFace face{m_io, m_keyChain, {true, true}};
-  Name syncPrefix{"psync"};
-  Name userPrefix{"testUser-0"};
+  const Name syncPrefix{"psync"};
+  const Name userPrefix{"testUser-0"};
 
-  shared_ptr<PartialProducer> producer;
+  std::unique_ptr<PartialProducer> producer;
   std::map<Name, uint64_t> oldSeqMap;
 
-  shared_ptr<Consumer> consumers[3];
-  shared_ptr<util::DummyClientFace> consumerFaces[3];
+  std::array<std::unique_ptr<Consumer>, 3> consumers;
+  std::array<std::unique_ptr<util::DummyClientFace>, 3> consumerFaces;
   int numHelloDataRcvd = 0;
   int numSyncDataRcvd = 0;
 };
@@ -292,7 +292,7 @@
   util::DummyClientFace face2(m_io, m_keyChain, {true, true});
   PartialProducer replicatedProducer(face2, m_keyChain, 40, syncPrefix, userPrefix);
   for (int i = 1; i < 10; i++) {
-      replicatedProducer.addUserNode("testUser-" + std::to_string(i));
+    replicatedProducer.addUserNode("testUser-" + std::to_string(i));
   }
   advanceClocks(ndn::time::milliseconds(10));
   replicatedProducer.publishName("testUser-2");