tests: fix -Wrange-loop-construct warning with clang 10
Change-Id: If9ada471a799e89b93ba216c1910535c1fdb0a1b
diff --git a/README.md b/README.md
index cb21799..b1912d0 100644
--- a/README.md
+++ b/README.md
@@ -28,5 +28,5 @@
## License
-ndn-tools is an open source project licensed under the GPL version 3.
+repo-ng is an open source project licensed under the GPL version 3.
See [`COPYING.md`](COPYING.md) for more information.
diff --git a/tests/unit/read-handle.t.cpp b/tests/unit/read-handle.t.cpp
index 4e01720..1e22b4e 100644
--- a/tests/unit/read-handle.t.cpp
+++ b/tests/unit/read-handle.t.cpp
@@ -26,18 +26,14 @@
#include <boost/test/unit_test.hpp>
#include <ndn-cxx/util/dummy-client-face.hpp>
-#define CHECK_INTERESTS(NAME, COMPONENT, EXPECTED) \
- do { \
- bool didMatch = false; \
- for (const auto& interest : face.sentInterests) { \
- bool isPresent = false; \
- for (const auto& section : NAME) { \
- isPresent = isPresent || section == COMPONENT; \
- } \
- didMatch = didMatch || isPresent; \
- } \
- BOOST_CHECK_EQUAL(didMatch, EXPECTED); \
- } while (0)
+#define CHECK_INTERESTS(NAME, COMPONENT, EXPECTED) \
+ do { \
+ bool didMatch = false; \
+ for (const auto& interest : face.sentInterests) { \
+ didMatch = didMatch || containsNameComponent(NAME, COMPONENT); \
+ } \
+ BOOST_CHECK_EQUAL(didMatch, EXPECTED); \
+ } while (false)
namespace repo {
namespace tests {
@@ -48,7 +44,7 @@
{
public:
Fixture()
- : face(ndn::util::DummyClientFace::Options{true, true})
+ : face({true, true})
, scheduler(face.getIoService())
, subsetLength(1)
, dataPrefix("/ndn/test/prefix")
@@ -60,15 +56,14 @@
readHandle.connectAutoListen();
}
-public:
- bool
+ static bool
containsNameComponent(const Name& name, const ndn::name::Component& component)
{
- bool isPresent = false;
- for (const auto section : name) {
- isPresent = isPresent || section == component;
+ for (const auto& c : name) {
+ if (c == component)
+ return true;
}
- return isPresent;
+ return false;
}
public: