util: add literal operators for duration types
Change-Id: I007fa61c80e535c6e4b12e85a32eeeee62fecc3c
Refs: #4468
diff --git a/tests/unit-tests/security/v2/certificate-bundle-fetcher.t.cpp b/tests/unit-tests/security/v2/certificate-bundle-fetcher.t.cpp
index b837339..f9bc22c 100644
--- a/tests/unit-tests/security/v2/certificate-bundle-fetcher.t.cpp
+++ b/tests/unit-tests/security/v2/certificate-bundle-fetcher.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).
*
@@ -126,7 +126,7 @@
shared_ptr<Data> certBundle = make_shared<Data>();
certBundle->setName(bundleName);
- certBundle->setFreshnessPeriod(time::seconds(100));
+ certBundle->setFreshnessPeriod(100_s);
certBundle->setContent(certList);
certBundle->setFinalBlockId(name::Component::fromSegment(1));
@@ -139,7 +139,7 @@
void
CertificateBundleFetcherFixture<Timeout>::makeResponse(const Interest& interest)
{
- this->advanceClocks(time::seconds(200));
+ this->advanceClocks(200_s);
}
template<>
diff --git a/tests/unit-tests/security/v2/certificate-cache.t.cpp b/tests/unit-tests/security/v2/certificate-cache.t.cpp
index 56c7dd0..4ae3505 100644
--- a/tests/unit-tests/security/v2/certificate-cache.t.cpp
+++ b/tests/unit-tests/security/v2/certificate-cache.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).
*
@@ -36,7 +36,7 @@
{
public:
CertificateCacheFixture()
- : certCache(time::seconds(10))
+ : certCache(10_s)
{
identity = addIdentity("/TestCertificateCache/");
cert = identity.getDefaultKey().getDefaultCertificate();
@@ -57,16 +57,16 @@
BOOST_CHECK_NO_THROW(certCache.insert(cert));
BOOST_CHECK(certCache.find(cert.getName()) != nullptr);
- advanceClocks(time::seconds(11), 1);
+ advanceClocks(11_s, 1);
BOOST_CHECK(certCache.find(cert.getName()) == nullptr);
BOOST_CHECK_NO_THROW(certCache.insert(cert));
BOOST_CHECK(certCache.find(cert.getName()) != nullptr);
- advanceClocks(time::seconds(5));
+ advanceClocks(5_s);
BOOST_CHECK(certCache.find(cert.getName()) != nullptr);
- advanceClocks(time::seconds(15));
+ advanceClocks(15_s);
BOOST_CHECK(certCache.find(cert.getName()) == nullptr);
}
@@ -79,7 +79,7 @@
BOOST_CHECK(certCache.find(Interest(cert.getKeyName())) != nullptr);
BOOST_CHECK(certCache.find(Interest(Name(cert.getName()).appendVersion())) == nullptr);
- advanceClocks(time::seconds(12));
+ advanceClocks(12_s);
BOOST_CHECK(certCache.find(Interest(cert.getIdentity())) == nullptr);
Certificate cert3 = addCertificate(identity.getDefaultKey(), "3");
diff --git a/tests/unit-tests/security/v2/certificate-fetcher-from-network.t.cpp b/tests/unit-tests/security/v2/certificate-fetcher-from-network.t.cpp
index 0caa12f..e4b1ec9 100644
--- a/tests/unit-tests/security/v2/certificate-fetcher-from-network.t.cpp
+++ b/tests/unit-tests/security/v2/certificate-fetcher-from-network.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,7 +110,7 @@
BOOST_CHECK_EQUAL(this->face.sentInterests.size(), 2);
this->face.sentInterests.clear();
- this->advanceClocks(time::hours(1), 2); // expire validator caches
+ this->advanceClocks(1_h, 2); // expire validator caches
VALIDATE_SUCCESS(this->interest, "Should get accepted, as interests bring certs");
BOOST_CHECK_EQUAL(this->face.sentInterests.size(), 2);
@@ -122,7 +122,7 @@
BOOST_CHECK_GT(this->face.sentInterests.size(), 2);
this->face.sentInterests.clear();
- this->advanceClocks(time::hours(1), 2); // expire validator caches
+ this->advanceClocks(1_h, 2); // expire validator caches
VALIDATE_FAILURE(this->interest, "Should fail, as interests don't bring data");
BOOST_CHECK_GT(this->face.sentInterests.size(), 2);
diff --git a/tests/unit-tests/security/v2/certificate.t.cpp b/tests/unit-tests/security/v2/certificate.t.cpp
index 9522b55..5e0e24f 100644
--- a/tests/unit-tests/security/v2/certificate.t.cpp
+++ b/tests/unit-tests/security/v2/certificate.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).
*
@@ -171,7 +171,7 @@
{
Certificate certificate;
certificate.setName("/ndn/site1/KEY/ksk-1416425377094/0123/%FD%00%00%01I%C9%8B");
- certificate.setFreshnessPeriod(time::seconds(3600));
+ certificate.setFreshnessPeriod(1_h);
certificate.setContent(PUBLIC_KEY, sizeof(PUBLIC_KEY));
certificate.setSignature(generateFakeSignature());
@@ -191,7 +191,7 @@
{
Certificate certificate;
certificate.setName("/ndn/site1/KEY/ksk-1416425377094/0123/%FD%00%00%01I%C9%8B");
- certificate.setFreshnessPeriod(time::seconds(3600));
+ certificate.setFreshnessPeriod(1_h);
certificate.setContent(PUBLIC_KEY, sizeof(PUBLIC_KEY));
certificate.setSignature(generateFakeSignature());
diff --git a/tests/unit-tests/security/v2/key-chain.t.cpp b/tests/unit-tests/security/v2/key-chain.t.cpp
index 9575754..d03f572 100644
--- a/tests/unit-tests/security/v2/key-chain.t.cpp
+++ b/tests/unit-tests/security/v2/key-chain.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).
*
@@ -396,9 +396,8 @@
.getDefaultKey()
.getDefaultCertificate();
BOOST_CHECK(cert.isValid());
- BOOST_CHECK(cert.isValid(time::system_clock::now() + time::days(10 * 365)));
- BOOST_CHECK_GT(cert.getValidityPeriod().getPeriod().second,
- time::system_clock::now() + time::days(10 * 365));
+ BOOST_CHECK(cert.isValid(time::system_clock::now() + 10 * 365_days));
+ BOOST_CHECK_GT(cert.getValidityPeriod().getPeriod().second, time::system_clock::now() + 10 * 365_days);
}
BOOST_AUTO_TEST_SUITE_END() // TestKeyChain
diff --git a/tests/unit-tests/security/v2/trust-anchor-container.t.cpp b/tests/unit-tests/security/v2/trust-anchor-container.t.cpp
index 0efecdc..30749ac 100644
--- a/tests/unit-tests/security/v2/trust-anchor-container.t.cpp
+++ b/tests/unit-tests/security/v2/trust-anchor-container.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).
*
@@ -20,10 +20,11 @@
*/
#include "security/v2/trust-anchor-container.hpp"
+#include "util/io.hpp"
#include "../../identity-management-time-fixture.hpp"
-#include "util/io.hpp"
#include "boost-test.hpp"
+
#include <boost/filesystem.hpp>
namespace ndn {
@@ -97,21 +98,21 @@
BOOST_CHECK_NO_THROW(anchorContainer.insert("group1", Certificate(cert1)));
BOOST_CHECK_EQUAL(cert, anchorContainer.find(cert1.getName())); // still the same instance of the certificate
// cannot add dynamic group when static already exists
- BOOST_CHECK_THROW(anchorContainer.insert("group1", certPath1.string(), time::seconds(1)), TrustAnchorContainer::Error);
+ BOOST_CHECK_THROW(anchorContainer.insert("group1", certPath1.string(), 1_s), TrustAnchorContainer::Error);
BOOST_CHECK_EQUAL(anchorContainer.getGroup("group1").size(), 1);
BOOST_CHECK_EQUAL(anchorContainer.size(), 1);
// From file
- anchorContainer.insert("group2", certPath2.string(), time::seconds(1));
+ anchorContainer.insert("group2", certPath2.string(), 1_s);
BOOST_CHECK(anchorContainer.find(cert2.getName()) != nullptr);
BOOST_CHECK(anchorContainer.find(identity2.getName()) != nullptr);
BOOST_CHECK_THROW(anchorContainer.insert("group2", Certificate(cert2)), TrustAnchorContainer::Error);
- BOOST_CHECK_THROW(anchorContainer.insert("group2", certPath2.string(), time::seconds(1)), TrustAnchorContainer::Error);
+ BOOST_CHECK_THROW(anchorContainer.insert("group2", certPath2.string(), 1_s), TrustAnchorContainer::Error);
BOOST_CHECK_EQUAL(anchorContainer.getGroup("group2").size(), 1);
BOOST_CHECK_EQUAL(anchorContainer.size(), 2);
boost::filesystem::remove(certPath2);
- advanceClocks(time::seconds(1), 11);
+ advanceClocks(1_s, 11);
BOOST_CHECK(anchorContainer.find(identity2.getName()) == nullptr);
BOOST_CHECK(anchorContainer.find(cert2.getName()) == nullptr);
@@ -133,7 +134,7 @@
{
boost::filesystem::remove(certPath2);
- anchorContainer.insert("group", certDirPath.string(), time::seconds(1), true /* isDir */);
+ anchorContainer.insert("group", certDirPath.string(), 1_s, true /* isDir */);
BOOST_CHECK(anchorContainer.find(identity1.getName()) != nullptr);
BOOST_CHECK(anchorContainer.find(identity2.getName()) == nullptr);
@@ -141,7 +142,7 @@
saveCertToFile(cert2, certPath2.string());
- advanceClocks(time::milliseconds(100), 11);
+ advanceClocks(100_ms, 11);
BOOST_CHECK(anchorContainer.find(identity1.getName()) != nullptr);
BOOST_CHECK(anchorContainer.find(identity2.getName()) != nullptr);
@@ -149,7 +150,7 @@
boost::filesystem::remove_all(certDirPath);
- advanceClocks(time::milliseconds(100), 11);
+ advanceClocks(100_ms, 11);
BOOST_CHECK(anchorContainer.find(identity1.getName()) == nullptr);
BOOST_CHECK(anchorContainer.find(identity2.getName()) == nullptr);
@@ -158,7 +159,7 @@
BOOST_FIXTURE_TEST_CASE(FindByInterest, AnchorContainerTestFixture)
{
- anchorContainer.insert("group1", certPath1.string(), time::seconds(1));
+ anchorContainer.insert("group1", certPath1.string(), 1_s);
Interest interest(identity1.getName());
BOOST_CHECK(anchorContainer.find(interest) != nullptr);
Interest interest1(identity1.getName().getPrefix(-1));
diff --git a/tests/unit-tests/security/v2/validation-policy-command-interest.t.cpp b/tests/unit-tests/security/v2/validation-policy-command-interest.t.cpp
index dd400b4..4a3365c 100644
--- a/tests/unit-tests/security/v2/validation-policy-command-interest.t.cpp
+++ b/tests/unit-tests/security/v2/validation-policy-command-interest.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).
*
@@ -91,7 +91,7 @@
auto i1 = makeCommandInterest(identity);
VALIDATE_SUCCESS(i1, "Should succeed (within grace period)");
- advanceClocks(time::milliseconds(5));
+ advanceClocks(5_ms);
auto i2 = makeCommandInterest(identity);
VALIDATE_SUCCESS(i2, "Should succeed (timestamp larger than previous)");
}
@@ -173,7 +173,7 @@
getOptions()
{
ValidationPolicyCommandInterest::Options options;
- options.gracePeriod = time::seconds(15);
+ options.gracePeriod = 15_s;
return options;
}
};
@@ -181,7 +181,7 @@
BOOST_FIXTURE_TEST_CASE(TimestampOutOfGracePositive, ValidationPolicyCommandInterestFixture<GracePeriod15Sec>)
{
auto i1 = makeCommandInterest(identity); // signed at 0s
- advanceClocks(time::seconds(16)); // verifying at +16s
+ advanceClocks(16_s); // verifying at +16s
VALIDATE_FAILURE(i1, "Should fail (timestamp outside the grace period)");
rewindClockAfterValidation();
@@ -192,12 +192,12 @@
BOOST_FIXTURE_TEST_CASE(TimestampOutOfGraceNegative, ValidationPolicyCommandInterestFixture<GracePeriod15Sec>)
{
auto i1 = makeCommandInterest(identity); // signed at 0s
- advanceClocks(time::seconds(1));
+ advanceClocks(1_s);
auto i2 = makeCommandInterest(identity); // signed at +1s
- advanceClocks(time::seconds(1));
+ advanceClocks(1_s);
auto i3 = makeCommandInterest(identity); // signed at +2s
- systemClock->advance(time::seconds(-18)); // verifying at -16s
+ systemClock->advance(-18_s); // verifying at -16s
VALIDATE_FAILURE(i1, "Should fail (timestamp outside the grace period)");
rewindClockAfterValidation();
@@ -206,7 +206,7 @@
rewindClockAfterValidation();
// CommandInterestValidator should not remember i2's timestamp, and should treat i3 as initial
- advanceClocks(time::seconds(18)); // verifying at +2s
+ advanceClocks(18_s); // verifying at +2s
VALIDATE_SUCCESS(i3, "Should succeed");
}
@@ -220,7 +220,7 @@
i1.getName()[command_interest::POS_TIMESTAMP]);
VALIDATE_FAILURE(i2, "Should fail (timestamp reordered)");
- advanceClocks(time::seconds(2));
+ advanceClocks(2_s);
auto i3 = makeCommandInterest(identity); // signed at +2s
VALIDATE_SUCCESS(i3, "Should succeed");
}
@@ -228,27 +228,27 @@
BOOST_AUTO_TEST_CASE(TimestampReorderNegative)
{
auto i2 = makeCommandInterest(identity); // signed at 0ms
- advanceClocks(time::milliseconds(200));
+ advanceClocks(200_ms);
auto i3 = makeCommandInterest(identity); // signed at +200ms
- advanceClocks(time::milliseconds(900));
+ advanceClocks(900_ms);
auto i1 = makeCommandInterest(identity); // signed at +1100ms
- advanceClocks(time::milliseconds(300));
+ advanceClocks(300_ms);
auto i4 = makeCommandInterest(identity); // signed at +1400ms
- systemClock->advance(time::milliseconds(-300)); // verifying at +1100ms
+ systemClock->advance(-300_ms); // verifying at +1100ms
VALIDATE_SUCCESS(i1, "Should succeed");
rewindClockAfterValidation();
- systemClock->advance(time::milliseconds(-1100)); // verifying at 0ms
+ systemClock->advance(-1100_ms); // verifying at 0ms
VALIDATE_FAILURE(i2, "Should fail (timestamp reordered)");
rewindClockAfterValidation();
// CommandInterestValidator should not remember i2's timestamp
- advanceClocks(time::milliseconds(200)); // verifying at +200ms
+ advanceClocks(200_ms); // verifying at +200ms
VALIDATE_FAILURE(i3, "Should fail (timestamp reordered)");
rewindClockAfterValidation();
- advanceClocks(time::milliseconds(1200)); // verifying at 1400ms
+ advanceClocks(1200_ms); // verifying at 1400ms
VALIDATE_SUCCESS(i4, "Should succeed");
}
@@ -287,7 +287,7 @@
VALIDATE_SUCCESS(i1, "Should succeed when validating at 0ms");
this->rewindClockAfterValidation();
- this->advanceClocks(time::milliseconds(1));
+ this->advanceClocks(1_ms);
VALIDATE_FAILURE(i2, "Should fail when validating at 1ms");
}
@@ -298,7 +298,7 @@
getOptions()
{
ValidationPolicyCommandInterest::Options options;
- options.gracePeriod = time::seconds(15);
+ options.gracePeriod = 15_s;
options.maxRecords = 3;
return options;
}
@@ -319,9 +319,9 @@
auto i2 = makeCommandInterest(id3);
auto i3 = makeCommandInterest(id4);
auto i00 = makeCommandInterest(id1); // signed at 0s
- advanceClocks(time::seconds(1));
+ advanceClocks(1_s);
auto i01 = makeCommandInterest(id1); // signed at 1s
- advanceClocks(time::seconds(1));
+ advanceClocks(1_s);
auto i02 = makeCommandInterest(id1); // signed at 2s
VALIDATE_SUCCESS(i00, "Should succeed");
@@ -349,7 +349,7 @@
getOptions()
{
ValidationPolicyCommandInterest::Options options;
- options.gracePeriod = time::seconds(15);
+ options.gracePeriod = 15_s;
options.maxRecords = -1;
return options;
}
@@ -365,7 +365,7 @@
}
auto i1 = makeCommandInterest(identities.at(0)); // signed at 0s
- advanceClocks(time::seconds(1));
+ advanceClocks(1_s);
for (int i = 0; i < 20; ++i) {
auto i2 = makeCommandInterest(identities.at(i)); // signed at +1s
@@ -382,7 +382,7 @@
getOptions()
{
ValidationPolicyCommandInterest::Options options;
- options.gracePeriod = time::seconds(15);
+ options.gracePeriod = 15_s;
options.maxRecords = 0;
return options;
}
@@ -391,7 +391,7 @@
BOOST_FIXTURE_TEST_CASE(ZeroRecords, ValidationPolicyCommandInterestFixture<ZeroRecordsOptions>)
{
auto i1 = makeCommandInterest(identity); // signed at 0s
- advanceClocks(time::seconds(1));
+ advanceClocks(1_s);
auto i2 = makeCommandInterest(identity); // signed at +1s
VALIDATE_SUCCESS(i2, "Should succeed");
rewindClockAfterValidation();
@@ -406,8 +406,8 @@
getOptions()
{
ValidationPolicyCommandInterest::Options options;
- options.gracePeriod = time::seconds(400);
- options.recordLifetime = time::seconds(300);
+ options.gracePeriod = 400_s;
+ options.recordLifetime = 300_s;
return options;
}
};
@@ -415,19 +415,19 @@
BOOST_FIXTURE_TEST_CASE(LimitedRecordLifetime, ValidationPolicyCommandInterestFixture<LimitedRecordLifetimeOptions>)
{
auto i1 = makeCommandInterest(identity); // signed at 0s
- advanceClocks(time::seconds(240));
+ advanceClocks(240_s);
auto i2 = makeCommandInterest(identity); // signed at +240s
- advanceClocks(time::seconds(120));
+ advanceClocks(120_s);
auto i3 = makeCommandInterest(identity); // signed at +360s
- systemClock->advance(time::seconds(-360)); // rewind system clock to 0s
+ systemClock->advance(-360_s); // rewind system clock to 0s
VALIDATE_SUCCESS(i1, "Should succeed");
rewindClockAfterValidation();
VALIDATE_SUCCESS(i3, "Should succeed");
rewindClockAfterValidation();
- advanceClocks(time::seconds(30), time::seconds(301)); // advance steady clock by 301s, and system clock to +301s
+ advanceClocks(30_s, 301_s); // advance steady clock by 301s, and system clock to +301s
VALIDATE_SUCCESS(i2, "Should succeed despite timestamp is reordered, because record has been expired");
}
@@ -438,7 +438,7 @@
getOptions()
{
ValidationPolicyCommandInterest::Options options;
- options.gracePeriod = time::seconds(15);
+ options.gracePeriod = 15_s;
options.recordLifetime = time::seconds::zero();
return options;
}
@@ -447,7 +447,7 @@
BOOST_FIXTURE_TEST_CASE(ZeroRecordLifetime, ValidationPolicyCommandInterestFixture<ZeroRecordLifetimeOptions>)
{
auto i1 = makeCommandInterest(identity); // signed at 0s
- advanceClocks(time::seconds(1));
+ advanceClocks(1_s);
auto i2 = makeCommandInterest(identity); // signed at +1s
VALIDATE_SUCCESS(i2, "Should succeed");
rewindClockAfterValidation();
diff --git a/tests/unit-tests/security/v2/validation-policy-config.t.cpp b/tests/unit-tests/security/v2/validation-policy-config.t.cpp
index 7808700..31cba27 100644
--- a/tests/unit-tests/security/v2/validation-policy-config.t.cpp
+++ b/tests/unit-tests/security/v2/validation-policy-config.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).
*
@@ -232,7 +232,7 @@
static time::milliseconds
getRefreshTime()
{
- return time::hours(1);
+ return 1_h;
}
};
@@ -248,7 +248,7 @@
static time::milliseconds
getRefreshTime()
{
- return time::minutes(1);
+ return 1_min;
}
};
@@ -264,7 +264,7 @@
static time::milliseconds
getRefreshTime()
{
- return time::seconds(1);
+ return 1_s;
}
};
diff --git a/tests/unit-tests/security/v2/validator-fixture.hpp b/tests/unit-tests/security/v2/validator-fixture.hpp
index 7f52048..c9a5763 100644
--- a/tests/unit-tests/security/v2/validator-fixture.hpp
+++ b/tests/unit-tests/security/v2/validator-fixture.hpp
@@ -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).
*
@@ -43,7 +43,7 @@
: face(io, {true, true})
, validator(make_unique<ValidationPolicy>(), make_unique<CertificateFetcher>(face))
, policy(static_cast<ValidationPolicy&>(validator.getPolicy()))
- , cache(time::days(100))
+ , cache(100_days)
{
processInterest = [this] (const Interest& interest) {
auto cert = cache.find(interest);
diff --git a/tests/unit-tests/security/v2/validator.t.cpp b/tests/unit-tests/security/v2/validator.t.cpp
index ac5ca86..af64557 100644
--- a/tests/unit-tests/security/v2/validator.t.cpp
+++ b/tests/unit-tests/security/v2/validator.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).
*
@@ -104,8 +104,8 @@
{
Data expiredCert = subIdentity.getDefaultKey().getDefaultCertificate();
SignatureInfo info;
- info.setValidityPeriod(ValidityPeriod(time::system_clock::now() - time::hours(2),
- time::system_clock::now() - time::hours(1)));
+ info.setValidityPeriod(ValidityPeriod(time::system_clock::now() - 2_h,
+ time::system_clock::now() - 1_h));
m_keyChain.sign(expiredCert, signingByIdentity(identity).setSignatureInfo(info));
BOOST_REQUIRE_NO_THROW(Certificate(expiredCert.wireEncode()));
@@ -150,7 +150,7 @@
BOOST_CHECK_EQUAL(face.sentInterests.size(), 0);
face.sentInterests.clear();
- advanceClocks(time::hours(1), 2); // expire trusted cache
+ advanceClocks(1_h, 2); // expire trusted cache
VALIDATE_FAILURE(data, "Should try and fail to retrieve certs");
BOOST_CHECK_GT(face.sentInterests.size(), 1);
@@ -187,7 +187,7 @@
BOOST_CHECK_EQUAL(face.sentInterests.size(), 0);
face.sentInterests.clear();
- advanceClocks(time::minutes(10), 2); // expire untrusted cache
+ advanceClocks(10_min, 2); // expire untrusted cache
VALIDATE_FAILURE(data, "Should try and fail to retrieve certs");
BOOST_CHECK_GT(face.sentInterests.size(), 1);
@@ -246,7 +246,7 @@
BOOST_CHECK_EQUAL(face.sentInterests.size(), 0);
face.sentInterests.clear();
- advanceClocks(time::hours(1), 2); // expire trusted cache
+ advanceClocks(1_h, 2); // expire trusted cache
m_keyChain.sign(interest, signingByIdentity(subSelfSignedIdentity));
m_keyChain.sign(data, signingByIdentity(subSelfSignedIdentity));
@@ -272,15 +272,15 @@
// set metainfo
certificate.setContentType(tlv::ContentType_Key);
- certificate.setFreshnessPeriod(time::hours(1));
+ certificate.setFreshnessPeriod(1_h);
// set content
certificate.setContent(requestedKey.getPublicKey().data(), requestedKey.getPublicKey().size());
// set signature-info
SignatureInfo info;
- info.setValidityPeriod(security::ValidityPeriod(time::system_clock::now() - time::days(10),
- time::system_clock::now() + time::days(10)));
+ info.setValidityPeriod(security::ValidityPeriod(time::system_clock::now() - 10_days,
+ time::system_clock::now() + 10_days));
m_keyChain.sign(certificate, signingByKey(parentKey).setSignatureInfo(info));
face.receive(certificate);
@@ -295,7 +295,7 @@
BOOST_CHECK_EQUAL(face.sentInterests.size(), 40);
face.sentInterests.clear();
- advanceClocks(time::hours(1), 5); // expire caches
+ advanceClocks(1_h, 5); // expire caches
validator.setMaxDepth(30);
BOOST_CHECK_EQUAL(validator.getMaxDepth(), 30);
@@ -315,8 +315,8 @@
request.setName(Name(key.getName()).append("looper").appendVersion());
SignatureInfo info;
- info.setValidityPeriod({time::system_clock::now() - time::days(100),
- time::system_clock::now() + time::days(100)});
+ info.setValidityPeriod({time::system_clock::now() - 100_days,
+ time::system_clock::now() + 100_days});
m_keyChain.sign(request, signingByKey(signer).setSignatureInfo(info));
m_keyChain.addCertificate(key, request);