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/security/transform/base64-decode.t.cpp b/tests/unit/security/transform/base64-decode.t.cpp
index 5d89fe6..f180624 100644
--- a/tests/unit/security/transform/base64-decode.t.cpp
+++ b/tests/unit/security/transform/base64-decode.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,10 +27,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -173,7 +172,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/base64-encode.t.cpp b/tests/unit/security/transform/base64-encode.t.cpp
index 7b4aa47..c25ecba 100644
--- a/tests/unit/security/transform/base64-encode.t.cpp
+++ b/tests/unit/security/transform/base64-encode.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).
*
@@ -28,10 +28,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -171,7 +170,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/block-cipher.t.cpp b/tests/unit/security/transform/block-cipher.t.cpp
index d8b3c3b..cd857c1 100644
--- a/tests/unit/security/transform/block-cipher.t.cpp
+++ b/tests/unit/security/transform/block-cipher.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,10 +27,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -106,7 +105,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/bool-sink.t.cpp b/tests/unit/security/transform/bool-sink.t.cpp
index a7640c6..be10b13 100644
--- a/tests/unit/security/transform/bool-sink.t.cpp
+++ b/tests/unit/security/transform/bool-sink.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).
*
@@ -23,10 +23,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -41,7 +40,7 @@
BOOST_CHECK_EQUAL(sink1.write({in1 + 1, 1}), 1);
sink1.end();
BOOST_CHECK_EQUAL(value1, false);
- BOOST_CHECK_THROW(sink1.write({in1 + 1, 1}), transform::Error);
+ BOOST_CHECK_THROW(sink1.write({in1 + 1, 1}), Error);
const uint8_t in2[] = {0x01, 0x00};
bool value2 = false;
@@ -50,14 +49,11 @@
BOOST_CHECK_EQUAL(sink2.write({in2 + 1, 1}), 1);
sink2.end();
BOOST_CHECK_EQUAL(value2, true);
- BOOST_CHECK_THROW(sink2.write({in2 + 1, 1}), transform::Error);
+ BOOST_CHECK_THROW(sink2.write({in2 + 1, 1}), Error);
}
BOOST_AUTO_TEST_SUITE_END() // TestBoolSink
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/buffer-source.t.cpp b/tests/unit/security/transform/buffer-source.t.cpp
index f957282..aa27644 100644
--- a/tests/unit/security/transform/buffer-source.t.cpp
+++ b/tests/unit/security/transform/buffer-source.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,10 +24,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -91,7 +90,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/digest-filter.t.cpp b/tests/unit/security/transform/digest-filter.t.cpp
index 08f85cf..c414d17 100644
--- a/tests/unit/security/transform/digest-filter.t.cpp
+++ b/tests/unit/security/transform/digest-filter.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).
*
@@ -30,10 +30,9 @@
#include <openssl/evp.h>
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -215,7 +214,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/hex-decode.t.cpp b/tests/unit/security/transform/hex-decode.t.cpp
index 23ca9aa..51a2672 100644
--- a/tests/unit/security/transform/hex-decode.t.cpp
+++ b/tests/unit/security/transform/hex-decode.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).
*
@@ -28,10 +28,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -262,11 +261,11 @@
{
const std::string in1 = "0001020304050";
OBufferStream os1;
- BOOST_CHECK_THROW(bufferSource(in1) >> hexDecode() >> streamSink(os1), transform::Error);
+ BOOST_CHECK_THROW(bufferSource(in1) >> hexDecode() >> streamSink(os1), Error);
const std::string in2 = "0001020304xy";
OBufferStream os2;
- BOOST_CHECK_THROW(bufferSource(in2) >> hexDecode() >> streamSink(os2), transform::Error);
+ BOOST_CHECK_THROW(bufferSource(in2) >> hexDecode() >> streamSink(os2), Error);
}
BOOST_AUTO_TEST_CASE(EmptyInput)
@@ -283,7 +282,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/hex-encode.t.cpp b/tests/unit/security/transform/hex-encode.t.cpp
index 8025c37..2a81b6a 100644
--- a/tests/unit/security/transform/hex-encode.t.cpp
+++ b/tests/unit/security/transform/hex-encode.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,10 +27,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -176,7 +175,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/private-key.t.cpp b/tests/unit/security/transform/private-key.t.cpp
index 077c2e3..f9a511d 100644
--- a/tests/unit/security/transform/private-key.t.cpp
+++ b/tests/unit/security/transform/private-key.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).
*
@@ -38,10 +38,9 @@
#include <boost/mpl/vector.hpp>
#include <sstream>
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -716,7 +715,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/public-key.t.cpp b/tests/unit/security/transform/public-key.t.cpp
index 655811c..31970c4 100644
--- a/tests/unit/security/transform/public-key.t.cpp
+++ b/tests/unit/security/transform/public-key.t.cpp
@@ -32,10 +32,9 @@
#include <sstream>
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -151,7 +150,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/signer-filter.t.cpp b/tests/unit/security/transform/signer-filter.t.cpp
index cad6f04..ad3b788 100644
--- a/tests/unit/security/transform/signer-filter.t.cpp
+++ b/tests/unit/security/transform/signer-filter.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).
*
@@ -31,10 +31,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -92,7 +91,7 @@
bufferSource(data) >> signerFilter(DigestAlgorithm::SHA256, sKey) >> streamSink(os2);
auto sig = os2.buf();
- BOOST_TEST(verifySignature({data}, *sig, *pubKey));
+ BOOST_TEST(security::verifySignature({data}, *sig, *pubKey));
}
BOOST_AUTO_TEST_CASE(Ecdsa)
@@ -130,7 +129,7 @@
bufferSource(data) >> signerFilter(DigestAlgorithm::SHA256, sKey) >> streamSink(os2);
auto sig = os2.buf();
- BOOST_TEST(verifySignature({data}, *sig, *pubKey));
+ BOOST_TEST(security::verifySignature({data}, *sig, *pubKey));
}
BOOST_AUTO_TEST_SUITE(Hmac)
@@ -244,7 +243,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/step-source.t.cpp b/tests/unit/security/transform/step-source.t.cpp
index 0179011..c950716 100644
--- a/tests/unit/security/transform/step-source.t.cpp
+++ b/tests/unit/security/transform/step-source.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,10 +26,9 @@
#include <sstream>
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -69,7 +68,7 @@
BOOST_CHECK_EQUAL(ss.write({buf + 960, 320}), 320);
ss.end();
- BOOST_CHECK_THROW(ss.write({buf + 960, 320}), transform::Error);
+ BOOST_CHECK_THROW(ss.write({buf + 960, 320}), Error);
BOOST_CHECK_EQUAL(os.str(), input);
}
@@ -87,7 +86,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/stream-sink.t.cpp b/tests/unit/security/transform/stream-sink.t.cpp
index f58bece..b79012d 100644
--- a/tests/unit/security/transform/stream-sink.t.cpp
+++ b/tests/unit/security/transform/stream-sink.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).
*
@@ -23,10 +23,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -48,14 +47,11 @@
std::string out = os.str();
BOOST_CHECK_EQUAL_COLLECTIONS(in, in + sizeof(in), out.begin(), out.end());
- BOOST_CHECK_THROW(sink.write({in + 8, 8}), transform::Error);
+ BOOST_CHECK_THROW(sink.write({in + 8, 8}), Error);
}
BOOST_AUTO_TEST_SUITE_END() // TestStreamSink
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/stream-source.t.cpp b/tests/unit/security/transform/stream-source.t.cpp
index 1446bc9..e20ff23 100644
--- a/tests/unit/security/transform/stream-source.t.cpp
+++ b/tests/unit/security/transform/stream-source.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).
*
@@ -27,10 +27,9 @@
#include <boost/mpl/integral_c.hpp>
#include <boost/mpl/vector.hpp>
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -77,24 +76,21 @@
BOOST_CHECK_EQUAL(os.str(), "");
}
-typedef boost::mpl::vector<
+using BadBits = boost::mpl::vector<
boost::mpl::integral_c<std::ios_base::iostate, std::ios_base::badbit>,
boost::mpl::integral_c<std::ios_base::iostate, std::ios_base::failbit>
-> BadBits;
+>;
BOOST_AUTO_TEST_CASE_TEMPLATE(BadStream, BadBit, BadBits)
{
std::stringstream is;
is.setstate(BadBit::value);
std::stringstream os;
- BOOST_CHECK_THROW(streamSource(is) >> streamSink(os), transform::Error);
+ BOOST_CHECK_THROW(streamSource(is) >> streamSink(os), Error);
}
BOOST_AUTO_TEST_SUITE_END() // TestStreamSource
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/strip-space.t.cpp b/tests/unit/security/transform/strip-space.t.cpp
index cd73270..cbc406d 100644
--- a/tests/unit/security/transform/strip-space.t.cpp
+++ b/tests/unit/security/transform/strip-space.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,10 +27,9 @@
#include "tests/boost-test.hpp"
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -72,7 +71,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests
diff --git a/tests/unit/security/transform/verifier-filter.t.cpp b/tests/unit/security/transform/verifier-filter.t.cpp
index ef986b1..e04415c 100644
--- a/tests/unit/security/transform/verifier-filter.t.cpp
+++ b/tests/unit/security/transform/verifier-filter.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).
*
@@ -35,10 +35,9 @@
#include <openssl/opensslv.h>
-namespace ndn {
-namespace security {
-namespace transform {
-namespace tests {
+namespace ndn::tests {
+
+using namespace ndn::security::transform;
BOOST_AUTO_TEST_SUITE(Security)
BOOST_AUTO_TEST_SUITE(Transform)
@@ -188,7 +187,4 @@
BOOST_AUTO_TEST_SUITE_END() // Transform
BOOST_AUTO_TEST_SUITE_END() // Security
-} // namespace tests
-} // namespace transform
-} // namespace security
-} // namespace ndn
+} // namespace ndn::tests