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/encoding/block-helpers.t.cpp b/tests/unit/encoding/block-helpers.t.cpp
index ed8641e..18fce9a 100644
--- a/tests/unit/encoding/block-helpers.t.cpp
+++ b/tests/unit/encoding/block-helpers.t.cpp
@@ -24,9 +24,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace encoding {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::encoding;
BOOST_AUTO_TEST_SUITE(Encoding)
BOOST_AUTO_TEST_SUITE(TestBlockHelpers)
@@ -181,6 +181,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestBlockHelpers
BOOST_AUTO_TEST_SUITE_END() // Encoding
-} // namespace tests
-} // namespace encoding
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/encoding/block.t.cpp b/tests/unit/encoding/block.t.cpp
index 8dd21d3..c93a307 100644
--- a/tests/unit/encoding/block.t.cpp
+++ b/tests/unit/encoding/block.t.cpp
@@ -31,8 +31,7 @@
#include <cstring>
#include <sstream>
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Block>));
@@ -751,5 +750,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestBlock
BOOST_AUTO_TEST_SUITE_END() // Encoding
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/encoding/buffer-stream.t.cpp b/tests/unit/encoding/buffer-stream.t.cpp
index 3f67d50..7442299 100644
--- a/tests/unit/encoding/buffer-stream.t.cpp
+++ b/tests/unit/encoding/buffer-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).
*
@@ -23,8 +23,7 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Encoding)
BOOST_AUTO_TEST_SUITE(TestBufferStream)
@@ -84,5 +83,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestBufferStream
BOOST_AUTO_TEST_SUITE_END() // Encoding
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/encoding/encoder.t.cpp b/tests/unit/encoding/encoder.t.cpp
index 0402f14..5e71e2c 100644
--- a/tests/unit/encoding/encoder.t.cpp
+++ b/tests/unit/encoding/encoder.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).
*
@@ -23,9 +23,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace encoding {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::encoding;
BOOST_AUTO_TEST_SUITE(Encoding)
BOOST_AUTO_TEST_SUITE(TestEncoder)
@@ -155,6 +155,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestEncoder
BOOST_AUTO_TEST_SUITE_END() // Encoding
-} // namespace tests
-} // namespace encoding
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/encoding/encoding-buffer.t.cpp b/tests/unit/encoding/encoding-buffer.t.cpp
index c0997b4..a5fa639 100644
--- a/tests/unit/encoding/encoding-buffer.t.cpp
+++ b/tests/unit/encoding/encoding-buffer.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,15 +24,7 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace tests {
-
-class BufferEstimatorFixture
-{
-public:
- EncodingBuffer buffer;
- EncodingEstimator estimator;
-};
+namespace ndn::tests {
BOOST_AUTO_TEST_SUITE(Encoding)
BOOST_AUTO_TEST_SUITE(TestEncodingBuffer)
@@ -61,6 +53,13 @@
}
}
+class BufferEstimatorFixture
+{
+public:
+ EncodingBuffer buffer;
+ EncodingEstimator estimator;
+};
+
BOOST_FIXTURE_TEST_SUITE(PrependVarNumber, BufferEstimatorFixture)
BOOST_AUTO_TEST_CASE(OneByte1)
@@ -198,5 +197,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestEncodingBuffer
BOOST_AUTO_TEST_SUITE_END() // Encoding
-} // namespace tests
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/encoding/estimator.t.cpp b/tests/unit/encoding/estimator.t.cpp
index cb86424..12a369b 100644
--- a/tests/unit/encoding/estimator.t.cpp
+++ b/tests/unit/encoding/estimator.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).
*
@@ -23,9 +23,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace encoding {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::encoding;
BOOST_AUTO_TEST_SUITE(Encoding)
BOOST_AUTO_TEST_SUITE(TestEstimator)
@@ -103,6 +103,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestEstimator
BOOST_AUTO_TEST_SUITE_END() // Encoding
-} // namespace tests
-} // namespace encoding
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/encoding/nfd-constants.t.cpp b/tests/unit/encoding/nfd-constants.t.cpp
index e1bc111..6821c44 100644
--- a/tests/unit/encoding/nfd-constants.t.cpp
+++ b/tests/unit/encoding/nfd-constants.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).
*
@@ -27,9 +27,9 @@
#include <iomanip>
#include <sstream>
-namespace ndn {
-namespace nfd {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::nfd;
BOOST_AUTO_TEST_SUITE(Encoding)
BOOST_AUTO_TEST_SUITE(TestNfdConstants)
@@ -142,6 +142,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestNfdConstants
BOOST_AUTO_TEST_SUITE_END() // Encoding
-} // namespace tests
-} // namespace nfd
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/encoding/tlv.t.cpp b/tests/unit/encoding/tlv.t.cpp
index 9cd7cc4..e38b5f2 100644
--- a/tests/unit/encoding/tlv.t.cpp
+++ b/tests/unit/encoding/tlv.t.cpp
@@ -34,9 +34,9 @@
#include <boost/iostreams/device/array.hpp>
#include <boost/lexical_cast.hpp>
-namespace ndn {
-namespace tlv {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::tlv;
BOOST_AUTO_TEST_SUITE(Encoding)
BOOST_AUTO_TEST_SUITE(TestTlv)
@@ -59,9 +59,9 @@
using StreamIterator = std::istream_iterator<uint8_t>;
#define ASSERT_READ_NUMBER_IS_FAST(T) \
- static_assert(detail::IsContiguousIterator<T>, #T " is not fast")
+ static_assert(ndn::tlv::detail::IsContiguousIterator<T>, #T " is not fast")
#define ASSERT_READ_NUMBER_IS_SLOW(T) \
- static_assert(!detail::IsContiguousIterator<T>, #T " is not slow")
+ static_assert(!ndn::tlv::detail::IsContiguousIterator<T>, #T " is not slow")
ASSERT_READ_NUMBER_IS_FAST(const uint8_t*);
ASSERT_READ_NUMBER_IS_FAST(uint8_t*);
@@ -605,6 +605,4 @@
BOOST_AUTO_TEST_SUITE_END() // TestTlv
BOOST_AUTO_TEST_SUITE_END() // Encoding
-} // namespace tests
-} // namespace tlv
-} // namespace ndn
+} // namespace ndn::tests