// $Id$
//
-// Copyright (C) 2007
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
+// Copyright (C) 2007
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
// Stefan Bund <g0dil@berlios.de>
//
// This program is free software; you can redistribute it and/or modify
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/** \file
- \brief IntervalTimer.test unit tests */
+ \brief IntervalTimer unit tests */
//#include "IntervalTimer.test.hh"
//#include "IntervalTimer.test.ih"
namespace ppi = senf::ppi;
namespace {
-
+
class TimerTest : public module::Module
{
SENF_PPI_MODULE(TimerTest);
unsigned n;
public:
- TimerTest(senf::ClockService::clock_type d_, unsigned n_)
- : timer ( senf::ClockService::milliseconds(d_) ),
- n ( n_ )
+ TimerTest(senf::ClockService::int64_type d_, unsigned n_)
+ : timer ( senf::ClockService::milliseconds(d_) ),
+ n ( n_ )
{
registerEvent( timer, &TimerTest::tick );
}
};
- bool is_close_clock(senf::ClockService::clock_type a, senf::ClockService::clock_type b,
- unsigned long delta = senf::ClockService::milliseconds(100))
+ bool is_close_clock(senf::ClockService::clock_type a, senf::ClockService::clock_type b,
+ senf::ClockService::clock_type delta)
{
return (a<b ? b-a : a-b ) < delta;
}
BOOST_AUTO_UNIT_TEST(intervalTimer)
{
- TimerTest timer (100,4);
+ TimerTest timer (100,3);
senf::ClockService::clock_type start (senf::ClockService::now());
senf::ppi::run();
- BOOST_CHECK_PREDICATE( is_close_clock,
+ BOOST_CHECK_PREDICATE( is_close_clock,
(senf::ClockService::now())
- (start+senf::ClockService::milliseconds(400)) );
+ (start+senf::ClockService::milliseconds(300))
+ (senf::ClockService::milliseconds(80)) );
}
///////////////////////////////cc.e////////////////////////////////////////