Move BOOST_CONCEPT_ASSERT to unit tests where possible
Change-Id: I0c6ae494eb7be4ab2ff422ba6d866ead9e75f4eb
diff --git a/tests/unit/util/segment-fetcher.t.cpp b/tests/unit/util/segment-fetcher.t.cpp
index cd74372..4abe243 100644
--- a/tests/unit/util/segment-fetcher.t.cpp
+++ b/tests/unit/util/segment-fetcher.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).
*
@@ -36,7 +36,6 @@
namespace tests {
using namespace ndn::tests;
-using std::bind;
class SegmentFetcherFixture : public IoKeyChainFixture
{
@@ -93,10 +92,10 @@
void
connectSignals(const shared_ptr<SegmentFetcher>& fetcher)
{
- fetcher->onInOrderData.connect(bind(&SegmentFetcherFixture::onInOrderData, this, _1));
- fetcher->onInOrderComplete.connect(bind(&SegmentFetcherFixture::onInOrderComplete, this));
- fetcher->onComplete.connect(bind(&SegmentFetcherFixture::onComplete, this, _1));
- fetcher->onError.connect(bind(&SegmentFetcherFixture::onError, this, _1));
+ fetcher->onInOrderData.connect(std::bind(&SegmentFetcherFixture::onInOrderData, this, _1));
+ fetcher->onInOrderComplete.connect(std::bind(&SegmentFetcherFixture::onInOrderComplete, this));
+ fetcher->onComplete.connect(std::bind(&SegmentFetcherFixture::onComplete, this, _1));
+ fetcher->onError.connect(std::bind(&SegmentFetcherFixture::onError, this, _1));
fetcher->afterSegmentReceived.connect([this] (const auto&) { ++this->nAfterSegmentReceived; });
fetcher->afterSegmentValidated.connect([this] (const auto &) { ++this->nAfterSegmentValidated; });
@@ -190,7 +189,7 @@
shared_ptr<SegmentFetcher> fetcher = SegmentFetcher::start(face, Interest("/hello/world"),
acceptValidator, options);
connectSignals(fetcher);
- fetcher->afterSegmentTimedOut.connect(bind([&nAfterSegmentTimedOut] { ++nAfterSegmentTimedOut; }));
+ fetcher->afterSegmentTimedOut.connect([&nAfterSegmentTimedOut] { ++nAfterSegmentTimedOut; });
advanceClocks(1_ms);
BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
@@ -310,7 +309,7 @@
shared_ptr<SegmentFetcher> fetcher = SegmentFetcher::start(face, Interest("/hello/world"),
acceptValidator);
- face.onSendInterest.connect(bind(&SegmentFetcherFixture::onInterest, this, _1));
+ face.onSendInterest.connect(std::bind(&SegmentFetcherFixture::onInterest, this, _1));
connectSignals(fetcher);
face.processEvents(1_s);
@@ -333,7 +332,7 @@
sendNackInsteadOfDropping = false;
auto fetcher = SegmentFetcher::start(face, Interest("/hello/world"), acceptValidator, options);
- face.onSendInterest.connect(bind(&SegmentFetcherFixture::onInterest, this, _1));
+ face.onSendInterest.connect(std::bind(&SegmentFetcherFixture::onInterest, this, _1));
connectSignals(fetcher);
face.processEvents(1_s);
@@ -358,7 +357,7 @@
shared_ptr<SegmentFetcher> fetcher = SegmentFetcher::start(face, Interest("/hello/world"),
acceptValidator);
- face.onSendInterest.connect(bind(&SegmentFetcherFixture::onInterest, this, _1));
+ face.onSendInterest.connect(std::bind(&SegmentFetcherFixture::onInterest, this, _1));
connectSignals(fetcher);
face.processEvents(1_s);
@@ -382,7 +381,7 @@
defaultSegmentToSend = 47;
auto fetcher = SegmentFetcher::start(face, Interest("/hello/world"), acceptValidator, options);
- face.onSendInterest.connect(bind(&SegmentFetcherFixture::onInterest, this, _1));
+ face.onSendInterest.connect(std::bind(&SegmentFetcherFixture::onInterest, this, _1));
connectSignals(fetcher);
face.processEvents(1_s);
@@ -627,7 +626,7 @@
shared_ptr<SegmentFetcher> fetcher = SegmentFetcher::start(face, Interest("/hello/world"),
acceptValidator);
- face.onSendInterest.connect(bind(&SegmentFetcherFixture::onInterest, this, _1));
+ face.onSendInterest.connect(std::bind(&SegmentFetcherFixture::onInterest, this, _1));
connectSignals(fetcher);
face.processEvents(1_s);
@@ -652,7 +651,7 @@
shared_ptr<SegmentFetcher> fetcher = SegmentFetcher::start(face, Interest("/hello/world"),
acceptValidator);
- face.onSendInterest.connect(bind(&SegmentFetcherFixture::onInterest, this, _1));
+ face.onSendInterest.connect(std::bind(&SegmentFetcherFixture::onInterest, this, _1));
connectSignals(fetcher);
face.processEvents(1_s);
@@ -672,7 +671,7 @@
segmentsToDropOrNack.push(0);
sendNackInsteadOfDropping = true;
nackReason = lp::NackReason::NO_ROUTE;
- face.onSendInterest.connect(bind(&SegmentFetcherFixture::onInterest, this, _1));
+ face.onSendInterest.connect(std::bind(&SegmentFetcherFixture::onInterest, this, _1));
shared_ptr<SegmentFetcher> fetcher = SegmentFetcher::start(face, Interest("/hello/world"),
acceptValidator);
diff --git a/tests/unit/util/signal.t.cpp b/tests/unit/util/signal.t.cpp
index 2c53336..b3640f9 100644
--- a/tests/unit/util/signal.t.cpp
+++ b/tests/unit/util/signal.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2019 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,6 +23,8 @@
#include "tests/boost-test.hpp"
+#include <boost/concept_check.hpp>
+
namespace ndn {
namespace util {
namespace signal {
@@ -117,19 +119,16 @@
class RefObject
{
public:
- RefObject()
- {
- }
+ RefObject() = default;
- RefObject(const RefObject& other)
+ RefObject(const RefObject&)
{
++s_copyCount;
}
public:
- static int s_copyCount;
+ static inline int s_copyCount = 0;
};
-int RefObject::s_copyCount = 0;
// Signal passes arguments by reference,
// but it also allows a handler that accept arguments by value
@@ -446,6 +445,8 @@
BOOST_AUTO_TEST_CASE(ConnectionEquality)
{
+ BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Connection>));
+
SignalOwner0 so;
Connection conn1, conn2;