util: add literal operators for duration types
Change-Id: I007fa61c80e535c6e4b12e85a32eeeee62fecc3c
Refs: #4468
diff --git a/tests/unit-tests/mgmt/dispatcher.t.cpp b/tests/unit-tests/mgmt/dispatcher.t.cpp
index 535e8bd..9f8d34d 100644
--- a/tests/unit-tests/mgmt/dispatcher.t.cpp
+++ b/tests/unit-tests/mgmt/dispatcher.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2017 Regents of the University of California.
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -158,49 +158,49 @@
bind([&nCallbackCalled] { ++nCallbackCalled["test/2"]; }));
face.receive(*makeInterest("/root/1/test/1/%80%00"));
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 0);
BOOST_CHECK_EQUAL(nCallbackCalled["test/2"], 0);
dispatcher.addTopPrefix("/root/1");
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
face.receive(*makeInterest("/root/1/test/1/%80%00"));
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 1);
BOOST_CHECK_EQUAL(nCallbackCalled["test/2"], 0);
face.receive(*makeInterest("/root/1/test/2/%80%00"));
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 1);
BOOST_CHECK_EQUAL(nCallbackCalled["test/2"], 1);
face.receive(*makeInterest("/root/2/test/1/%80%00"));
face.receive(*makeInterest("/root/2/test/2/%80%00"));
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 1);
BOOST_CHECK_EQUAL(nCallbackCalled["test/2"], 1);
dispatcher.addTopPrefix("/root/2");
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
face.receive(*makeInterest("/root/1/test/1/%80%00"));
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 2);
face.receive(*makeInterest("/root/2/test/1/%80%00"));
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 3);
dispatcher.removeTopPrefix("/root/1");
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
face.receive(*makeInterest("/root/1/test/1/%80%00"));
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 3);
face.receive(*makeInterest("/root/2/test/1/%80%00"));
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
BOOST_CHECK_EQUAL(nCallbackCalled["test/1"], 4);
}
@@ -214,7 +214,7 @@
bind([&nCallbackCalled] { ++nCallbackCalled; }));
dispatcher.addTopPrefix("/root");
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
face.sentData.clear();
face.receive(*makeInterest("/root/test/%80%00")); // returns 403
@@ -222,7 +222,7 @@
face.receive(*makeInterest("/root/test/%80%00/silent")); // silently ignored
face.receive(*makeInterest("/root/test/.../invalid")); // silently ignored (wrong format)
face.receive(*makeInterest("/root/test/.../valid")); // silently ignored (wrong format)
- advanceClocks(time::milliseconds(1), 20);
+ advanceClocks(1_ms, 20);
BOOST_CHECK_EQUAL(nCallbackCalled, 0);
BOOST_CHECK_EQUAL(face.sentData.size(), 2);
@@ -232,7 +232,7 @@
BOOST_CHECK_EQUAL(ControlResponse(face.sentData[1].getContent().blockFromValue()).getCode(), 403);
face.receive(*makeInterest("/root/test/%80%00/valid"));
- advanceClocks(time::milliseconds(1), 10);
+ advanceClocks(1_ms, 10);
BOOST_CHECK_EQUAL(nCallbackCalled, 1);
}
@@ -290,15 +290,15 @@
bind([&nCallbackCalled] { ++nCallbackCalled; }));
dispatcher.addTopPrefix("/root");
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
face.receive(*makeInterest("/root/test/%80%00"));
BOOST_CHECK_EQUAL(nCallbackCalled, 0);
BOOST_REQUIRE(authorizationAccept != nullptr);
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
authorizationAccept("");
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
BOOST_CHECK_EQUAL(nCallbackCalled, 1);
}
@@ -345,13 +345,13 @@
});
dispatcher.addTopPrefix("/root");
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
face.sentData.clear();
face.receive(*makeInterest("/root/test/small/%80%00")); // returns 403
face.receive(*makeInterest("/root/test/small/%80%00/invalid")); // returns 403
face.receive(*makeInterest("/root/test/small/%80%00/silent")); // silently ignored
- advanceClocks(time::milliseconds(1), 20);
+ advanceClocks(1_ms, 20);
BOOST_CHECK_EQUAL(face.sentData.size(), 2);
BOOST_CHECK(face.sentData[0].getContentType() == tlv::ContentType_Blob);
@@ -363,7 +363,7 @@
auto interestSmall = *makeInterest("/root/test/small/valid");
face.receive(interestSmall);
- advanceClocks(time::milliseconds(1), 10);
+ advanceClocks(1_ms, 10);
// one data packet is generated and sent to both places
BOOST_CHECK_EQUAL(face.sentData.size(), 1);
@@ -375,7 +375,7 @@
face.receive(*makeInterest(Name("/root/test/small/valid").appendVersion(10))); // should be ignored
face.receive(*makeInterest(Name("/root/test/small/valid").appendSegment(20))); // should be ignored
- advanceClocks(time::milliseconds(1), 10);
+ advanceClocks(1_ms, 10);
BOOST_CHECK_EQUAL(face.sentData.size(), 1);
BOOST_CHECK_EQUAL(storage.size(), 1);
@@ -390,7 +390,7 @@
storage.erase("/", true); // clear the storage
face.sentData.clear();
face.receive(*makeInterest("/root/test/large/valid"));
- advanceClocks(time::milliseconds(1), 10);
+ advanceClocks(1_ms, 10);
// two data packets are generated, the first one will be sent to both places
// while the second one will only be inserted into the in-memory storage
@@ -429,7 +429,7 @@
storage.erase("/", true);// clear the storage
face.sentData.clear();
face.receive(*makeInterest("/root/test/reject/%80%00/valid")); // returns nack
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
BOOST_CHECK_EQUAL(face.sentData.size(), 1);
BOOST_CHECK(face.sentData[0].getContentType() == tlv::ContentType_Nack);
BOOST_CHECK_EQUAL(ControlResponse(face.sentData[0].getContent().blockFromValue()).getCode(), 400);
@@ -443,22 +443,22 @@
auto post = dispatcher.addNotificationStream("test");
post(block);
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
BOOST_CHECK_EQUAL(face.sentData.size(), 0);
dispatcher.addTopPrefix("/root");
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
face.sentData.clear();
post(block);
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
BOOST_CHECK_EQUAL(face.sentData.size(), 1);
BOOST_CHECK_EQUAL(storage.size(), 1);
post(block);
post(block);
post(block);
- advanceClocks(time::milliseconds(1), 10);
+ advanceClocks(1_ms, 10);
BOOST_CHECK_EQUAL(face.sentData.size(), 4);
BOOST_CHECK_EQUAL(face.sentData[0].getName(), "/root/test/%FE%00");
diff --git a/tests/unit-tests/mgmt/nfd/command-options.t.cpp b/tests/unit-tests/mgmt/nfd/command-options.t.cpp
index 470cac9..e8fe76e 100644
--- a/tests/unit-tests/mgmt/nfd/command-options.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/command-options.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2016 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -37,15 +37,15 @@
CommandOptions co;
BOOST_CHECK_EQUAL(co.getTimeout(), CommandOptions::DEFAULT_TIMEOUT);
- co.setTimeout(time::milliseconds(7414));
- BOOST_CHECK_EQUAL(co.getTimeout(), time::milliseconds(7414));
+ co.setTimeout(7414_ms);
+ BOOST_CHECK_EQUAL(co.getTimeout(), 7414_ms);
BOOST_CHECK_THROW(co.setTimeout(time::milliseconds::zero()), std::out_of_range);
BOOST_CHECK_THROW(co.setTimeout(time::milliseconds(-1)), std::out_of_range);
- BOOST_CHECK_EQUAL(co.getTimeout(), time::milliseconds(7414)); // unchanged after throw
+ BOOST_CHECK_EQUAL(co.getTimeout(), 7414_ms); // unchanged after throw
- co.setTimeout(time::milliseconds(1));
- BOOST_CHECK_EQUAL(co.getTimeout(), time::milliseconds(1));
+ co.setTimeout(1_ms);
+ BOOST_CHECK_EQUAL(co.getTimeout(), 1_ms);
}
BOOST_AUTO_TEST_CASE(Prefix)
diff --git a/tests/unit-tests/mgmt/nfd/control-parameters.t.cpp b/tests/unit-tests/mgmt/nfd/control-parameters.t.cpp
index 8f8f98a..199ba3b 100644
--- a/tests/unit-tests/mgmt/nfd/control-parameters.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/control-parameters.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2017 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -111,7 +111,7 @@
.setOrigin(ROUTE_ORIGIN_NLSR)
.setCost(6)
.setFlags(0x01)
- .setExpirationPeriod(time::minutes(30));
+ .setExpirationPeriod(30_min);
Block wire = parameters.wireEncode();
@@ -121,7 +121,7 @@
BOOST_CHECK_EQUAL(decoded.getOrigin(), ROUTE_ORIGIN_NLSR);
BOOST_CHECK_EQUAL(decoded.getCost(), 6);
BOOST_CHECK_EQUAL(decoded.getFlags(), 0x01);
- BOOST_CHECK_EQUAL(decoded.getExpirationPeriod(), time::milliseconds(1800000));
+ BOOST_CHECK_EQUAL(decoded.getExpirationPeriod(), 1800000_ms);
BOOST_CHECK_EQUAL(decoded.hasUri(), false);
BOOST_CHECK_EQUAL(decoded.hasLocalUri(), false);
diff --git a/tests/unit-tests/mgmt/nfd/controller.t.cpp b/tests/unit-tests/mgmt/nfd/controller.t.cpp
index 92fcedd..e9a3c4f 100644
--- a/tests/unit-tests/mgmt/nfd/controller.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/controller.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2017 Regents of the University of California.
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -48,7 +48,7 @@
auto responseData = makeData(face.sentInterests.at(0).getName());
responseData->setContent(responsePayload.wireEncode());
face.receive(*responseData);
- this->advanceClocks(time::milliseconds(1));
+ this->advanceClocks(1_ms);
}
private:
@@ -86,7 +86,7 @@
parameters.setUri("tcp4://192.0.2.1:6363");
controller.start<FaceCreateCommand>(parameters, succeedCallback, commandFailCallback);
- this->advanceClocks(time::milliseconds(1));
+ this->advanceClocks(1_ms);
BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
const Interest& requestInterest = face.sentInterests[0];
@@ -119,7 +119,7 @@
parameters.setUri("tcp4://192.0.2.1:6363");
controller.start<FaceCreateCommand>(parameters, nullptr, commandFailCallback);
- this->advanceClocks(time::milliseconds(1));
+ this->advanceClocks(1_ms);
ControlParameters responseBody = makeFaceCreateResponse();
ControlResponse responsePayload(201, "created");
@@ -139,7 +139,7 @@
options.setPrefix("/localhop/net/example/router1/nfd");
controller.start<RibRegisterCommand>(parameters, succeedCallback, commandFailCallback, options);
- this->advanceClocks(time::milliseconds(1));
+ this->advanceClocks(1_ms);
BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
const Interest& requestInterest = face.sentInterests[0];
@@ -167,7 +167,7 @@
parameters.setUri("tcp4://192.0.2.1:6363");
controller.start<FaceCreateCommand>(parameters, succeedCallback, commandFailCallback);
- this->advanceClocks(time::milliseconds(1));
+ this->advanceClocks(1_ms);
ControlParameters responseBody = makeFaceCreateResponse();
ControlResponse responsePayload(201, "created");
@@ -185,7 +185,7 @@
parameters.setUri("tcp4://192.0.2.1:6363");
controller.start<FaceCreateCommand>(parameters, succeedCallback, commandFailCallback);
- this->advanceClocks(time::milliseconds(1));
+ this->advanceClocks(1_ms);
ControlResponse responsePayload(401, "Not Authenticated");
this->respond(responsePayload);
@@ -201,7 +201,7 @@
parameters.setUri("tcp4://192.0.2.1:6363");
controller.start<FaceCreateCommand>(parameters, succeedCallback, commandFailCallback);
- this->advanceClocks(time::milliseconds(1));
+ this->advanceClocks(1_ms);
ControlParameters responseBody = makeFaceCreateResponse();
responseBody.unsetFaceId() // FaceId is missing
@@ -220,14 +220,14 @@
parameters.setUri("tcp4://192.0.2.1:6363");
controller.start<FaceCreateCommand>(parameters, succeedCallback, commandFailCallback);
- this->advanceClocks(time::milliseconds(1));
+ this->advanceClocks(1_ms);
BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
const Interest& requestInterest = face.sentInterests[0];
auto responseNack = makeNack(requestInterest, lp::NackReason::NO_ROUTE);
face.receive(responseNack);
- this->advanceClocks(time::milliseconds(1));
+ this->advanceClocks(1_ms);
BOOST_REQUIRE_EQUAL(failCodes.size(), 1);
BOOST_CHECK_EQUAL(failCodes.back(), Controller::ERROR_NACK);
@@ -239,11 +239,11 @@
parameters.setUri("tcp4://192.0.2.1:6363");
CommandOptions options;
- options.setTimeout(time::milliseconds(50));
+ options.setTimeout(50_ms);
controller.start<FaceCreateCommand>(parameters, succeedCallback, commandFailCallback, options);
- this->advanceClocks(time::milliseconds(1)); // express Interest
- this->advanceClocks(time::milliseconds(51)); // timeout
+ this->advanceClocks(1_ms); // express Interest
+ this->advanceClocks(51_ms); // timeout
BOOST_REQUIRE_EQUAL(failCodes.size(), 1);
BOOST_CHECK_EQUAL(failCodes.back(), Controller::ERROR_TIMEOUT);
@@ -255,11 +255,11 @@
parameters.setUri("tcp4://192.0.2.1:6363");
CommandOptions options;
- options.setTimeout(time::milliseconds(50));
+ options.setTimeout(50_ms);
controller.start<FaceCreateCommand>(parameters, succeedCallback, nullptr, options);
- this->advanceClocks(time::milliseconds(1)); // express Interest
- this->advanceClocks(time::milliseconds(51)); // timeout
+ this->advanceClocks(1_ms); // express Interest
+ this->advanceClocks(51_ms); // timeout
BOOST_CHECK_EQUAL(succeeds.size(), 0);
}
diff --git a/tests/unit-tests/mgmt/nfd/face-status.t.cpp b/tests/unit-tests/mgmt/nfd/face-status.t.cpp
index 16fe108..dee1de2 100644
--- a/tests/unit-tests/mgmt/nfd/face-status.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/face-status.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2017 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -42,7 +42,7 @@
.setFaceScope(FACE_SCOPE_LOCAL)
.setFacePersistency(FACE_PERSISTENCY_ON_DEMAND)
.setLinkType(LINK_TYPE_MULTI_ACCESS)
- .setExpirationPeriod(time::seconds(10))
+ .setExpirationPeriod(10_s)
.setNInInterests(10)
.setNInData(200)
.setNInNacks(1)
@@ -135,9 +135,9 @@
FaceStatus status;
BOOST_CHECK_EQUAL(status.hasExpirationPeriod(), false);
- status.setExpirationPeriod(time::minutes(1));
+ status.setExpirationPeriod(1_min);
BOOST_REQUIRE_EQUAL(status.hasExpirationPeriod(), true);
- BOOST_CHECK_EQUAL(status.getExpirationPeriod(), time::minutes(1));
+ BOOST_CHECK_EQUAL(status.getExpirationPeriod(), 1_min);
status.unsetExpirationPeriod();
BOOST_CHECK_EQUAL(status.hasExpirationPeriod(), false);
diff --git a/tests/unit-tests/mgmt/nfd/rib-entry.t.cpp b/tests/unit-tests/mgmt/nfd/rib-entry.t.cpp
index 15c14d1..f2ab51a 100644
--- a/tests/unit-tests/mgmt/nfd/rib-entry.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/rib-entry.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2017 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -48,13 +48,13 @@
return RibEntry()
.setName("/hello/world")
.addRoute(makeRoute()
- .setExpirationPeriod(time::seconds(10)));
+ .setExpirationPeriod(10_s));
}
BOOST_AUTO_TEST_CASE(RouteEncode)
{
Route route1 = makeRoute();
- route1.setExpirationPeriod(time::seconds(10));
+ route1.setExpirationPeriod(10_s);
const Block& wire = route1.wireEncode();
static const uint8_t expected[] = {
@@ -89,15 +89,15 @@
BOOST_CHECK_EQUAL(route.hasExpirationPeriod(), false);
BOOST_CHECK_EQUAL(route.getExpirationPeriod(), time::milliseconds::max());
- route.setExpirationPeriod(time::minutes(1));
+ route.setExpirationPeriod(1_min);
BOOST_CHECK_EQUAL(route.hasExpirationPeriod(), true);
- BOOST_CHECK_EQUAL(route.getExpirationPeriod(), time::minutes(1));
+ BOOST_CHECK_EQUAL(route.getExpirationPeriod(), 1_min);
route.setExpirationPeriod(time::milliseconds::max());
BOOST_CHECK_EQUAL(route.hasExpirationPeriod(), false);
BOOST_CHECK_EQUAL(route.getExpirationPeriod(), time::milliseconds::max());
- route.setExpirationPeriod(time::minutes(1));
+ route.setExpirationPeriod(1_min);
BOOST_CHECK_EQUAL(route.hasExpirationPeriod(), true);
route.unsetExpirationPeriod();
@@ -116,7 +116,7 @@
BOOST_CHECK_NE(route1, route2);
route2 = route1;
- route2.setExpirationPeriod(time::minutes(1));
+ route2.setExpirationPeriod(1_min);
BOOST_CHECK_NE(route1, route2);
}
@@ -128,7 +128,7 @@
.setOrigin(ROUTE_ORIGIN_APP)
.setCost(32)
.setFlags(ROUTE_FLAG_CHILD_INHERIT)
- .setExpirationPeriod(time::seconds(5)));
+ .setExpirationPeriod(5_s));
const Block& wire = entry1.wireEncode();
static const uint8_t expected[] = {
diff --git a/tests/unit-tests/mgmt/nfd/status-dataset.t.cpp b/tests/unit-tests/mgmt/nfd/status-dataset.t.cpp
index 990f7f1..2abbdaa 100644
--- a/tests/unit-tests/mgmt/nfd/status-dataset.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/status-dataset.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2017 Regents of the University of California.
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -110,12 +110,12 @@
BOOST_AUTO_TEST_CASE(Timeout)
{
CommandOptions options;
- options.setTimeout(time::milliseconds(3000));
+ options.setTimeout(3000_ms);
controller.fetch<FaceDataset>(
[] (const std::vector<FaceStatus>& result) { BOOST_FAIL("fetchDataset should not succeed"); },
datasetFailCallback,
options);
- this->advanceClocks(time::milliseconds(500), 7);
+ this->advanceClocks(500_ms, 7);
BOOST_REQUIRE_EQUAL(failCodes.size(), 1);
BOOST_CHECK_EQUAL(failCodes.back(), Controller::ERROR_TIMEOUT);
@@ -126,10 +126,10 @@
controller.fetch<FaceDataset>(
[] (const std::vector<FaceStatus>& result) { BOOST_FAIL("fetchDataset should not succeed"); },
datasetFailCallback);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
face.receive(*makeData("/localhost/nfd/faces/list/%FD%00"));
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
BOOST_REQUIRE_EQUAL(failCodes.size(), 1);
BOOST_CHECK_EQUAL(failCodes.back(), Controller::ERROR_SERVER);
@@ -142,12 +142,12 @@
controller.fetch<FaceDataset>(
[] (const std::vector<FaceStatus>& result) { BOOST_FAIL("fetchDataset should not succeed"); },
datasetFailCallback);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
FaceStatus payload;
payload.setFaceId(5744);
this->sendDataset("/localhost/nfd/faces/list", payload);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
BOOST_REQUIRE_EQUAL(failCodes.size(), 1);
BOOST_CHECK_EQUAL(failCodes.back(), Controller::ERROR_VALIDATION);
@@ -158,11 +158,11 @@
controller.fetch<FaceDataset>(
[] (const std::vector<FaceStatus>& result) { BOOST_FAIL("fetchDataset should not succeed"); },
datasetFailCallback);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
face.receive(lp::Nack(face.sentInterests.back()));
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
BOOST_REQUIRE_EQUAL(failCodes.size(), 1);
BOOST_CHECK_EQUAL(failCodes.back(), Controller::ERROR_NACK);
@@ -173,11 +173,11 @@
controller.fetch<FaceDataset>(
[] (const std::vector<FaceStatus>& result) { BOOST_FAIL("fetchDataset should not succeed"); },
datasetFailCallback);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
Name payload; // Name is not valid FaceStatus
this->sendDataset("/localhost/nfd/faces/list", payload);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
BOOST_REQUIRE_EQUAL(failCodes.size(), 1);
BOOST_CHECK_EQUAL(failCodes.back(), Controller::ERROR_SERVER);
@@ -188,13 +188,13 @@
controller.fetch<FaceDataset>(
[] (const std::vector<FaceStatus>& result) { BOOST_FAIL("fetchDataset should not succeed"); },
datasetFailCallback);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
FaceStatus payload1;
payload1.setFaceId(10930);
Name payload2; // Name is not valid FaceStatus
this->sendDataset("/localhost/nfd/faces/list", payload1, payload2);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
BOOST_REQUIRE_EQUAL(failCodes.size(), 1);
BOOST_CHECK_EQUAL(failCodes.back(), Controller::ERROR_SERVER);
@@ -209,12 +209,12 @@
controller.fetch<FaceDataset>(
nullptr,
datasetFailCallback);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
FaceStatus payload;
payload.setFaceId(2577);
this->sendDataset("/localhost/nfd/faces/list", payload);
- BOOST_CHECK_NO_THROW(this->advanceClocks(time::milliseconds(500)));
+ BOOST_CHECK_NO_THROW(this->advanceClocks(500_ms));
BOOST_CHECK_EQUAL(failCodes.size(), 0);
}
@@ -222,12 +222,12 @@
BOOST_AUTO_TEST_CASE(Failure)
{
CommandOptions options;
- options.setTimeout(time::milliseconds(3000));
+ options.setTimeout(3000_ms);
controller.fetch<FaceDataset>(
[] (const std::vector<FaceStatus>& result) { BOOST_FAIL("fetchDataset should not succeed"); },
nullptr,
options);
- BOOST_CHECK_NO_THROW(this->advanceClocks(time::milliseconds(500), 7));
+ BOOST_CHECK_NO_THROW(this->advanceClocks(500_ms, 7));
}
BOOST_AUTO_TEST_SUITE_END() // NoCallback
@@ -243,12 +243,12 @@
BOOST_CHECK_EQUAL(result.getNfdVersion(), "0.4.2");
},
datasetFailCallback);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
ForwarderStatus payload;
payload.setNfdVersion("0.4.2");
this->sendDataset("/localhost/nfd/status/general", payload);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
BOOST_CHECK(hasResult);
BOOST_CHECK_EQUAL(failCodes.size(), 0);
@@ -264,14 +264,14 @@
BOOST_CHECK_EQUAL(result.front().getFaceId(), 24485);
},
datasetFailCallback);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
FaceStatus payload1;
payload1.setFaceId(24485);
FaceStatus payload2;
payload2.setFaceId(12987);
this->sendDataset("/localhost/nfd/faces/list", payload1, payload2);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
BOOST_CHECK(hasResult);
BOOST_CHECK_EQUAL(failCodes.size(), 0);
@@ -290,14 +290,14 @@
BOOST_CHECK_EQUAL(result.front().getFaceId(), 8795);
},
datasetFailCallback);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
Name prefix("/localhost/nfd/faces/query");
prefix.append(filter.wireEncode());
FaceStatus payload;
payload.setFaceId(8795);
this->sendDataset(prefix, payload);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
BOOST_CHECK(hasResult);
BOOST_CHECK_EQUAL(failCodes.size(), 0);
@@ -308,7 +308,7 @@
FaceQueryFilter filter;
filter.setUriScheme("udp4");
CommandOptions options;
- options.setTimeout(time::milliseconds(3000));
+ options.setTimeout(3000_ms);
bool hasResult = false;
controller.fetch<FaceQueryDataset>(
filter,
@@ -319,14 +319,14 @@
},
datasetFailCallback,
options);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
Name prefix("/localhost/nfd/faces/query");
prefix.append(filter.wireEncode());
FaceStatus payload;
payload.setFaceId(14022);
this->sendDataset(prefix, payload);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
BOOST_CHECK(hasResult);
BOOST_CHECK_EQUAL(failCodes.size(), 0);
@@ -342,14 +342,14 @@
BOOST_CHECK_EQUAL(result.front().getLocalUri(), "tcp4://192.0.2.1:6363");
},
datasetFailCallback);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
ChannelStatus payload1;
payload1.setLocalUri("tcp4://192.0.2.1:6363");
ChannelStatus payload2;
payload2.setLocalUri("udp4://192.0.2.1:6363");
this->sendDataset("/localhost/nfd/faces/channels", payload1, payload2);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
BOOST_CHECK(hasResult);
BOOST_CHECK_EQUAL(failCodes.size(), 0);
@@ -365,14 +365,14 @@
BOOST_CHECK_EQUAL(result.front().getPrefix(), "/wYs7fzYcfG");
},
datasetFailCallback);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
FibEntry payload1;
payload1.setPrefix("/wYs7fzYcfG");
FibEntry payload2;
payload2.setPrefix("/LKvmnzY5S");
this->sendDataset("/localhost/nfd/fib/list", payload1, payload2);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
BOOST_CHECK(hasResult);
BOOST_CHECK_EQUAL(failCodes.size(), 0);
@@ -389,12 +389,12 @@
BOOST_CHECK_EQUAL(result.getNHits(), 4539);
},
datasetFailCallback);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
CsInfo payload;
payload.setNHits(4539);
this->sendDataset("/localhost/nfd/cs/info", payload);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
BOOST_CHECK(hasResult);
BOOST_CHECK_EQUAL(failCodes.size(), 0);
@@ -410,14 +410,14 @@
BOOST_CHECK_EQUAL(result.front().getName(), "/8MLz6N3B");
},
datasetFailCallback);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
StrategyChoice payload1;
payload1.setName("/8MLz6N3B");
StrategyChoice payload2;
payload2.setName("/svqcBu0YwU");
this->sendDataset("/localhost/nfd/strategy-choice/list", payload1, payload2);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
BOOST_CHECK(hasResult);
BOOST_CHECK_EQUAL(failCodes.size(), 0);
@@ -433,14 +433,14 @@
BOOST_CHECK_EQUAL(result.front().getName(), "/zXxBth97ee");
},
datasetFailCallback);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
RibEntry payload1;
payload1.setName("/zXxBth97ee");
RibEntry payload2;
payload2.setName("/rJ8CvUpr4G");
this->sendDataset("/localhost/nfd/rib/list", payload1, payload2);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
BOOST_CHECK(hasResult);
BOOST_CHECK_EQUAL(failCodes.size(), 0);
@@ -459,12 +459,12 @@
},
datasetFailCallback,
options);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
RibEntry payload;
payload.setName("/e6L5K4ascd");
this->sendDataset("/localhop/nfd/rib/list", payload);
- this->advanceClocks(time::milliseconds(500));
+ this->advanceClocks(500_ms);
BOOST_CHECK(hasResult);
BOOST_CHECK_EQUAL(failCodes.size(), 0);
diff --git a/tests/unit-tests/mgmt/status-dataset-context.t.cpp b/tests/unit-tests/mgmt/status-dataset-context.t.cpp
index 5c432a7..c5af199 100644
--- a/tests/unit-tests/mgmt/status-dataset-context.t.cpp
+++ b/tests/unit-tests/mgmt/status-dataset-context.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2017 Regents of the University of California.
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -54,7 +54,7 @@
[this] (const ControlResponse& resp) {
sendNackHistory.push_back(resp);
})
- , defaultImsFresh(time::milliseconds(1000))
+ , defaultImsFresh(1000_ms)
{
}
@@ -141,8 +141,8 @@
BOOST_AUTO_TEST_CASE(GetAndSet)
{
- auto period = time::milliseconds(9527);
- BOOST_CHECK_EQUAL(context.getExpiry(), time::milliseconds(1000));
+ auto period = 9527_ms;
+ BOOST_CHECK_EQUAL(context.getExpiry(), 1000_ms);
BOOST_CHECK_EQUAL(context.setExpiry(period).getExpiry(), period);
}