MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / TEST

Function TEST

tests/unit-tests/dds/DCPS/SporadicTask.cpp:57–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57TEST(dds_DCPS_SporadicTask, schedule)
58{
59 MyTimeSource time_source;
60 MyReactor* reactor = new MyReactor;
61 ThreadStatusManager tsm;
62 ReactorTask reactor_task(false);
63 reactor_task.open_reactor_task(&tsm, "test", reactor);
64 RcHandle<MySporadicTask> sporadic_task = make_rch<MySporadicTask>(time_source, rchandle_from(&reactor_task));
65 const TimeDuration one_second(1);
66 const ACE_Time_Value now(7);
67
68 EXPECT_CALL(time_source, monotonic_time_point_now())
69 .Times(1)
70 .WillOnce(testing::Return(MonotonicTimePoint::zero_value));
71 EXPECT_CALL(*reactor, schedule_timer(sporadic_task.get(), 0, one_second.value(), ACE_Time_Value::zero))
72 .Times(1)
73 .WillOnce(testing::Return(1));
74 EXPECT_CALL(*sporadic_task.get(), execute(MonotonicTimePoint(now)));
75
76 sporadic_task->schedule(one_second);
77 reactor_task.wait_until_empty();
78
79 // Execute.
80 RcHandle<RcEventHandler> eh = sporadic_task;
81 eh->handle_timeout(now);
82
83 reactor_task.stop();
84}
85
86TEST(dds_DCPS_SporadicTask, schedule_pmf)
87{

Callers

nothing calls this directly

Calls 12

rchandle_fromFunction · 0.85
open_reactor_taskMethod · 0.80
wait_until_emptyMethod · 0.80
stopMethod · 0.65
logFunction · 0.50
getMethod · 0.45
valueMethod · 0.45
scheduleMethod · 0.45
handle_timeoutMethod · 0.45
timer_idMethod · 0.45
cancelMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected