name-prefix-list: delete unused methods and cleanup tests

Unit tests for NamePrefixList type are deduplicated. This allows
deleting countSources() method and NamePair type, which were used
sparsely in the unit tests and not needed by the rest of the codebase.

refs #4094

Change-Id: Id5a6e6b90f863dfeef2ed71e67a9823d84088a48
diff --git a/src/name-prefix-list.cpp b/src/name-prefix-list.cpp
index 5af7062..0323896 100644
--- a/src/name-prefix-list.cpp
+++ b/src/name-prefix-list.cpp
@@ -26,7 +26,7 @@
 
 NamePrefixList::NamePrefixList() = default;
 
-NamePrefixList::NamePrefixList(ndn::span<const ndn::Name> names)
+NamePrefixList::NamePrefixList(std::initializer_list<ndn::Name> names)
 {
   for (const auto& name : names) {
     insert(name);
@@ -65,35 +65,26 @@
   return names;
 }
 
-uint32_t
-NamePrefixList::countSources(const ndn::Name& name) const
-{
-  return getSources(name).size();
-}
+#ifdef WITH_TESTS
 
-const std::vector<std::string>
+std::set<std::string>
 NamePrefixList::getSources(const ndn::Name& name) const
 {
-  auto it = m_namesSources.find(name);
-  if (it == m_namesSources.end()) {
-    return {};
+  if (auto it = m_namesSources.find(name); it != m_namesSources.end()) {
+    return it->second;
   }
-
-  std::vector<std::string> result;
-  for (const auto& source : it->second) {
-    result.push_back(source);
-  }
-  return result;
+  return {};
 }
 
+#endif
+
 std::ostream&
 operator<<(std::ostream& os, const NamePrefixList& list)
 {
   os << "Name prefix list: {\n";
-  for (const auto& name : list.getNames()) {
-    os << name << "\n"
-       << "Sources:\n";
-    for (const auto& source : list.getSources(name)) {
+  for (const auto& [name, sources] : list.m_namesSources) {
+    os << name << "\nSources:\n";
+    for (const auto& source : sources) {
       os << "  " << source << "\n";
     }
   }