tests+tools: minor code cleanup
Change-Id: Ic3356d4a18a8e5eeb45fc076fc0563c3d1549c8a
diff --git a/tests/daemon/rib/readvertise/host-to-gateway-readvertise-policy.t.cpp b/tests/daemon/rib/readvertise/host-to-gateway-readvertise-policy.t.cpp
index 94120c0..494eac2 100644
--- a/tests/daemon/rib/readvertise/host-to-gateway-readvertise-policy.t.cpp
+++ b/tests/daemon/rib/readvertise/host-to-gateway-readvertise-policy.t.cpp
@@ -96,16 +96,16 @@
BOOST_AUTO_TEST_CASE(LoadRefreshInterval)
{
auto policy = makePolicy();
- BOOST_CHECK_EQUAL(policy->getRefreshInterval(), time::seconds(25)); // default setting is 25
+ BOOST_CHECK_EQUAL(policy->getRefreshInterval(), 25_s); // default setting is 25
ConfigSection section;
section.put("refresh_interval_wrong", 10);
policy = makePolicy(section);
- BOOST_CHECK_EQUAL(policy->getRefreshInterval(), time::seconds(25)); // wrong formate
+ BOOST_CHECK_EQUAL(policy->getRefreshInterval(), 25_s); // wrong formate
section.put("refresh_interval", 10);
policy = makePolicy(section);
- BOOST_CHECK_EQUAL(policy->getRefreshInterval(), time::seconds(10));
+ BOOST_CHECK_EQUAL(policy->getRefreshInterval(), 10_s);
}
BOOST_AUTO_TEST_SUITE_END() // TestHostToGatewayReadvertisePolicy
diff --git a/tests/daemon/rib/readvertise/nfd-rib-readvertise-destination.t.cpp b/tests/daemon/rib/readvertise/nfd-rib-readvertise-destination.t.cpp
index 690a53b..5a64bbe 100644
--- a/tests/daemon/rib/readvertise/nfd-rib-readvertise-destination.t.cpp
+++ b/tests/daemon/rib/readvertise/nfd-rib-readvertise-destination.t.cpp
@@ -125,7 +125,7 @@
const Name RIB_REGISTER_COMMAND_PREFIX("/localhost/nlsr/rib/register");
dest.advertise(rr, successCallback, failureCallback);
- advanceClocks(time::milliseconds(100));
+ advanceClocks(100_ms);
// Retrieve the sent Interest to build the response
BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
@@ -142,7 +142,7 @@
auto responseData = makeData(sentInterest.getName());
responseData->setContent(responsePayload.wireEncode());
face.receive(*responseData);
- this->advanceClocks(time::milliseconds(10));
+ this->advanceClocks(10_ms);
scenario.checkCommandOutcome(this);
}
@@ -203,7 +203,7 @@
const Name RIB_UNREGISTER_COMMAND_PREFIX("/localhost/nlsr/rib/unregister");
dest.withdraw(rr, successCallback, failureCallback);
- this->advanceClocks(time::milliseconds(10));
+ this->advanceClocks(10_ms);
// Retrieve the sent Interest to build the response
BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
@@ -220,7 +220,7 @@
responseData->setContent(responsePayload.wireEncode());
face.receive(*responseData);
- this->advanceClocks(time::milliseconds(1));
+ this->advanceClocks(1_ms);
scenario.checkCommandOutcome(this);
}
@@ -236,13 +236,13 @@
BOOST_CHECK_EQUAL(dest.isAvailable(), false);
rib.insert(commandPrefix, route);
- this->advanceClocks(time::milliseconds(100));
+ this->advanceClocks(100_ms);
BOOST_CHECK_EQUAL(dest.isAvailable(), true);
BOOST_REQUIRE_EQUAL(availabilityChangeHistory.size(), 1);
BOOST_CHECK_EQUAL(availabilityChangeHistory.back(), true);
rib.erase(commandPrefix, route);
- this->advanceClocks(time::milliseconds(100));
+ this->advanceClocks(100_ms);
BOOST_CHECK_EQUAL(dest.isAvailable(), false);
BOOST_REQUIRE_EQUAL(availabilityChangeHistory.size(), 2);
BOOST_CHECK_EQUAL(availabilityChangeHistory.back(), false);
diff --git a/tests/daemon/rib/readvertise/readvertise.t.cpp b/tests/daemon/rib/readvertise/readvertise.t.cpp
index 090bd5a..1988a20 100644
--- a/tests/daemon/rib/readvertise/readvertise.t.cpp
+++ b/tests/daemon/rib/readvertise/readvertise.t.cpp
@@ -133,7 +133,7 @@
route.faceId = faceId;
route.origin = origin;
m_rib.insert(prefix, route);
- this->advanceClocks(time::milliseconds(6));
+ this->advanceClocks(6_ms);
}
void
@@ -143,14 +143,14 @@
route.faceId = faceId;
route.origin = origin;
m_rib.erase(prefix, route);
- this->advanceClocks(time::milliseconds(6));
+ this->advanceClocks(6_ms);
}
void
setDestinationAvailability(bool isAvailable)
{
destination->setAvailability(isAvailable);
- this->advanceClocks(time::milliseconds(6));
+ this->advanceClocks(6_ms);
}
protected:
@@ -181,7 +181,7 @@
// refresh every 60 seconds
destination->advertiseHistory.clear();
- this->advanceClocks(time::seconds(61), 5);
+ this->advanceClocks(61_s, 5);
BOOST_CHECK_EQUAL(destination->advertiseHistory.size(), 5);
// /A is still needed by /A/2 route
@@ -244,7 +244,7 @@
policy->decision = ReadvertiseAction{"/A", ndn::security::SigningInfo()};
this->insertRoute("/A/1", 1, ndn::nfd::ROUTE_ORIGIN_CLIENT);
- this->advanceClocks(time::seconds(10), time::seconds(3600));
+ this->advanceClocks(10_s, 1_h);
BOOST_REQUIRE_GT(destination->advertiseHistory.size(), 2);
// destination->advertise keeps failing, so interval should increase
@@ -260,12 +260,12 @@
}
destination->shouldSucceed = true;
- this->advanceClocks(time::seconds(3600));
+ this->advanceClocks(1_h);
destination->advertiseHistory.clear();
// destination->advertise has succeeded, retry interval should reset to initial
destination->shouldSucceed = false;
- this->advanceClocks(time::seconds(10), time::seconds(300));
+ this->advanceClocks(10_s, 300_s);
BOOST_REQUIRE_GE(destination->advertiseHistory.size(), 2);
FloatInterval restartInterval = destination->advertiseHistory[1].timestamp -
destination->advertiseHistory[0].timestamp;
@@ -277,7 +277,7 @@
destination->shouldSucceed = false;
policy->decision = ReadvertiseAction{"/A", ndn::security::SigningInfo()};
this->insertRoute("/A/1", 1, ndn::nfd::ROUTE_ORIGIN_CLIENT);
- this->advanceClocks(time::seconds(10), time::seconds(300));
+ this->advanceClocks(10_s, 300_s);
BOOST_CHECK_GT(destination->advertiseHistory.size(), 0);
BOOST_CHECK_EQUAL(destination->withdrawHistory.size(), 0);
@@ -285,7 +285,7 @@
destination->advertiseHistory.clear();
destination->withdrawHistory.clear();
this->eraseRoute("/A/1", 1, ndn::nfd::ROUTE_ORIGIN_CLIENT);
- this->advanceClocks(time::seconds(10), time::seconds(300));
+ this->advanceClocks(10_s, 300_s);
BOOST_CHECK_EQUAL(destination->advertiseHistory.size(), 0); // don't try to advertise
BOOST_CHECK_GT(destination->withdrawHistory.size(), 0); // try to withdraw
@@ -293,7 +293,7 @@
destination->advertiseHistory.clear();
destination->withdrawHistory.clear();
this->insertRoute("/A/1", 1, ndn::nfd::ROUTE_ORIGIN_CLIENT);
- this->advanceClocks(time::seconds(10), time::seconds(300));
+ this->advanceClocks(10_s, 300_s);
BOOST_CHECK_GT(destination->advertiseHistory.size(), 0); // try to advertise
BOOST_CHECK_EQUAL(destination->withdrawHistory.size(), 0); // don't try to withdraw
}