Timer checks is setTimer parameter timerId is in the map

master
Denes Matetelki 13 years ago
parent 4bfa4165ff
commit 770f525a8a

@ -70,6 +70,13 @@ bool Timer::setTimer( timer_t timerId,
const time_t initExpr_sec,
const long initExpr_nsec )
{
if (m_timerUsers.find(timerId) == m_timerUsers.end() ) {
LOG_BEGIN(Logger::ERR)
LOG_SPROP(timerId)
LOG_END("TimerId is not in the map.");
return false;
}
itimerspec its;
its.it_value.tv_sec = interval_sec;
its.it_value.tv_nsec = interval_nsec;

@ -185,4 +185,14 @@ private:
TS_ASSERT_EQUALS(timer.stopTimer( timerId ), false);
}
void testSetTimerWhichIsNotInTheMap()
{
TEST_HEADER;
Timer timer;
timer_t timerId = (void*)1234;
TS_ASSERT_EQUALS(timer.setTimer( timerId, 1 ), false);
}
};

Loading…
Cancel
Save