Slim down `common.hpp`
Change-Id: Ic9843a1b9ffc5b5b1fa6062c8250ba28c6aaa898
diff --git a/tests/chunks/consumer.t.cpp b/tests/chunks/consumer.t.cpp
index b1231dc..741ee03 100644
--- a/tests/chunks/consumer.t.cpp
+++ b/tests/chunks/consumer.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2023, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -99,7 +99,7 @@
Consumer cons(security::getAcceptAllValidator(), output);
auto interest = makeInterest(name, true);
- std::vector<shared_ptr<Data>> dataStore;
+ std::vector<std::shared_ptr<Data>> dataStore;
for (size_t i = 0; i < testStrings.size(); ++i) {
auto data = makeData(Name(name).appendVersion(1).appendSegment(i));
@@ -153,8 +153,8 @@
Consumer consumer(security::getAcceptAllValidator());
Name prefix = Name("/ndn/chunks/test").appendVersion(1);
- auto discover = make_unique<DiscoverVersion>(face, prefix, options);
- auto pipeline = make_unique<PipelineInterestsDummy>(face, options);
+ auto discover = std::make_unique<DiscoverVersion>(face, prefix, options);
+ auto pipeline = std::make_unique<PipelineInterestsDummy>(face, options);
auto pipelinePtr = pipeline.get();
BOOST_CHECK_EQUAL(pipelinePtr->isPipelineRunning, false);
diff --git a/tests/chunks/discover-version.t.cpp b/tests/chunks/discover-version.t.cpp
index 01e360e..6b429b8 100644
--- a/tests/chunks/discover-version.t.cpp
+++ b/tests/chunks/discover-version.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2023, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -42,7 +42,7 @@
void
run(const Name& prefix)
{
- discover = make_unique<DiscoverVersion>(face, prefix, opt);
+ discover = std::make_unique<DiscoverVersion>(face, prefix, opt);
discover->onDiscoverySuccess.connect([this] (const Name& versionedName) {
isDiscoveryFinished = true;
discoveredName = versionedName;
@@ -62,7 +62,7 @@
const uint64_t version = 1449227841747;
DummyClientFace face{m_io};
Options opt;
- unique_ptr<DiscoverVersion> discover;
+ std::unique_ptr<DiscoverVersion> discover;
std::optional<Name> discoveredName;
std::optional<uint64_t> discoveredVersion;
bool isDiscoveryFinished = false;
diff --git a/tests/chunks/pipeline-interests-aimd.t.cpp b/tests/chunks/pipeline-interests-aimd.t.cpp
index 12eeaa5..4688ee4 100644
--- a/tests/chunks/pipeline-interests-aimd.t.cpp
+++ b/tests/chunks/pipeline-interests-aimd.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2022, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -29,6 +29,8 @@
#include "pipeline-interests-fixture.hpp"
+#include <cmath>
+
namespace ndn::chunks::tests {
using namespace ndn::tests;
@@ -45,16 +47,16 @@
void
createPipeline()
{
- auto pline = make_unique<PipelineInterestsAimd>(face, rttEstimator, opt);
+ auto pline = std::make_unique<PipelineInterestsAimd>(face, rttEstimator, opt);
pipeline = pline.get();
setPipeline(std::move(pline));
}
private:
- static shared_ptr<RttEstimatorWithStats::Options>
+ static std::shared_ptr<RttEstimatorWithStats::Options>
makeRttEstimatorOptions()
{
- auto rttOptions = make_shared<RttEstimatorWithStats::Options>();
+ auto rttOptions = std::make_shared<RttEstimatorWithStats::Options>();
rttOptions->alpha = 0.125;
rttOptions->beta = 0.25;
rttOptions->k = 4;
@@ -118,7 +120,7 @@
for (uint64_t i = pipeline->m_ssthresh; i < nDataSegments - 1; ++i) { // congestion avoidance
face.receive(*makeDataWithSegment(i));
advanceClocks(time::nanoseconds(1));
- BOOST_CHECK_CLOSE(pipeline->m_cwnd - preCwnd, opt.aiStep / floor(preCwnd), MARGIN);
+ BOOST_CHECK_CLOSE(pipeline->m_cwnd - preCwnd, opt.aiStep / std::floor(preCwnd), MARGIN);
preCwnd = pipeline->m_cwnd;
}
diff --git a/tests/chunks/pipeline-interests-cubic.t.cpp b/tests/chunks/pipeline-interests-cubic.t.cpp
index d84cce5..6a36105 100644
--- a/tests/chunks/pipeline-interests-cubic.t.cpp
+++ b/tests/chunks/pipeline-interests-cubic.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2022, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -45,16 +45,16 @@
void
createPipeline()
{
- auto pline = make_unique<PipelineInterestsCubic>(face, rttEstimator, opt);
+ auto pline = std::make_unique<PipelineInterestsCubic>(face, rttEstimator, opt);
pipeline = pline.get();
setPipeline(std::move(pline));
}
private:
- static shared_ptr<RttEstimatorWithStats::Options>
+ static std::shared_ptr<RttEstimatorWithStats::Options>
makeRttEstimatorOptions()
{
- auto rttOptions = make_shared<RttEstimatorWithStats::Options>();
+ auto rttOptions = std::make_shared<RttEstimatorWithStats::Options>();
rttOptions->alpha = 0.125;
rttOptions->beta = 0.25;
rttOptions->k = 8;
diff --git a/tests/chunks/pipeline-interests-fixed.t.cpp b/tests/chunks/pipeline-interests-fixed.t.cpp
index b4f9723..24f14e9 100644
--- a/tests/chunks/pipeline-interests-fixed.t.cpp
+++ b/tests/chunks/pipeline-interests-fixed.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2022, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -29,6 +29,8 @@
#include "pipeline-interests-fixture.hpp"
+#include <cmath>
+
namespace ndn::chunks::tests {
class PipelineInterestFixedFixture : public PipelineInterestsFixture
@@ -46,7 +48,7 @@
void
createPipeline()
{
- auto pline = make_unique<PipelineInterestsFixed>(face, opt);
+ auto pline = std::make_unique<PipelineInterestsFixed>(face, opt);
pipeline = pline.get();
setPipeline(std::move(pline));
}
@@ -187,7 +189,7 @@
BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize * 3 - 2);
// nack for the first pipeline element (segment #0)
- auto nack = make_shared<lp::Nack>(face.sentInterests[opt.maxPipelineSize]);
+ auto nack = std::make_shared<lp::Nack>(face.sentInterests[opt.maxPipelineSize]);
nack->setReason(lp::NackReason::DUPLICATE);
face.receive(*nack);
@@ -232,7 +234,7 @@
advanceClocks(opt.interestLifetime);
// nack for the first pipeline element (segment #0)
- auto nack = make_shared<lp::Nack>(face.sentInterests[opt.maxPipelineSize]);
+ auto nack = std::make_shared<lp::Nack>(face.sentInterests[opt.maxPipelineSize]);
nack->setReason(lp::NackReason::DUPLICATE);
face.receive(*nack);
BOOST_CHECK_EQUAL(hasFailed, false);
@@ -261,7 +263,7 @@
// send nack for all the pipeline elements first interest
for (size_t i = 0; i < opt.maxPipelineSize; i++) {
- auto nack = make_shared<lp::Nack>(face.sentInterests[i]);
+ auto nack = std::make_shared<lp::Nack>(face.sentInterests[i]);
nack->setReason(lp::NackReason::CONGESTION);
face.receive(*nack);
advanceClocks(time::nanoseconds(1));
@@ -283,7 +285,7 @@
}
for (size_t j = 0; j < opt.maxPipelineSize; j++) {
- auto nack = make_shared<lp::Nack>(face.sentInterests[(opt.maxPipelineSize * i) + j]);
+ auto nack = std::make_shared<lp::Nack>(face.sentInterests[(opt.maxPipelineSize * i) + j]);
nack->setReason(lp::NackReason::CONGESTION);
face.receive(*nack);
advanceClocks(time::nanoseconds(1));
diff --git a/tests/chunks/pipeline-interests-fixture.hpp b/tests/chunks/pipeline-interests-fixture.hpp
index 215f544..4e42223 100644
--- a/tests/chunks/pipeline-interests-fixture.hpp
+++ b/tests/chunks/pipeline-interests-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2023, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -44,21 +44,21 @@
{
protected:
void
- setPipeline(unique_ptr<PipelineInterests> pline)
+ setPipeline(std::unique_ptr<PipelineInterests> pline)
{
m_pipeline = std::move(pline);
}
- shared_ptr<Data>
+ std::shared_ptr<Data>
makeDataWithSegment(uint64_t segmentNo, bool setFinalBlockId = true) const
{
- auto data = make_shared<Data>(Name(name).appendVersion(0).appendSegment(segmentNo));
+ auto data = std::make_shared<Data>(Name(name).appendVersion(0).appendSegment(segmentNo));
if (setFinalBlockId)
data->setFinalBlock(name::Component::fromSegment(nDataSegments - 1));
return signData(data);
}
- shared_ptr<Data>
+ std::shared_ptr<Data>
makeDataWithSegmentAndCongMark(uint64_t segmentNo,
uint64_t congestionMark = 1,
bool setFinalBlockId = true) const
@@ -83,7 +83,7 @@
bool hasFailed = false;
private:
- unique_ptr<PipelineInterests> m_pipeline;
+ std::unique_ptr<PipelineInterests> m_pipeline;
};
} // namespace ndn::chunks::tests