blob: 8189f0135e26dab64ac27ddf9cadc58d08825c21 [file] [log] [blame]
Alexander Afanasyevc169a812014-05-20 20:37:29 -04001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Alexander Afanasyevf6468892014-01-29 01:04:14 -08002/**
Junxiao Shid50f2b42016-08-10 02:59:59 +00003 * Copyright (c) 2013-2016 Regents of the University of California.
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -07004 *
5 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -07006 *
Alexander Afanasyevc169a812014-05-20 20:37:29 -04007 * ndn-cxx library is free software: you can redistribute it and/or modify it under the
8 * terms of the GNU Lesser General Public License as published by the Free Software
9 * Foundation, either version 3 of the License, or (at your option) any later version.
10 *
11 * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14 *
15 * You should have received copies of the GNU General Public License and GNU Lesser
16 * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
Alexander Afanasyevf6468892014-01-29 01:04:14 -080020 */
21
22#include "util/scheduler.hpp"
Alexander Afanasyev9a9952f2015-01-28 19:06:48 -080023#include "util/scheduler-scoped-event-id.hpp"
Alexander Afanasyevf6468892014-01-29 01:04:14 -080024
Alexander Afanasyevb1db7c62014-04-03 14:57:25 -070025#include "boost-test.hpp"
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -080026#include "../unit-test-time-fixture.hpp"
Junxiao Shid50f2b42016-08-10 02:59:59 +000027#include <boost/lexical_cast.hpp>
Alexander Afanasyevf6468892014-01-29 01:04:14 -080028
29namespace ndn {
Alexander Afanasyev9a9952f2015-01-28 19:06:48 -080030namespace util {
31namespace scheduler {
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -080032namespace tests {
Alexander Afanasyevf6468892014-01-29 01:04:14 -080033
Spyridon Mastorakis429634f2015-02-19 17:35:33 -080034using namespace ndn::tests;
35
Junxiao Shid50f2b42016-08-10 02:59:59 +000036class SchedulerFixture : public UnitTestTimeFixture
37{
38public:
39 SchedulerFixture()
40 : scheduler(io)
41 {
42 }
43
44public:
45 Scheduler scheduler;
46};
47
48BOOST_AUTO_TEST_SUITE(Util)
49BOOST_FIXTURE_TEST_SUITE(TestScheduler, SchedulerFixture)
Alexander Afanasyevf6468892014-01-29 01:04:14 -080050
Davide Pesaventoeee3e822016-11-26 19:19:34 +010051BOOST_AUTO_TEST_SUITE(General)
52
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -080053BOOST_AUTO_TEST_CASE(Events)
Alexander Afanasyevf6468892014-01-29 01:04:14 -080054{
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -080055 size_t count1 = 0;
56 size_t count2 = 0;
Alexander Afanasyevf6468892014-01-29 01:04:14 -080057
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -080058 scheduler.scheduleEvent(time::milliseconds(500), [&] {
59 ++count1;
60 BOOST_CHECK_EQUAL(count2, 1);
61 });
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -070062
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -080063 EventId i = scheduler.scheduleEvent(time::seconds(1), [&] {
64 BOOST_ERROR("This event should not have been fired");
65 });
Alexander Afanasyevf6468892014-01-29 01:04:14 -080066 scheduler.cancelEvent(i);
67
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -080068 scheduler.scheduleEvent(time::milliseconds(250), [&] {
69 BOOST_CHECK_EQUAL(count1, 0);
70 ++count2;
71 });
Alexander Afanasyevf6468892014-01-29 01:04:14 -080072
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -080073 i = scheduler.scheduleEvent(time::milliseconds(50), [&] {
74 BOOST_ERROR("This event should not have been fired");
75 });
Alexander Afanasyevf6468892014-01-29 01:04:14 -080076 scheduler.cancelEvent(i);
77
Junxiao Shid50f2b42016-08-10 02:59:59 +000078 advanceClocks(time::milliseconds(25), time::milliseconds(1000));
Alexander Afanasyevf6468892014-01-29 01:04:14 -080079 BOOST_CHECK_EQUAL(count1, 1);
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -080080 BOOST_CHECK_EQUAL(count2, 1);
Alexander Afanasyevf6468892014-01-29 01:04:14 -080081}
82
Junxiao Shi86dfa532016-08-10 03:00:11 +000083BOOST_AUTO_TEST_CASE(CallbackException)
84{
85 class MyException : public std::exception
86 {
87 };
88 scheduler.scheduleEvent(time::milliseconds(10), [] { BOOST_THROW_EXCEPTION(MyException()); });
89
90 bool isCallbackInvoked = false;
91 scheduler.scheduleEvent(time::milliseconds(20), [&isCallbackInvoked] { isCallbackInvoked = true; });
92
93 BOOST_CHECK_THROW(this->advanceClocks(time::milliseconds(6), 2), MyException);
94 this->advanceClocks(time::milliseconds(6), 2);
95 BOOST_CHECK(isCallbackInvoked);
96}
97
Yingdi Yuf2a82092014-02-03 16:49:15 -080098BOOST_AUTO_TEST_CASE(CancelEmptyEvent)
99{
Yingdi Yuf2a82092014-02-03 16:49:15 -0800100 EventId i;
101 scheduler.cancelEvent(i);
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100102
103 // avoid "test case [...] did not check any assertions" message from Boost.Test
104 BOOST_CHECK(true);
Yingdi Yuf2a82092014-02-03 16:49:15 -0800105}
106
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800107BOOST_AUTO_TEST_CASE(SelfCancel)
Yingdi Yuf2a82092014-02-03 16:49:15 -0800108{
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800109 EventId selfEventId;
110 selfEventId = scheduler.scheduleEvent(time::milliseconds(100), [&] {
111 scheduler.cancelEvent(selfEventId);
112 });
Yingdi Yuf2a82092014-02-03 16:49:15 -0800113
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800114 BOOST_REQUIRE_NO_THROW(advanceClocks(time::milliseconds(100), 10));
Yingdi Yuf2a82092014-02-03 16:49:15 -0800115}
116
Junxiao Shid50f2b42016-08-10 02:59:59 +0000117class SelfRescheduleFixture : public SchedulerFixture
Yingdi Yuf2a82092014-02-03 16:49:15 -0800118{
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800119public:
Yingdi Yuf2a82092014-02-03 16:49:15 -0800120 SelfRescheduleFixture()
Junxiao Shid50f2b42016-08-10 02:59:59 +0000121 : count(0)
Yingdi Yuf2a82092014-02-03 16:49:15 -0800122 {
123 }
124
125 void
126 reschedule()
127 {
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800128 EventId eventId = scheduler.scheduleEvent(time::milliseconds(100),
129 bind(&SelfRescheduleFixture::reschedule, this));
130 scheduler.cancelEvent(selfEventId);
131 selfEventId = eventId;
Yingdi Yuf2a82092014-02-03 16:49:15 -0800132
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800133 if (count < 5)
134 count++;
Yingdi Yuf2a82092014-02-03 16:49:15 -0800135 else
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800136 scheduler.cancelEvent(selfEventId);
Yingdi Yuf2a82092014-02-03 16:49:15 -0800137 }
138
139 void
140 reschedule2()
141 {
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800142 scheduler.cancelEvent(selfEventId);
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700143
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800144 if (count < 5) {
145 selfEventId = scheduler.scheduleEvent(time::milliseconds(100),
146 bind(&SelfRescheduleFixture::reschedule2, this));
147 count++;
148 }
Yingdi Yuf2a82092014-02-03 16:49:15 -0800149 }
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700150
Yingdi Yuf2a82092014-02-03 16:49:15 -0800151 void
152 reschedule3()
153 {
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800154 scheduler.cancelEvent(selfEventId);
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700155
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800156 scheduler.scheduleEvent(time::milliseconds(100), [&] { ++count; });
157 scheduler.scheduleEvent(time::milliseconds(100), [&] { ++count; });
158 scheduler.scheduleEvent(time::milliseconds(100), [&] { ++count; });
159 scheduler.scheduleEvent(time::milliseconds(100), [&] { ++count; });
160 scheduler.scheduleEvent(time::milliseconds(100), [&] { ++count; });
161 scheduler.scheduleEvent(time::milliseconds(100), [&] { ++count; });
Yingdi Yuf2a82092014-02-03 16:49:15 -0800162 }
163
Junxiao Shid50f2b42016-08-10 02:59:59 +0000164public:
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800165 EventId selfEventId;
166 size_t count;
Yingdi Yuf2a82092014-02-03 16:49:15 -0800167};
168
169BOOST_FIXTURE_TEST_CASE(Reschedule, SelfRescheduleFixture)
170{
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800171 selfEventId = scheduler.scheduleEvent(time::seconds(0),
172 bind(&SelfRescheduleFixture::reschedule, this));
Yingdi Yuf2a82092014-02-03 16:49:15 -0800173
Junxiao Shid50f2b42016-08-10 02:59:59 +0000174 BOOST_REQUIRE_NO_THROW(advanceClocks(time::milliseconds(50), time::milliseconds(1000)));
Yingdi Yuf2a82092014-02-03 16:49:15 -0800175
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800176 BOOST_CHECK_EQUAL(count, 5);
Yingdi Yuf2a82092014-02-03 16:49:15 -0800177}
178
179BOOST_FIXTURE_TEST_CASE(Reschedule2, SelfRescheduleFixture)
180{
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800181 selfEventId = scheduler.scheduleEvent(time::seconds(0),
182 bind(&SelfRescheduleFixture::reschedule2, this));
Yingdi Yuf2a82092014-02-03 16:49:15 -0800183
Junxiao Shid50f2b42016-08-10 02:59:59 +0000184 BOOST_REQUIRE_NO_THROW(advanceClocks(time::milliseconds(50), time::milliseconds(1000)));
Yingdi Yuf2a82092014-02-03 16:49:15 -0800185
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800186 BOOST_CHECK_EQUAL(count, 5);
Yingdi Yuf2a82092014-02-03 16:49:15 -0800187}
188
189BOOST_FIXTURE_TEST_CASE(Reschedule3, SelfRescheduleFixture)
190{
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800191 selfEventId = scheduler.scheduleEvent(time::seconds(0),
192 bind(&SelfRescheduleFixture::reschedule3, this));
Yingdi Yuf2a82092014-02-03 16:49:15 -0800193
Junxiao Shid50f2b42016-08-10 02:59:59 +0000194 BOOST_REQUIRE_NO_THROW(advanceClocks(time::milliseconds(50), time::milliseconds(1000)));
Yingdi Yuf2a82092014-02-03 16:49:15 -0800195
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800196 BOOST_CHECK_EQUAL(count, 6);
Yingdi Yuf2a82092014-02-03 16:49:15 -0800197}
198
Junxiao Shid50f2b42016-08-10 02:59:59 +0000199class CancelAllFixture : public SchedulerFixture
Alexander Afanasyev7ae4bf52014-07-11 17:12:41 -0700200{
Junxiao Shid50f2b42016-08-10 02:59:59 +0000201public:
Alexander Afanasyev7ae4bf52014-07-11 17:12:41 -0700202 CancelAllFixture()
Junxiao Shid50f2b42016-08-10 02:59:59 +0000203 : count(0)
Alexander Afanasyev7ae4bf52014-07-11 17:12:41 -0700204 {
205 }
206
207 void
Alexander Afanasyev7ae4bf52014-07-11 17:12:41 -0700208 event()
209 {
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800210 ++count;
Alexander Afanasyev7ae4bf52014-07-11 17:12:41 -0700211
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800212 scheduler.scheduleEvent(time::seconds(1), [&] { event(); });
Alexander Afanasyev7ae4bf52014-07-11 17:12:41 -0700213 }
214
Junxiao Shid50f2b42016-08-10 02:59:59 +0000215public:
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800216 uint32_t count;
Alexander Afanasyev7ae4bf52014-07-11 17:12:41 -0700217};
218
Alexander Afanasyev7ae4bf52014-07-11 17:12:41 -0700219BOOST_FIXTURE_TEST_CASE(CancelAll, CancelAllFixture)
220{
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800221 scheduler.scheduleEvent(time::milliseconds(500), [&] { scheduler.cancelAllEvents(); });
Alexander Afanasyev7ae4bf52014-07-11 17:12:41 -0700222
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800223 scheduler.scheduleEvent(time::seconds(1), [&] { event(); });
Alexander Afanasyev7ae4bf52014-07-11 17:12:41 -0700224
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800225 scheduler.scheduleEvent(time::seconds(3), [] {
226 BOOST_ERROR("This event should have been cancelled" );
227 });
Alexander Afanasyev7ae4bf52014-07-11 17:12:41 -0700228
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800229 advanceClocks(time::milliseconds(100), 100);
Alexander Afanasyev7ae4bf52014-07-11 17:12:41 -0700230
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800231 BOOST_CHECK_EQUAL(count, 0);
Alexander Afanasyev7ae4bf52014-07-11 17:12:41 -0700232}
233
Junxiao Shid50f2b42016-08-10 02:59:59 +0000234BOOST_AUTO_TEST_CASE(CancelAllWithScopedEventId) // Bug 3691
Alexander Afanasyev9a9952f2015-01-28 19:06:48 -0800235{
Junxiao Shid50f2b42016-08-10 02:59:59 +0000236 Scheduler sched(io);
237 ScopedEventId eid(sched);
238 eid = sched.scheduleEvent(time::milliseconds(10), []{});
239 sched.cancelAllEvents();
240 eid.cancel(); // should not crash
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100241
242 // avoid "test case [...] did not check any assertions" message from Boost.Test
243 BOOST_CHECK(true);
Junxiao Shid50f2b42016-08-10 02:59:59 +0000244}
Alexander Afanasyev7ae4bf52014-07-11 17:12:41 -0700245
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100246BOOST_AUTO_TEST_SUITE_END() // General
247
Junxiao Shid50f2b42016-08-10 02:59:59 +0000248BOOST_AUTO_TEST_SUITE(EventId)
Alexander Afanasyev9a9952f2015-01-28 19:06:48 -0800249
Junxiao Shid50f2b42016-08-10 02:59:59 +0000250using scheduler::EventId;
Alexander Afanasyev9a9952f2015-01-28 19:06:48 -0800251
Junxiao Shid50f2b42016-08-10 02:59:59 +0000252BOOST_AUTO_TEST_CASE(ConstructEmpty)
253{
254 EventId eid;
255 eid = nullptr;
Davide Pesaventoeee3e822016-11-26 19:19:34 +0100256
257 // avoid "test case [...] did not check any assertions" message from Boost.Test
258 BOOST_CHECK(true);
Junxiao Shid50f2b42016-08-10 02:59:59 +0000259}
260
261BOOST_AUTO_TEST_CASE(Compare)
262{
263 EventId eid, eid2;
264 BOOST_CHECK_EQUAL(eid == eid2, true);
265 BOOST_CHECK_EQUAL(eid != eid2, false);
266 BOOST_CHECK_EQUAL(eid == nullptr, true);
267 BOOST_CHECK_EQUAL(eid != nullptr, false);
268
269 eid = scheduler.scheduleEvent(time::milliseconds(10), []{});
270 BOOST_CHECK_EQUAL(eid == eid2, false);
271 BOOST_CHECK_EQUAL(eid != eid2, true);
272 BOOST_CHECK_EQUAL(eid == nullptr, false);
273 BOOST_CHECK_EQUAL(eid != nullptr, true);
274
275 eid2 = eid;
276 BOOST_CHECK_EQUAL(eid == eid2, true);
277 BOOST_CHECK_EQUAL(eid != eid2, false);
278
279 eid2 = scheduler.scheduleEvent(time::milliseconds(10), []{});
280 BOOST_CHECK_EQUAL(eid == eid2, false);
281 BOOST_CHECK_EQUAL(eid != eid2, true);
282}
283
284BOOST_AUTO_TEST_CASE(Valid)
285{
286 EventId eid;
287 BOOST_CHECK_EQUAL(static_cast<bool>(eid), false);
288 BOOST_CHECK_EQUAL(!eid, true);
289
290 eid = scheduler.scheduleEvent(time::milliseconds(10), []{});
291 BOOST_CHECK_EQUAL(static_cast<bool>(eid), true);
292 BOOST_CHECK_EQUAL(!eid, false);
293
294 EventId eid2 = eid;
295 scheduler.cancelEvent(eid2);
296 BOOST_CHECK_EQUAL(static_cast<bool>(eid), false);
297 BOOST_CHECK_EQUAL(!eid, true);
298 BOOST_CHECK_EQUAL(static_cast<bool>(eid2), false);
299 BOOST_CHECK_EQUAL(!eid2, true);
300}
301
302BOOST_AUTO_TEST_CASE(DuringCallback)
303{
304 EventId eid;
305 EventId eid2 = scheduler.scheduleEvent(time::milliseconds(20), []{});
306
307 bool isCallbackInvoked = false;
308 eid = scheduler.scheduleEvent(time::milliseconds(10), [this, &eid, &eid2, &isCallbackInvoked] {
309 isCallbackInvoked = true;
310
311 // eid is "expired" during callback execution
312 BOOST_CHECK_EQUAL(static_cast<bool>(eid), false);
313 BOOST_CHECK_EQUAL(!eid, true);
314 BOOST_CHECK_EQUAL(eid == eid2, false);
315 BOOST_CHECK_EQUAL(eid != eid2, true);
316 BOOST_CHECK_EQUAL(eid == nullptr, true);
317 BOOST_CHECK_EQUAL(eid != nullptr, false);
318
319 scheduler.cancelEvent(eid2);
320 BOOST_CHECK_EQUAL(eid == eid2, true);
321 BOOST_CHECK_EQUAL(eid != eid2, false);
322 });
323 this->advanceClocks(time::milliseconds(6), 2);
324 BOOST_CHECK(isCallbackInvoked);
325}
326
327BOOST_AUTO_TEST_CASE(Reset)
328{
329 bool isCallbackInvoked = false;
330 EventId eid = scheduler.scheduleEvent(time::milliseconds(10),
331 [&isCallbackInvoked]{ isCallbackInvoked = true; });
332 eid.reset();
333 BOOST_CHECK_EQUAL(!eid, true);
334 BOOST_CHECK_EQUAL(eid == nullptr, true);
335
336 this->advanceClocks(time::milliseconds(6), 2);
337 BOOST_CHECK(isCallbackInvoked);
338}
339
340BOOST_AUTO_TEST_CASE(ToString)
341{
342 std::string nullString = boost::lexical_cast<std::string>(shared_ptr<int>());
343
344 EventId eid;
345 BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(eid), nullString);
346
347 eid = scheduler.scheduleEvent(time::milliseconds(10), []{});
348 BOOST_TEST_MESSAGE("eid=" << eid);
349 BOOST_CHECK_NE(boost::lexical_cast<std::string>(eid), nullString);
350}
351
352BOOST_AUTO_TEST_SUITE_END() // EventId
353
354BOOST_AUTO_TEST_SUITE(ScopedEventId)
355
356using scheduler::ScopedEventId;
357
358BOOST_AUTO_TEST_CASE(Destruct)
Alexander Afanasyev9a9952f2015-01-28 19:06:48 -0800359{
360 int hit = 0;
361 {
362 ScopedEventId se(scheduler);
363 se = scheduler.scheduleEvent(time::milliseconds(10), [&] { ++hit; });
364 } // se goes out of scope
365 this->advanceClocks(time::milliseconds(1), 15);
366 BOOST_CHECK_EQUAL(hit, 0);
367}
368
Junxiao Shid50f2b42016-08-10 02:59:59 +0000369BOOST_AUTO_TEST_CASE(Assign)
Alexander Afanasyev9a9952f2015-01-28 19:06:48 -0800370{
371 int hit1 = 0, hit2 = 0;
372 ScopedEventId se1(scheduler);
373 se1 = scheduler.scheduleEvent(time::milliseconds(10), [&] { ++hit1; });
374 se1 = scheduler.scheduleEvent(time::milliseconds(10), [&] { ++hit2; });
375 this->advanceClocks(time::milliseconds(1), 15);
376 BOOST_CHECK_EQUAL(hit1, 0);
377 BOOST_CHECK_EQUAL(hit2, 1);
378}
379
Junxiao Shid50f2b42016-08-10 02:59:59 +0000380BOOST_AUTO_TEST_CASE(Release)
Alexander Afanasyev9a9952f2015-01-28 19:06:48 -0800381{
382 int hit = 0;
383 {
384 ScopedEventId se(scheduler);
385 se = scheduler.scheduleEvent(time::milliseconds(10), [&] { ++hit; });
386 se.release();
387 } // se goes out of scope
388 this->advanceClocks(time::milliseconds(1), 15);
389 BOOST_CHECK_EQUAL(hit, 1);
390}
391
Junxiao Shid50f2b42016-08-10 02:59:59 +0000392BOOST_AUTO_TEST_CASE(Move)
Alexander Afanasyev9a9952f2015-01-28 19:06:48 -0800393{
394 int hit = 0;
395 unique_ptr<scheduler::ScopedEventId> se2;
396 {
397 ScopedEventId se(scheduler);
398 se = scheduler.scheduleEvent(time::milliseconds(10), [&] { ++hit; });
399 se2.reset(new ScopedEventId(std::move(se)));
400 } // se goes out of scope
401 this->advanceClocks(time::milliseconds(1), 15);
402 BOOST_CHECK_EQUAL(hit, 1);
403}
404
405BOOST_AUTO_TEST_SUITE_END() // ScopedEventId
406
Junxiao Shid50f2b42016-08-10 02:59:59 +0000407BOOST_AUTO_TEST_SUITE_END() // TestScheduler
408BOOST_AUTO_TEST_SUITE_END() // Util
Alexander Afanasyevf6468892014-01-29 01:04:14 -0800409
Alexander Afanasyevd3a55b22014-11-18 19:23:28 -0800410} // namespace tests
Alexander Afanasyev9a9952f2015-01-28 19:06:48 -0800411} // namespace scheduler
412} // namespace util
Alexander Afanasyevf6468892014-01-29 01:04:14 -0800413} // namespace ndn