tests+tools: minor code cleanup
Change-Id: Ic3356d4a18a8e5eeb45fc076fc0563c3d1549c8a
diff --git a/tests/tools/nfdc/forwarder-general-module.t.cpp b/tests/tools/nfdc/forwarder-general-module.t.cpp
index ed87b71..ad282a3 100644
--- a/tests/tools/nfdc/forwarder-general-module.t.cpp
+++ b/tests/tools/nfdc/forwarder-general-module.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, Regents of the University of California,
+ * Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -91,8 +91,8 @@
this->fetchStatus();
ForwarderStatus payload;
payload.setNfdVersion("0.4.1-1-g704430c")
- .setStartTimestamp(time::fromUnixTimestamp(time::milliseconds(1466781226856)))
- .setCurrentTimestamp(time::fromUnixTimestamp(time::milliseconds(1468778154109)))
+ .setStartTimestamp(time::fromUnixTimestamp(1466781226856_ms))
+ .setCurrentTimestamp(time::fromUnixTimestamp(1468778154109_ms))
.setNNameTreeEntries(668)
.setNFibEntries(70)
.setNPitEntries(7)
diff --git a/tests/tools/nfdc/rib-module.t.cpp b/tests/tools/nfdc/rib-module.t.cpp
index 919b43a..624fca6 100644
--- a/tests/tools/nfdc/rib-module.t.cpp
+++ b/tests/tools/nfdc/rib-module.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018, Regents of the University of California,
+ * Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -53,7 +53,7 @@
.setOrigin(ndn::nfd::ROUTE_ORIGIN_CLIENT)
.setCost(2956)
.setFlags(ndn::nfd::ROUTE_FLAG_CHILD_INHERIT | ndn::nfd::ROUTE_FLAG_CAPTURE)
- .setExpirationPeriod(time::milliseconds(29950035)));
+ .setExpirationPeriod(29950035_ms));
entry1.addRoute(Route()
.setFaceId(6720)
.setOrigin(ndn::nfd::ROUTE_ORIGIN_STATIC)
@@ -248,10 +248,10 @@
BOOST_CHECK_EQUAL(req.getFlags(), ndn::nfd::ROUTE_FLAG_CHILD_INHERIT |
ndn::nfd::ROUTE_FLAG_CAPTURE);
BOOST_REQUIRE_EQUAL(req.hasExpirationPeriod(), true);
- BOOST_REQUIRE_EQUAL(req.getExpirationPeriod(), time::milliseconds(727411987));
+ BOOST_REQUIRE_EQUAL(req.getExpirationPeriod(), 727411987_ms);
ControlParameters resp = req;
- resp.setExpirationPeriod(time::milliseconds(727411154)); // server side may change expiration
+ resp.setExpirationPeriod(727411154_ms); // server side may change expiration
this->succeedCommand(interest, resp);
};
@@ -530,7 +530,7 @@
.setOrigin(ndn::nfd::ROUTE_ORIGIN_STATIC)
.setCost(79)
.setFlags(ndn::nfd::ROUTE_FLAG_CHILD_INHERIT)
- .setExpirationPeriod(time::milliseconds(47292)));
+ .setExpirationPeriod(47292_ms));
RibEntry payload2;
payload2.setName("/localhost/nfd")
.addRoute(Route().setFaceId(258)
diff --git a/tests/tools/nfdc/status-fixture.hpp b/tests/tools/nfdc/status-fixture.hpp
index e1974b9..f33f6bb 100644
--- a/tests/tools/nfdc/status-fixture.hpp
+++ b/tests/tools/nfdc/status-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, Regents of the University of California,
+ * Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -28,6 +28,7 @@
#include "mock-nfd-mgmt-fixture.hpp"
#include "nfdc/module.hpp"
+
#include <ndn-cxx/security/validator-null.hpp>
namespace nfd {
@@ -87,7 +88,7 @@
BOOST_FAIL("fetchStatus failure " << code << " " << reason);
},
CommandOptions());
- this->advanceClocks(time::milliseconds(1));
+ this->advanceClocks(1_ms);
}
/** \brief prepare status output as XML and text
@@ -96,7 +97,7 @@
void
prepareStatusOutput()
{
- this->advanceClocks(time::milliseconds(1));
+ this->advanceClocks(1_ms);
BOOST_REQUIRE_EQUAL(nFetchStatusSuccess, 1);
statusXml.str("");
diff --git a/tests/tools/nfdc/status-report.t.cpp b/tests/tools/nfdc/status-report.t.cpp
index 7c8e32c..5041fb3 100644
--- a/tests/tools/nfdc/status-report.t.cpp
+++ b/tests/tools/nfdc/status-report.t.cpp
@@ -52,7 +52,7 @@
: m_moduleName(moduleName)
, m_scheduler(io)
, m_res(0)
- , m_delay(time::milliseconds(1))
+ , m_delay(1_ms)
{
}
@@ -174,11 +174,11 @@
BOOST_AUTO_TEST_CASE(Normal)
{
DummyModule& m1 = addModule("module1");
- m1.setResult(0, time::milliseconds(10));
+ m1.setResult(0, 10_ms);
DummyModule& m2 = addModule("module2");
- m2.setResult(0, time::milliseconds(20));
+ m2.setResult(0, 20_ms);
- this->collect(time::milliseconds(5), 6);
+ this->collect(5_ms, 6);
BOOST_CHECK_EQUAL(m1.nFetchStatusCalls, 1);
BOOST_CHECK_EQUAL(m2.nFetchStatusCalls, 1);
@@ -191,11 +191,11 @@
BOOST_AUTO_TEST_CASE(Reorder)
{
DummyModule& m1 = addModule("module1");
- m1.setResult(0, time::milliseconds(20));
+ m1.setResult(0, 20_ms);
DummyModule& m2 = addModule("module2");
- m2.setResult(0, time::milliseconds(10)); // module2 completes earlier than module1
+ m2.setResult(0, 10_ms); // module2 completes earlier than module1
- this->collect(time::milliseconds(5), 6);
+ this->collect(5_ms, 6);
BOOST_CHECK_EQUAL(res, 0);
BOOST_CHECK(statusXml.is_equal(STATUS_XML)); // output is still in order
@@ -205,11 +205,11 @@
BOOST_AUTO_TEST_CASE(Error)
{
DummyModule& m1 = addModule("module1");
- m1.setResult(0, time::milliseconds(20));
+ m1.setResult(0, 20_ms);
DummyModule& m2 = addModule("module2");
- m2.setResult(500, time::milliseconds(10));
+ m2.setResult(500, 10_ms);
- this->collect(time::milliseconds(5), 6);
+ this->collect(5_ms, 6);
BOOST_CHECK_EQUAL(res, 1000500);
}