tests+tools: minor code cleanup
Change-Id: Ic3356d4a18a8e5eeb45fc076fc0563c3d1549c8a
diff --git a/tests/daemon/table/cs-policy-priority-fifo.t.cpp b/tests/daemon/table/cs-policy-priority-fifo.t.cpp
index cd71b5b..37fcbc7 100644
--- a/tests/daemon/table/cs-policy-priority-fifo.t.cpp
+++ b/tests/daemon/table/cs-policy-priority-fifo.t.cpp
@@ -50,25 +50,25 @@
cs.setPolicy(make_unique<PriorityFifoPolicy>());
shared_ptr<Data> dataA = makeData("ndn:/A");
- dataA->setFreshnessPeriod(time::milliseconds(99999));
+ dataA->setFreshnessPeriod(99999_ms);
dataA->wireEncode();
cs.insert(*dataA);
shared_ptr<Data> dataB = makeData("ndn:/B");
- dataB->setFreshnessPeriod(time::milliseconds(10));
+ dataB->setFreshnessPeriod(10_ms);
dataB->wireEncode();
cs.insert(*dataB);
shared_ptr<Data> dataC = makeData("ndn:/C");
- dataC->setFreshnessPeriod(time::milliseconds(99999));
+ dataC->setFreshnessPeriod(99999_ms);
dataC->wireEncode();
cs.insert(*dataC, true);
- this->advanceClocks(time::milliseconds(11));
+ this->advanceClocks(11_ms);
// evict unsolicited
shared_ptr<Data> dataD = makeData("ndn:/D");
- dataD->setFreshnessPeriod(time::milliseconds(99999));
+ dataD->setFreshnessPeriod(99999_ms);
dataD->wireEncode();
cs.insert(*dataD);
BOOST_CHECK_EQUAL(cs.size(), 3);
@@ -78,7 +78,7 @@
// evict stale
shared_ptr<Data> dataE = makeData("ndn:/E");
- dataE->setFreshnessPeriod(time::milliseconds(99999));
+ dataE->setFreshnessPeriod(99999_ms);
dataE->wireEncode();
cs.insert(*dataE);
BOOST_CHECK_EQUAL(cs.size(), 3);
@@ -88,7 +88,7 @@
// evict fifo
shared_ptr<Data> dataF = makeData("ndn:/F");
- dataF->setFreshnessPeriod(time::milliseconds(99999));
+ dataF->setFreshnessPeriod(99999_ms);
dataF->wireEncode();
cs.insert(*dataF);
BOOST_CHECK_EQUAL(cs.size(), 3);
@@ -103,21 +103,21 @@
cs.setPolicy(make_unique<PriorityFifoPolicy>());
shared_ptr<Data> dataA = makeData("ndn:/A");
- dataA->setFreshnessPeriod(time::milliseconds(99999));
+ dataA->setFreshnessPeriod(99999_ms);
dataA->wireEncode();
cs.insert(*dataA);
shared_ptr<Data> dataB = makeData("ndn:/B");
- dataB->setFreshnessPeriod(time::milliseconds(10));
+ dataB->setFreshnessPeriod(10_ms);
dataB->wireEncode();
cs.insert(*dataB);
shared_ptr<Data> dataC = makeData("ndn:/C");
- dataC->setFreshnessPeriod(time::milliseconds(10));
+ dataC->setFreshnessPeriod(10_ms);
dataC->wireEncode();
cs.insert(*dataC);
- this->advanceClocks(time::milliseconds(11));
+ this->advanceClocks(11_ms);
// refresh dataB
shared_ptr<Data> dataB2 = make_shared<Data>(*dataB);
@@ -138,7 +138,7 @@
// evict dataC stale
shared_ptr<Data> dataD = makeData("ndn:/D");
- dataD->setFreshnessPeriod(time::milliseconds(99999));
+ dataD->setFreshnessPeriod(99999_ms);
dataD->wireEncode();
cs.insert(*dataD);
BOOST_CHECK_EQUAL(cs.size(), 3);
diff --git a/tests/daemon/table/cs.t.cpp b/tests/daemon/table/cs.t.cpp
index bcfd3a5..db980d2 100644
--- a/tests/daemon/table/cs.t.cpp
+++ b/tests/daemon/table/cs.t.cpp
@@ -272,28 +272,28 @@
BOOST_AUTO_TEST_CASE(MustBeFresh)
{
insert(1, "/A/1"); // omitted FreshnessPeriod means FreshnessPeriod = 0 ms
- insert(2, "/A/2", [] (Data& data) { data.setFreshnessPeriod(time::seconds(0)); });
- insert(3, "/A/3", [] (Data& data) { data.setFreshnessPeriod(time::seconds(1)); });
- insert(4, "/A/4", [] (Data& data) { data.setFreshnessPeriod(time::seconds(3600)); });
+ insert(2, "/A/2", [] (Data& data) { data.setFreshnessPeriod(0_s); });
+ insert(3, "/A/3", [] (Data& data) { data.setFreshnessPeriod(1_s); });
+ insert(4, "/A/4", [] (Data& data) { data.setFreshnessPeriod(1_h); });
// lookup at exact same moment as insertion is not tested because this won't happen in reality
- this->advanceClocks(time::milliseconds(500)); // @500ms
+ this->advanceClocks(500_ms); // @500ms
startInterest("/A")
.setMustBeFresh(true);
CHECK_CS_FIND(3);
- this->advanceClocks(time::milliseconds(1500)); // @2s
+ this->advanceClocks(1500_ms); // @2s
startInterest("/A")
.setMustBeFresh(true);
CHECK_CS_FIND(4);
- this->advanceClocks(time::seconds(3500)); // @3502s
+ this->advanceClocks(3500_s); // @3502s
startInterest("/A")
.setMustBeFresh(true);
CHECK_CS_FIND(4);
- this->advanceClocks(time::seconds(3500)); // @7002s
+ this->advanceClocks(3500_s); // @7002s
startInterest("/A")
.setMustBeFresh(true);
CHECK_CS_FIND(0);
diff --git a/tests/daemon/table/dead-nonce-list.t.cpp b/tests/daemon/table/dead-nonce-list.t.cpp
index ea7866c..1cd32eb 100644
--- a/tests/daemon/table/dead-nonce-list.t.cpp
+++ b/tests/daemon/table/dead-nonce-list.t.cpp
@@ -110,7 +110,7 @@
scheduler::ScopedEventId addNonceEvent;
};
-const time::nanoseconds PeriodicalInsertionFixture::LIFETIME = time::milliseconds(200);
+const time::nanoseconds PeriodicalInsertionFixture::LIFETIME = 200_ms;
BOOST_FIXTURE_TEST_CASE(Lifetime, PeriodicalInsertionFixture)
{
diff --git a/tests/daemon/table/measurements.t.cpp b/tests/daemon/table/measurements.t.cpp
index 915a049..23034a3 100644
--- a/tests/daemon/table/measurements.t.cpp
+++ b/tests/daemon/table/measurements.t.cpp
@@ -208,11 +208,11 @@
Entry& entryC = measurements.get(nameC);
BOOST_CHECK_EQUAL(measurements.size(), 3);
- const time::nanoseconds EXTEND_A = time::seconds(2);
- const time::nanoseconds CHECK1 = time::seconds(3);
- const time::nanoseconds CHECK2 = time::seconds(5);
- const time::nanoseconds EXTEND_C = time::seconds(6);
- const time::nanoseconds CHECK3 = time::seconds(7);
+ const time::nanoseconds EXTEND_A = 2_s;
+ const time::nanoseconds CHECK1 = 3_s;
+ const time::nanoseconds CHECK2 = 5_s;
+ const time::nanoseconds EXTEND_C = 6_s;
+ const time::nanoseconds CHECK3 = 7_s;
BOOST_ASSERT(EXTEND_A < CHECK1);
BOOST_ASSERT(CHECK1 < Measurements::getInitialLifetime());
BOOST_ASSERT(Measurements::getInitialLifetime() < CHECK2);
@@ -226,19 +226,19 @@
// B = initial lifetime
// C = EXTEND_C
- this->advanceClocks(time::milliseconds(100), CHECK1);
+ this->advanceClocks(100_ms, CHECK1);
BOOST_CHECK(measurements.findExactMatch(nameA) != nullptr);
BOOST_CHECK(measurements.findExactMatch(nameB) != nullptr);
BOOST_CHECK(measurements.findExactMatch(nameC) != nullptr);
BOOST_CHECK_EQUAL(measurements.size(), 3);
- this->advanceClocks(time::milliseconds(100), CHECK2 - CHECK1);
+ this->advanceClocks(100_ms, CHECK2 - CHECK1);
BOOST_CHECK(measurements.findExactMatch(nameA) == nullptr);
BOOST_CHECK(measurements.findExactMatch(nameB) == nullptr);
BOOST_CHECK(measurements.findExactMatch(nameC) != nullptr);
BOOST_CHECK_EQUAL(measurements.size(), 1);
- this->advanceClocks(time::milliseconds(100), CHECK3 - CHECK2);
+ this->advanceClocks(100_ms, CHECK3 - CHECK2);
BOOST_CHECK(measurements.findExactMatch(nameA) == nullptr);
BOOST_CHECK(measurements.findExactMatch(nameB) == nullptr);
BOOST_CHECK(measurements.findExactMatch(nameC) == nullptr);
@@ -252,7 +252,7 @@
measurements.get("/A");
BOOST_CHECK_EQUAL(measurements.size(), 1);
- this->advanceClocks(Measurements::getInitialLifetime() + time::milliseconds(10));
+ this->advanceClocks(Measurements::getInitialLifetime() + 10_ms);
BOOST_CHECK_EQUAL(measurements.size(), 0);
BOOST_CHECK_EQUAL(nameTree.size(), nNameTreeEntriesBefore);
}
diff --git a/tests/daemon/table/name-tree.t.cpp b/tests/daemon/table/name-tree.t.cpp
index 4e325bc..b42de83 100644
--- a/tests/daemon/table/name-tree.t.cpp
+++ b/tests/daemon/table/name-tree.t.cpp
@@ -668,7 +668,7 @@
.end();
}
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // IteratorPartialEnumerate
BOOST_FIXTURE_TEST_CASE(IteratorFindAllMatches, EnumerationFixture)
{
diff --git a/tests/daemon/table/network-region-table.t.cpp b/tests/daemon/table/network-region-table.t.cpp
index 11948bc..12865c6 100644
--- a/tests/daemon/table/network-region-table.t.cpp
+++ b/tests/daemon/table/network-region-table.t.cpp
@@ -56,8 +56,8 @@
BOOST_CHECK_EQUAL(nrt4.isInProducerRegion(fh), true);
}
-BOOST_AUTO_TEST_SUITE_END()
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestNetworkRegionTable
+BOOST_AUTO_TEST_SUITE_END() // Table
} // namespace tests
} // namespace nfd
diff --git a/tests/daemon/table/pit-entry.t.cpp b/tests/daemon/table/pit-entry.t.cpp
index a155be2..f46aa38 100644
--- a/tests/daemon/table/pit-entry.t.cpp
+++ b/tests/daemon/table/pit-entry.t.cpp
@@ -52,7 +52,7 @@
BOOST_CHECK_EQUAL(entry.canMatch(*interest2), true);
shared_ptr<Interest> interest3 = makeInterest("/A");
- interest3->setInterestLifetime(time::milliseconds(6210));
+ interest3->setInterestLifetime(6210_ms);
BOOST_CHECK_EQUAL(entry.canMatch(*interest3), true);
shared_ptr<Interest> interest4 = makeInterest("/A");
@@ -71,16 +71,16 @@
Name name("ndn:/KuYfjtRq");
shared_ptr<Interest> interest = makeInterest(name);
shared_ptr<Interest> interest1 = makeInterest(name);
- interest1->setInterestLifetime(time::milliseconds(2528));
+ interest1->setInterestLifetime(2528_ms);
interest1->setNonce(25559);
shared_ptr<Interest> interest2 = makeInterest(name);
- interest2->setInterestLifetime(time::milliseconds(6464));
+ interest2->setInterestLifetime(6464_ms);
interest2->setNonce(19004);
shared_ptr<Interest> interest3 = makeInterest(name);
- interest3->setInterestLifetime(time::milliseconds(3585));
+ interest3->setInterestLifetime(3585_ms);
interest3->setNonce(24216);
shared_ptr<Interest> interest4 = makeInterest(name);
- interest4->setInterestLifetime(time::milliseconds(8795));
+ interest4->setInterestLifetime(8795_ms);
interest4->setNonce(17365);
Entry entry(*interest);
diff --git a/tests/daemon/table/pit.t.cpp b/tests/daemon/table/pit.t.cpp
index 7c6d791..5b051fb 100644
--- a/tests/daemon/table/pit.t.cpp
+++ b/tests/daemon/table/pit.t.cpp
@@ -145,7 +145,7 @@
// A+InterestLifetime
shared_ptr<Interest> interestK = make_shared<Interest>(*interestA);
- interestK->setInterestLifetime(time::milliseconds(1000));
+ interestK->setInterestLifetime(1_s);
insertResult = pit.insert(*interestK);
BOOST_CHECK_EQUAL(insertResult.second, false); // only guiders differ
BOOST_CHECK_EQUAL(pit.size(), 9);
@@ -391,8 +391,8 @@
}
}
-BOOST_AUTO_TEST_SUITE_END()
-BOOST_AUTO_TEST_SUITE_END()
+BOOST_AUTO_TEST_SUITE_END() // TestPit
+BOOST_AUTO_TEST_SUITE_END() // Table
} // namespace tests
} // namespace pit