update scheduler test for reschedule
diff --git a/test/test-event-scheduler.cc b/test/test-event-scheduler.cc
index 0eacba0..4db9a0e 100644
--- a/test/test-event-scheduler.cc
+++ b/test/test-event-scheduler.cc
@@ -96,6 +96,16 @@
BOOST_CHECK_EQUAL(scheduler->size(), 1);
usleep(1000000);
+ BOOST_CHECK_EQUAL(scheduler->size(), 0);
+ scheduler->addTask(task1);
+ usleep(400000);
+ BOOST_CHECK_EQUAL(scheduler->size(), 1);
+ scheduler->rescheduleTask(task1);
+ usleep(400000);
+ BOOST_CHECK_EQUAL(scheduler->size(), 1);
+ usleep(110000);
+ BOOST_CHECK_EQUAL(scheduler->size(), 0);
+
int hello = 0, world = 0, period = 0;
@@ -116,8 +126,8 @@
period = it->second;
}
- // added four times, canceled once before invoking callback
- BOOST_CHECK_EQUAL(hello, 3);
+ // added five times, canceled once before invoking callback
+ BOOST_CHECK_EQUAL(hello, 4);
// added two times, canceled once by matcher before invoking callback
BOOST_CHECK_EQUAL(world, 1);
// invoked every 0.2 seconds before deleted by matcher