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/benchmarks/encoding-bench.cpp b/tests/benchmarks/encoding-bench.cpp
index 1adb452..a3e0b5e 100644
--- a/tests/benchmarks/encoding-bench.cpp
+++ b/tests/benchmarks/encoding-bench.cpp
@@ -30,11 +30,7 @@
#include <iostream>
-namespace ndn {
-namespace tlv {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
template<size_t WIRE_SIZE>
struct ReadVarNumberTest;
@@ -112,7 +108,7 @@
uint64_t number = 0;
for (int i = 0; i < N_ITERATIONS; ++i) {
const uint8_t* begin2 = begin; // make a copy because readVarNumber increments the pointer
- nOks += readVarNumber(begin2, end, number);
+ nOks += tlv::readVarNumber(begin2, end, number);
nCorrects += number == Test::VALUE;
// use the number and the return value, so compiler won't optimize out their computation
}
@@ -124,6 +120,4 @@
<< " " << d << std::endl;
}
-} // namespace tests
-} // namespace tlv
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/benchmarks/scheduler-bench.cpp b/tests/benchmarks/scheduler-bench.cpp
index 8897920..46af278 100644
--- a/tests/benchmarks/scheduler-bench.cpp
+++ b/tests/benchmarks/scheduler-bench.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,11 +28,7 @@
#include <boost/asio/io_service.hpp>
#include <iostream>
-namespace ndn {
-namespace scheduler {
-namespace tests {
-
-using namespace ndn::tests;
+namespace ndn::tests {
BOOST_AUTO_TEST_CASE(ScheduleCancel)
{
@@ -40,7 +36,7 @@
Scheduler sched(io);
const size_t nEvents = 1000000;
- std::vector<EventId> eventIds(nEvents);
+ std::vector<scheduler::EventId> eventIds(nEvents);
auto d1 = timedExecute([&] {
for (size_t i = 0; i < nEvents; ++i) {
@@ -67,8 +63,8 @@
size_t nExpired = 0;
// Events should expire at t1, but execution finishes at t2. The difference is the overhead.
- time::steady_clock::TimePoint t1 = time::steady_clock::now() + 5_s;
- time::steady_clock::TimePoint t2;
+ time::steady_clock::time_point t1 = time::steady_clock::now() + 5_s;
+ time::steady_clock::time_point t2;
// +1ms ensures this extra event is executed last. In case the overhead is less than 1ms,
// it will be reported as 1ms.
sched.schedule(t1 - time::steady_clock::now() + 1_ms, [&] {
@@ -86,6 +82,4 @@
std::cout << "execute " << nEvents << " events: " << (t2 - t1) << std::endl;
}
-} // namespace tests
-} // namespace scheduler
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/benchmarks/timed-execute.hpp b/tests/benchmarks/timed-execute.hpp
index b33873d..7ce5a82 100644
--- a/tests/benchmarks/timed-execute.hpp
+++ b/tests/benchmarks/timed-execute.hpp
@@ -24,8 +24,7 @@
#include "ndn-cxx/util/time.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
template<typename F>
time::nanoseconds
@@ -37,7 +36,6 @@
return after - before;
}
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
#endif // NDN_CXX_TESTS_BENCHMARKS_TIMED_EXECUTE_HPP