32 #include <boost/bind.hpp> 33 #include <boost/scoped_ptr.hpp> 36 using namespace boost;
41 struct Runner :
public RunnableInterface
170 t_listener_value =
true;
175 t_listener_what = what;
187 t_listener_value =
false;
188 t_listener_what =
"";
202 testConcurrentEmitHandlerCount.
inc();
206 :
public RunnableInterface
210 : mev(ev), count(0) {}
221 this->getActivity()->trigger();
238 BOOST_CHECK(task.
start());
240 BOOST_CHECK( runobj.
result );
247 BOOST_CHECK( task.
start() );
249 BOOST_CHECK( task.
stop() );
259 Handle h =
event.
connect( boost::bind(&testReference::float_reference,
this, _1) );
267 BOOST_CHECK( f == 10.0 );
268 BOOST_CHECK(float_sum == 10.0 );
275 BOOST_CHECK( task.
start() );
277 BOOST_CHECK( task.
stop() );
280 #ifdef OROCOS_TARGET_GNULINUX 283 testConcurrentEmitHandlerCount.
set(0);
295 BOOST_CHECK( atask.
start() );
296 BOOST_CHECK( btask.
start() );
297 BOOST_CHECK( ctask.
start() );
298 BOOST_CHECK( dtask.
start() );
300 BOOST_CHECK( atask.
stop() );
301 BOOST_CHECK( btask.
stop() );
302 BOOST_CHECK( ctask.
stop() );
303 BOOST_CHECK( dtask.
stop() );
305 BOOST_CHECK_EQUAL( arunobj.
count + brunobj.
count + crunobj.
count + drunobj.
count, testConcurrentEmitHandlerCount.
read() );
314 BOOST_CHECK(task.
start());
316 BOOST_CHECK(task.
stop());
318 BOOST_CHECK( runobj.
result );
326 t_event_float(1.0, 4.0);
327 BOOST_CHECK_EQUAL(
float(5.0), float_sum );
329 float a = 10.0, b = 5.0;
331 BOOST_CHECK_EQUAL(
float(20.0), float_sum );
346 BOOST_CHECK( t_listener_value );
354 t_event_string( std::string(
"What") );
358 BOOST_CHECK_EQUAL( t_listener_what, std::string(
"What") );
359 BOOST_CHECK( !t_listener_value );
368 BOOST_CHECK( !hl.connected() );
371 BOOST_CHECK( hl.connected() );
377 BOOST_CHECK( !hl.connected() );
378 BOOST_CHECK( t_listener_value );
382 BOOST_CHECK( t_listener_value ==
false );
388 BOOST_CHECK( !hl.connected() );
389 BOOST_CHECK( t_listener_value ==
true );
#define BOOST_FIXTURE_TEST_SUITE(suite_name, F)
SelfRemover(Signal< void(void)> &e_)
#define BOOST_AUTO_TEST_SUITE_END()
int usleep(unsigned int us)
std::string t_listener_what
void testConcurrentEmitHandler(void)
void listenerString(const std::string &what)
static std::ostream & endl(std::ostream &__os)
Runner(Signal< void(int)> &e_)
Signal< void(std::string)> t_event_string
Signal< void(void)> & mev
An Activity executes a RunnableInterface object in a (periodic) thread.
unsigned int sleep(unsigned int s)
EmitAndcount(Signal< void(void)> &ev)
Signal< int(float, float)> t_event_float
Signal< void(void)> t_event
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
int float_listener(float a, float b)
BOOST_AUTO_TEST_CASE(testEmpty)
The Handle holds the information, and allows manipulation, of a connection between a internal::Signal...
static Logger::LogFunction endlog()
void float_reference(float &f)
CrossRemover(Signal< void(void)> &e_)
static AtomicInt testConcurrentEmitHandlerCount