util: add literal operators for duration types
Change-Id: I007fa61c80e535c6e4b12e85a32eeeee62fecc3c
Refs: #4468
diff --git a/tests/unit-tests/util/notification-subscriber.t.cpp b/tests/unit-tests/util/notification-subscriber.t.cpp
index aef46a3..3fe3fd6 100644
--- a/tests/unit-tests/util/notification-subscriber.t.cpp
+++ b/tests/unit-tests/util/notification-subscriber.t.cpp
@@ -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-2018 Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -45,7 +45,7 @@
NotificationSubscriberFixture()
: streamPrefix("ndn:/NotificationSubscriberTest")
, subscriberFace(io, m_keyChain)
- , subscriber(subscriberFace, streamPrefix, time::seconds(1))
+ , subscriber(subscriberFace, streamPrefix, 1_s)
, nextSendNotificationNo(0)
{
}
@@ -61,7 +61,7 @@
dataName.appendSequenceNumber(nextSendNotificationNo);
Data data(dataName);
data.setContent(notification.wireEncode());
- data.setFreshnessPeriod(time::seconds(1));
+ data.setFreshnessPeriod(1_s);
m_keyChain.sign(data);
lastDeliveredSeqNo = nextSendNotificationNo;
@@ -185,7 +185,7 @@
this->connectHandlers();
subscriber.start();
BOOST_REQUIRE_EQUAL(subscriber.isRunning(), true);
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
BOOST_CHECK(this->hasInitialRequest());
subscriberFace.sentInterests.clear();
@@ -198,19 +198,19 @@
{
this->connectHandlers();
subscriber.start();
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
// respond to initial request
subscriberFace.sentInterests.clear();
this->deliverNotification("n1");
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
BOOST_CHECK_EQUAL(lastNotification.getMessage(), "n1");
BOOST_CHECK_EQUAL(this->getRequestSeqNo(), lastDeliveredSeqNo + 1);
// respond to continuation request
subscriberFace.sentInterests.clear();
this->deliverNotification("n2");
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
BOOST_CHECK_EQUAL(lastNotification.getMessage(), "n2");
BOOST_CHECK_EQUAL(this->getRequestSeqNo(), lastDeliveredSeqNo + 1);
}
@@ -219,17 +219,17 @@
{
this->connectHandlers();
subscriber.start();
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
// send the first Nack to initial request
BOOST_REQUIRE_EQUAL(subscriberFace.sentInterests.size(), 1);
Interest interest = subscriberFace.sentInterests[0];
subscriberFace.sentInterests.clear();
this->deliverNack(interest, lp::NackReason::CONGESTION);
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
BOOST_CHECK_EQUAL(lastNack.getReason(), lp::NackReason::CONGESTION);
BOOST_REQUIRE_EQUAL(this->hasInitialRequest(), false);
- advanceClocks(time::milliseconds(300));
+ advanceClocks(300_ms);
BOOST_REQUIRE_EQUAL(this->hasInitialRequest(), true);
// send the second Nack to initial request
@@ -237,25 +237,25 @@
interest = subscriberFace.sentInterests[0];
subscriberFace.sentInterests.clear();
this->deliverNack(interest, lp::NackReason::CONGESTION);
- advanceClocks(time::milliseconds(301));
+ advanceClocks(301_ms);
BOOST_REQUIRE_EQUAL(this->hasInitialRequest(), false);
- advanceClocks(time::milliseconds(200));
+ advanceClocks(200_ms);
BOOST_REQUIRE_EQUAL(this->hasInitialRequest(), true);
// send a notification to initial request
subscriberFace.sentInterests.clear();
this->deliverNotification("n1");
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
// send a Nack to subsequent request
BOOST_REQUIRE_EQUAL(subscriberFace.sentInterests.size(), 1);
interest = subscriberFace.sentInterests[0];
subscriberFace.sentInterests.clear();
this->deliverNack(interest, lp::NackReason::CONGESTION);
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
BOOST_CHECK_EQUAL(lastNack.getReason(), lp::NackReason::CONGESTION);
BOOST_REQUIRE_EQUAL(this->hasInitialRequest(), false);
- advanceClocks(time::milliseconds(300));
+ advanceClocks(300_ms);
BOOST_REQUIRE_EQUAL(this->hasInitialRequest(), true);
}
@@ -263,7 +263,7 @@
{
this->connectHandlers();
subscriber.start();
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
subscriberFace.sentInterests.clear();
lastNotification.setMessage("");
@@ -274,7 +274,7 @@
subscriberFace.sentInterests.clear();
this->deliverNotification("n1");
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
BOOST_CHECK_EQUAL(lastNotification.getMessage(), "n1");
}
@@ -282,7 +282,7 @@
{
this->connectHandlers();
subscriber.start();
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
Name wrongName = streamPrefix;
wrongName.append("%07%07");
@@ -291,7 +291,7 @@
subscriberFace.receive(wrongData);
subscriberFace.sentInterests.clear();
lastNotification.setMessage("");
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
BOOST_CHECK(lastNotification.getMessage().empty());
BOOST_CHECK_EQUAL(lastDecodeErrorData.getName(), wrongName);
BOOST_CHECK(this->hasInitialRequest());
@@ -301,12 +301,12 @@
{
this->connectHandlers();
subscriber.start();
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
subscriberFace.sentInterests.clear();
lastNotification.setMessage("");
this->deliverNotification("\x07n4");
- advanceClocks(time::milliseconds(1));
+ advanceClocks(1_ms);
BOOST_CHECK(lastNotification.getMessage().empty());
BOOST_CHECK(this->hasInitialRequest());
}