def testScheduleDestroy(self): """! Test schedule destroy @param self this object @return none """ def callback(args): """! Callback function @param args @return none """ self._args_received = args self._cb_time = Simulator.Now() Simulator.Destroy() self._args_received = None self._cb_time = None def null(): pass Simulator.Schedule(Seconds(123), null) Simulator.ScheduleDestroy(callback, "args") Simulator.Run() Simulator.Destroy() self.assertEqual(self._args_received, "args") self.assertEqual(self._cb_time.GetSeconds(), 123.0)
def testSchedule(self): def callback(args): self._args_received = args self._cb_time = Simulator.Now() Simulator.Destroy() self._args_received = None self._cb_time = None Simulator.Schedule(Seconds(123), callback, "args") Simulator.Run() self.assertEqual(self._args_received, "args") self.assertEqual(self._cb_time.GetSeconds(), 123.0)