Refactor and modernize namespace declarations
* Completely remove inline namespace v2
* Flatten some unnecessarily deep namespace nesting
* Move DummyClientFace, Segmenter, SegmentFetcher to namespace ndn
* Move all unit tests to namespace ndn::tests
Change-Id: I8bcfcf9fd669936a3277d2d5d505f765b4b05742
diff --git a/tests/unit/util/concepts.t.cpp b/tests/unit/util/concepts.t.cpp
index 997f86a..74feee7 100644
--- a/tests/unit/util/concepts.t.cpp
+++ b/tests/unit/util/concepts.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018 Regents of the University of California,
+ * Copyright (c) 2014-2023 Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -27,8 +27,7 @@
#include "ndn-cxx/util/concepts.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
class WireEncodableType
{
@@ -57,5 +56,4 @@
};
BOOST_CONCEPT_ASSERT((WireDecodable<WireDecodableType>));
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/config-file.t.cpp b/tests/unit/util/config-file.t.cpp
index 9e098c1..ab8f212 100644
--- a/tests/unit/util/config-file.t.cpp
+++ b/tests/unit/util/config-file.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,8 +27,7 @@
#include <boost/filesystem/operations.hpp>
#include <cstdlib>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Util)
BOOST_FIXTURE_TEST_SUITE(TestConfigFile, TestHomeEnvSaver)
@@ -67,5 +66,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestConfigFile
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/dummy-client-face.t.cpp b/tests/unit/util/dummy-client-face.t.cpp
index ad0c3bf..0eea2e6 100644
--- a/tests/unit/util/dummy-client-face.t.cpp
+++ b/tests/unit/util/dummy-client-face.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,11 +25,7 @@
#include "tests/test-common.hpp"
#include "tests/unit/io-key-chain-fixture.hpp"
-namespace ndn {
-namespace util {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Util)
BOOST_FIXTURE_TEST_SUITE(TestDummyClientFace, IoKeyChainFixture)
@@ -107,13 +103,13 @@
[&] (const InterestFilter&, const Interest& interest) {
BOOST_CHECK_EQUAL(interest.getName(), "/face1/data");
nFace1Interest++;
- face1.put(ndn::tests::makeNack(interest, lp::NackReason::NO_ROUTE));
+ face1.put(makeNack(interest, lp::NackReason::NO_ROUTE));
}, nullptr, nullptr);
face2.setInterestFilter("/face2",
[&] (const InterestFilter&, const Interest& interest) {
BOOST_CHECK_EQUAL(interest.getName(), "/face2/data");
nFace2Interest++;
- face2.put(*ndn::tests::makeData("/face2/data"));
+ face2.put(*makeData("/face2/data"));
return;
}, nullptr, nullptr);
@@ -175,6 +171,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestDummyClientFace
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/exception.t.cpp b/tests/unit/util/exception.t.cpp
index 49ac2ab..d8184c5 100644
--- a/tests/unit/util/exception.t.cpp
+++ b/tests/unit/util/exception.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,9 +26,7 @@
#include <boost/exception/diagnostic_information.hpp>
#include <boost/exception/get_error_info.hpp>
-namespace ndn {
-namespace exception {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestException)
@@ -50,7 +48,7 @@
BOOST_CHECK(boost::get_error_info<boost::throw_function>(ex) != nullptr);
#ifdef NDN_CXX_HAVE_STACKTRACE
- auto stack = boost::get_error_info<errinfo_stacktrace>(ex);
+ auto stack = boost::get_error_info<ndn::exception::errinfo_stacktrace>(ex);
BOOST_REQUIRE(stack != nullptr);
auto info = boost::diagnostic_information(ex);
BOOST_TEST_MESSAGE(info);
@@ -106,6 +104,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestException
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace exception
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/indented-stream.t.cpp b/tests/unit/util/indented-stream.t.cpp
index 91da1e3..4994d0d 100644
--- a/tests/unit/util/indented-stream.t.cpp
+++ b/tests/unit/util/indented-stream.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -25,11 +25,10 @@
#include <boost/test/tools/output_test_stream.hpp>
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
using boost::test_tools::output_test_stream;
+using ndn::util::IndentedStream;
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestIndentedStream)
@@ -77,6 +76,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestIndentedStream
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/io.t.cpp b/tests/unit/util/io.t.cpp
index 9658d04..934648a 100644
--- a/tests/unit/util/io.t.cpp
+++ b/tests/unit/util/io.t.cpp
@@ -27,8 +27,7 @@
#include <boost/filesystem.hpp>
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestIo)
@@ -398,5 +397,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestIo
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/log-filter-module.cpp b/tests/unit/util/log-filter-module.cpp
index ab55728..371b7d6 100644
--- a/tests/unit/util/log-filter-module.cpp
+++ b/tests/unit/util/log-filter-module.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,9 +23,7 @@
NDN_LOG_INIT(fm.FilterModule);
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
void
logFromFilterModule()
@@ -38,7 +36,5 @@
NDN_LOG_FATAL("fatalFM");
}
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/log-module1.cpp b/tests/unit/util/log-module1.cpp
index 4f71102..2070c58 100644
--- a/tests/unit/util/log-module1.cpp
+++ b/tests/unit/util/log-module1.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,9 +23,7 @@
NDN_LOG_INIT(Module1);
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
void
logFromModule1()
@@ -38,6 +36,4 @@
NDN_LOG_FATAL("fatal" << 1);
}
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/log-module2.cpp b/tests/unit/util/log-module2.cpp
index 994e142..6565488 100644
--- a/tests/unit/util/log-module2.cpp
+++ b/tests/unit/util/log-module2.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,9 +23,7 @@
NDN_LOG_INIT(Module2);
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
void
logFromModule2()
@@ -38,6 +36,4 @@
NDN_LOG_FATAL("fatal" << 2);
}
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/logger.t.cpp b/tests/unit/util/logger.t.cpp
index ad742bb..70ba72f 100644
--- a/tests/unit/util/logger.t.cpp
+++ b/tests/unit/util/logger.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2018 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,9 +24,11 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::util::Logger;
+using ndn::util::Logging;
+using ndn::util::LogLevel;
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestLogger)
@@ -77,6 +79,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestLogger
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/logging.t.cpp b/tests/unit/util/logging.t.cpp
index 02da03a..937b41b 100644
--- a/tests/unit/util/logging.t.cpp
+++ b/tests/unit/util/logging.t.cpp
@@ -27,11 +27,13 @@
#include <boost/test/tools/output_test_stream.hpp>
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
-NDN_LOG_INIT(ndn.util.tests.Logging);
+using ndn::util::Logger;
+using ndn::util::Logging;
+using ndn::util::LogLevel;
+
+NDN_LOG_INIT(ndn.tests.Logging);
void
logFromModule1();
@@ -60,7 +62,7 @@
namespace ns1 {
-NDN_LOG_INIT(ndn.util.tests.ns1);
+NDN_LOG_INIT(ndn.tests.ns1);
static void
logFromNamespace1()
@@ -72,7 +74,7 @@
namespace ns2 {
-NDN_LOG_INIT(ndn.util.tests.ns2);
+NDN_LOG_INIT(ndn.tests.ns2);
static void
logFromNamespace2()
@@ -101,7 +103,7 @@
NDN_LOG_MEMBER_DECL();
};
-NDN_LOG_MEMBER_INIT(ClassWithLogger, ndn.util.tests.ClassWithLogger);
+NDN_LOG_MEMBER_INIT(ClassWithLogger, ndn.tests.ClassWithLogger);
class AbstractClassWithLogger
{
@@ -123,7 +125,7 @@
};
// Check that the macro can cope with abstract types
-NDN_LOG_MEMBER_INIT(AbstractClassWithLogger, ndn.util.tests.AbstractClassWithLogger);
+NDN_LOG_MEMBER_INIT(AbstractClassWithLogger, ndn.tests.AbstractClassWithLogger);
class DerivedClass : public AbstractClassWithLogger
{
@@ -159,13 +161,13 @@
// but we want to test that the macro expands to well-formed code
NDN_LOG_MEMBER_DECL_SPECIALIZED((ClassTemplateWithLogger<int, double>));
-NDN_LOG_MEMBER_INIT_SPECIALIZED((ClassTemplateWithLogger<int, double>), ndn.util.tests.Specialized1);
-NDN_LOG_MEMBER_INIT_SPECIALIZED((ClassTemplateWithLogger<int, std::string>), ndn.util.tests.Specialized2);
+NDN_LOG_MEMBER_INIT_SPECIALIZED((ClassTemplateWithLogger<int, double>), ndn.tests.Specialized1);
+NDN_LOG_MEMBER_INIT_SPECIALIZED((ClassTemplateWithLogger<int, std::string>), ndn.tests.Specialized2);
constexpr time::microseconds LOG_SYSTIME{1468108800311239LL};
const std::string LOG_SYSTIME_STR("1468108800.311239");
-class LoggingFixture : public ndn::tests::ClockFixture
+class LoggingFixture : public ClockFixture
{
protected:
LoggingFixture()
@@ -202,7 +204,7 @@
NDN_LOG_TRACE("GetLoggerNames");
auto names = Logging::getLoggerNames();
BOOST_CHECK_EQUAL(names.size(), n);
- BOOST_CHECK_EQUAL(names.count("ndn.util.tests.Logging"), 1);
+ BOOST_CHECK_EQUAL(names.count("ndn.tests.Logging"), 1);
}
BOOST_AUTO_TEST_SUITE(Severity)
@@ -308,48 +310,48 @@
BOOST_AUTO_TEST_CASE(NamespaceLogger)
{
- Logging::setLevel("ndn.util.tests.ns1", LogLevel::INFO);
- Logging::setLevel("ndn.util.tests.ns2", LogLevel::DEBUG);
+ Logging::setLevel("ndn.tests.ns1", LogLevel::INFO);
+ Logging::setLevel("ndn.tests.ns2", LogLevel::DEBUG);
const auto& levels = Logging::get().getLevels();
BOOST_CHECK_EQUAL(levels.size(), 2);
- BOOST_CHECK_EQUAL(levels.at("ndn.util.tests.ns1"), LogLevel::INFO);
- BOOST_CHECK_EQUAL(levels.at("ndn.util.tests.ns2"), LogLevel::DEBUG);
+ BOOST_CHECK_EQUAL(levels.at("ndn.tests.ns1"), LogLevel::INFO);
+ BOOST_CHECK_EQUAL(levels.at("ndn.tests.ns2"), LogLevel::DEBUG);
const auto& names = Logging::getLoggerNames();
- BOOST_CHECK_EQUAL(names.count("ndn.util.tests.ns1"), 1);
- BOOST_CHECK_EQUAL(names.count("ndn.util.tests.ns2"), 1);
+ BOOST_CHECK_EQUAL(names.count("ndn.tests.ns1"), 1);
+ BOOST_CHECK_EQUAL(names.count("ndn.tests.ns2"), 1);
ns1::logFromNamespace1();
ns2::logFromNamespace2();
Logging::flush();
BOOST_CHECK(os.is_equal(
- LOG_SYSTIME_STR + " INFO: [ndn.util.tests.ns1] hello world from ns1\n" +
- LOG_SYSTIME_STR + " INFO: [ndn.util.tests.ns2] hi there from ns2\n"
+ LOG_SYSTIME_STR + " INFO: [ndn.tests.ns1] hello world from ns1\n" +
+ LOG_SYSTIME_STR + " INFO: [ndn.tests.ns2] hi there from ns2\n"
));
}
BOOST_AUTO_TEST_CASE(MemberLogger)
{
- Logging::setLevel("ndn.util.tests.ClassWithLogger", LogLevel::INFO);
- Logging::setLevel("ndn.util.tests.AbstractClassWithLogger", LogLevel::INFO);
- Logging::setLevel("ndn.util.tests.Specialized1", LogLevel::INFO);
- // ndn.util.tests.Specialized2 is not enabled
+ Logging::setLevel("ndn.tests.ClassWithLogger", LogLevel::INFO);
+ Logging::setLevel("ndn.tests.AbstractClassWithLogger", LogLevel::INFO);
+ Logging::setLevel("ndn.tests.Specialized1", LogLevel::INFO);
+ // ndn.tests.Specialized2 is not enabled
const auto& names = Logging::getLoggerNames();
- BOOST_CHECK_EQUAL(names.count("ndn.util.tests.ClassWithLogger"), 1);
- BOOST_CHECK_EQUAL(names.count("ndn.util.tests.AbstractClassWithLogger"), 1);
- BOOST_CHECK_EQUAL(names.count("ndn.util.tests.Specialized1"), 1);
- BOOST_CHECK_EQUAL(names.count("ndn.util.tests.Specialized2"), 1);
+ BOOST_CHECK_EQUAL(names.count("ndn.tests.ClassWithLogger"), 1);
+ BOOST_CHECK_EQUAL(names.count("ndn.tests.AbstractClassWithLogger"), 1);
+ BOOST_CHECK_EQUAL(names.count("ndn.tests.Specialized1"), 1);
+ BOOST_CHECK_EQUAL(names.count("ndn.tests.Specialized2"), 1);
ClassWithLogger::logFromStaticMemberFunction();
ClassWithLogger{}.logFromConstMemberFunction();
Logging::flush();
BOOST_CHECK(os.is_equal(
- LOG_SYSTIME_STR + " INFO: [ndn.util.tests.ClassWithLogger] static member function\n" +
- LOG_SYSTIME_STR + " INFO: [ndn.util.tests.ClassWithLogger] const member function\n"
+ LOG_SYSTIME_STR + " INFO: [ndn.tests.ClassWithLogger] static member function\n" +
+ LOG_SYSTIME_STR + " INFO: [ndn.tests.ClassWithLogger] const member function\n"
));
DerivedClass{}.logFromConstMemberFunction();
@@ -357,8 +359,8 @@
Logging::flush();
BOOST_CHECK(os.is_equal(
- LOG_SYSTIME_STR + " INFO: [ndn.util.tests.AbstractClassWithLogger] const member function\n" +
- LOG_SYSTIME_STR + " INFO: [ndn.util.tests.AbstractClassWithLogger] overridden virtual function\n"
+ LOG_SYSTIME_STR + " INFO: [ndn.tests.AbstractClassWithLogger] const member function\n" +
+ LOG_SYSTIME_STR + " INFO: [ndn.tests.AbstractClassWithLogger] overridden virtual function\n"
));
ClassTemplateWithLogger<int, double>::logFromStaticMemberFunction();
@@ -368,8 +370,8 @@
Logging::flush();
BOOST_CHECK(os.is_equal(
- LOG_SYSTIME_STR + " INFO: [ndn.util.tests.Specialized1] class template static member function\n" +
- LOG_SYSTIME_STR + " INFO: [ndn.util.tests.Specialized1] class template non-static member function\n"
+ LOG_SYSTIME_STR + " INFO: [ndn.tests.Specialized1] class template static member function\n" +
+ LOG_SYSTIME_STR + " INFO: [ndn.tests.Specialized1] class template non-static member function\n"
));
}
@@ -702,6 +704,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestLogging
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/notification-stream.t.cpp b/tests/unit/util/notification-stream.t.cpp
index 3ff6ed9..36b9004 100644
--- a/tests/unit/util/notification-stream.t.cpp
+++ b/tests/unit/util/notification-stream.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2021 Regents of the University of California,
+ * Copyright (c) 2014-2023 Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -32,12 +32,12 @@
#include "tests/unit/io-key-chain-fixture.hpp"
#include "tests/unit/util/simple-notification.hpp"
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::util::NotificationStream;
BOOST_AUTO_TEST_SUITE(Util)
-BOOST_FIXTURE_TEST_SUITE(TestNotificationStream, ndn::tests::IoKeyChainFixture)
+BOOST_FIXTURE_TEST_SUITE(TestNotificationStream, IoKeyChainFixture)
BOOST_AUTO_TEST_CASE(Post)
{
@@ -72,6 +72,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestNotificationStream
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/notification-subscriber.t.cpp b/tests/unit/util/notification-subscriber.t.cpp
index 896f632..107784a 100644
--- a/tests/unit/util/notification-subscriber.t.cpp
+++ b/tests/unit/util/notification-subscriber.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022 Regents of the University of California,
+ * Copyright (c) 2014-2023 Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -32,11 +32,7 @@
#include "tests/unit/io-key-chain-fixture.hpp"
#include "tests/unit/util/simple-notification.hpp"
-namespace ndn {
-namespace util {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
class NotificationSubscriberFixture : public IoKeyChainFixture
{
@@ -131,8 +127,8 @@
Name streamPrefix;
DummyClientFace subscriberFace;
util::NotificationSubscriber<SimpleNotification> subscriber;
- util::signal::Connection notificationConn;
- util::signal::Connection nackConn;
+ signal::Connection notificationConn;
+ signal::Connection nackConn;
uint64_t nextSendNotificationNo;
uint64_t lastDeliveredSeqNum;
SimpleNotification lastNotification;
@@ -285,6 +281,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestNotificationSubscriber
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/ostream-joiner.t.cpp b/tests/unit/util/ostream-joiner.t.cpp
index 7e8e63f..2e7ac8f 100644
--- a/tests/unit/util/ostream-joiner.t.cpp
+++ b/tests/unit/util/ostream-joiner.t.cpp
@@ -26,8 +26,7 @@
#include <numeric>
#include <boost/test/tools/output_test_stream.hpp>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestOstreamJoiner)
@@ -69,5 +68,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestOstreamJoiner
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/random.t.cpp b/tests/unit/util/random.t.cpp
index 388bb98..b72e754 100644
--- a/tests/unit/util/random.t.cpp
+++ b/tests/unit/util/random.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -28,8 +28,7 @@
#include <array>
#include <thread>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestRandom)
@@ -125,5 +124,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestRandom
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/regex.t.cpp b/tests/unit/util/regex.t.cpp
index ca15b66..d09688e 100644
--- a/tests/unit/util/regex.t.cpp
+++ b/tests/unit/util/regex.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -32,8 +32,7 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
using std::string;
@@ -490,5 +489,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestRegex
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/rtt-estimator.t.cpp b/tests/unit/util/rtt-estimator.t.cpp
index b819c9b..7070fb0 100644
--- a/tests/unit/util/rtt-estimator.t.cpp
+++ b/tests/unit/util/rtt-estimator.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2019, Regents of the University of California,
+ * Copyright (c) 2016-2023, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -27,9 +27,10 @@
#include <cmath>
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::util::RttEstimator;
+using ndn::util::RttEstimatorWithStats;
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestRttEstimator)
@@ -168,6 +169,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestRttEstimator
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/scheduler.t.cpp b/tests/unit/util/scheduler.t.cpp
index 1040b92..e5c99e5 100644
--- a/tests/unit/util/scheduler.t.cpp
+++ b/tests/unit/util/scheduler.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,11 +26,11 @@
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace scheduler {
-namespace tests {
+namespace ndn::tests {
-class SchedulerFixture : public ndn::tests::IoFixture
+using namespace ndn::scheduler;
+
+class SchedulerFixture : public IoFixture
{
protected:
Scheduler scheduler{m_io};
@@ -383,6 +383,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestScheduler
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace scheduler
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/segment-fetcher.t.cpp b/tests/unit/util/segment-fetcher.t.cpp
index 4abe243..1166110 100644
--- a/tests/unit/util/segment-fetcher.t.cpp
+++ b/tests/unit/util/segment-fetcher.t.cpp
@@ -31,11 +31,7 @@
#include <set>
-namespace ndn {
-namespace util {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
class SegmentFetcherFixture : public IoKeyChainFixture
{
@@ -853,6 +849,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestSegmentFetcher
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/segmenter.t.cpp b/tests/unit/util/segmenter.t.cpp
index d7ab98a..f6eb2a8 100644
--- a/tests/unit/util/segmenter.t.cpp
+++ b/tests/unit/util/segmenter.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -24,11 +24,7 @@
#include "tests/boost-test.hpp"
#include "tests/key-chain-fixture.hpp"
-namespace ndn {
-namespace util {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Util)
BOOST_FIXTURE_TEST_SUITE(TestSegmenter, KeyChainFixture)
@@ -144,6 +140,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestSegmenter
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/sha256.t.cpp b/tests/unit/util/sha256.t.cpp
index c5fd1fd..4a31ac7 100644
--- a/tests/unit/util/sha256.t.cpp
+++ b/tests/unit/util/sha256.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,9 +27,9 @@
#include <boost/endian/conversion.hpp>
#include <sstream>
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::util::Sha256;
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestSha256)
@@ -201,6 +201,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestSha256
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/signal.t.cpp b/tests/unit/util/signal.t.cpp
index b3640f9..001d02a 100644
--- a/tests/unit/util/signal.t.cpp
+++ b/tests/unit/util/signal.t.cpp
@@ -25,10 +25,9 @@
#include <boost/concept_check.hpp>
-namespace ndn {
-namespace util {
-namespace signal {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::signal;
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestSignal)
@@ -477,7 +476,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestSignal
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace signal
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/simple-notification.hpp b/tests/unit/util/simple-notification.hpp
index ece2c48..239574b 100644
--- a/tests/unit/util/simple-notification.hpp
+++ b/tests/unit/util/simple-notification.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022 Regents of the University of California,
+ * Copyright (c) 2014-2023 Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -30,9 +30,7 @@
#include "ndn-cxx/encoding/block-helpers.hpp"
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
class SimpleNotification
{
@@ -82,8 +80,6 @@
std::string m_message;
};
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_UNIT_UTIL_SIMPLE_NOTIFICATION_HPP
diff --git a/tests/unit/util/sqlite3-statement.t.cpp b/tests/unit/util/sqlite3-statement.t.cpp
index 99ea89f..b3d32d5 100644
--- a/tests/unit/util/sqlite3-statement.t.cpp
+++ b/tests/unit/util/sqlite3-statement.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2022 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -27,9 +27,9 @@
#include <cstring>
#include <sqlite3.h>
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
+
+using ndn::util::Sqlite3Statement;
class Sqlite3DbFixture
{
@@ -153,6 +153,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestSqlite3Statement
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/string-helper.t.cpp b/tests/unit/util/string-helper.t.cpp
index 3816fab..9361ed6 100644
--- a/tests/unit/util/string-helper.t.cpp
+++ b/tests/unit/util/string-helper.t.cpp
@@ -28,9 +28,7 @@
#include <cstring>
#include <boost/test/tools/output_test_stream.hpp>
-namespace ndn {
-namespace util {
-namespace tests {
+namespace ndn::tests {
using boost::test_tools::output_test_stream;
@@ -202,6 +200,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestStringHelper
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace util
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/time-unit-test-clock.t.cpp b/tests/unit/util/time-unit-test-clock.t.cpp
index f1be623..6b34ff8 100644
--- a/tests/unit/util/time-unit-test-clock.t.cpp
+++ b/tests/unit/util/time-unit-test-clock.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2020 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -28,8 +28,7 @@
#include <boost/lexical_cast.hpp>
#include <thread>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Util)
BOOST_FIXTURE_TEST_SUITE(TestTimeUnitTestClock, ClockFixture)
@@ -51,8 +50,7 @@
BOOST_CHECK_GT(time::system_clock::now().time_since_epoch(),
time::UnitTestClockTraits<time::system_clock>::getDefaultStartTime());
- time::system_clock::TimePoint referenceTime =
- time::fromUnixTimestamp(time::milliseconds(1390966967032LL));
+ auto referenceTime = time::fromUnixTimestamp(time::milliseconds(1390966967032LL));
BOOST_CHECK_GT(time::system_clock::now(), referenceTime);
m_systemClock->setNow(referenceTime.time_since_epoch());
@@ -134,5 +132,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestTimeUnitTestClock
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/util/time.t.cpp b/tests/unit/util/time.t.cpp
index 2232e12..9004700 100644
--- a/tests/unit/util/time.t.cpp
+++ b/tests/unit/util/time.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2021 Regents of the University of California.
+ * Copyright (c) 2013-2023 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -26,9 +26,9 @@
#include <boost/lexical_cast.hpp>
#include <thread>
-namespace ndn {
-namespace time {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::time;
BOOST_AUTO_TEST_SUITE(Util)
BOOST_AUTO_TEST_SUITE(TestTime)
@@ -170,6 +170,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestTime
BOOST_AUTO_TEST_SUITE_END() // Util
-} // namespace tests
-} // namespace time
-} // namespace ndn
+} // namespace ndn::tests