21 #include "mqueue_test.hpp" 46 tc->ports()->addPort( mr1 );
47 tc->ports()->addPort( mw1 );
50 t2->ports()->addPort( mr2 );
51 t2->ports()->addPort( mw2 );
57 MQueueTest::tearDown()
70 signalled_port = port;
74 #define ASSERT_PORT_SIGNALLING(code, read_port) \ 77 rtos_disable_rt_warning(); \ 79 rtos_enable_rt_warning(); \ 80 BOOST_CHECK( read_port == signalled_port ); 93 BOOST_CHECK(
NoData == mr2->read(value) );
97 BOOST_CHECK( mr2->read(value) );
98 BOOST_CHECK_EQUAL( 1.0, value );
100 BOOST_CHECK( mr2->read(value) );
101 BOOST_CHECK_EQUAL( 2.0, value );
102 BOOST_CHECK(
OldData == mr2->read(value) );
118 BOOST_CHECK(
NoData == mr2->read(value) );
125 BOOST_CHECK( mr2->read(value) );
126 BOOST_CHECK_EQUAL( 1.0, value );
127 BOOST_CHECK( mr2->read(value) );
128 BOOST_CHECK_EQUAL( 2.0, value );
129 BOOST_CHECK( mr2->read(value) );
130 BOOST_CHECK_EQUAL( 3.0, value );
131 BOOST_CHECK(
OldData == mr2->read(value) );
161 Handle hl( mr2->getNewDataOnPortEvent()->setup(
176 BOOST_CHECK( policy.
name_id ==
"/data1" );
177 testPortDataConnection();
180 testPortDisconnected();
186 testPortDataConnection();
189 testPortDisconnected();
198 testPortBufferConnection();
201 testPortDisconnected();
210 testPortBufferConnection();
214 testPortDisconnected();
229 Handle hl( mr2->getNewDataOnPortEvent()->setup(
243 testPortDataConnection();
246 testPortDisconnected();
253 testPortDataConnection();
256 testPortDisconnected();
264 testPortBufferConnection();
267 testPortDisconnected();
275 testPortBufferConnection();
278 testPortDisconnected();
296 BOOST_CHECK( mr2->
connected() == false );
304 BOOST_CHECK( mr2->
connected() == false );
324 BOOST_CHECK( mr2->
connected() == false );
332 BOOST_CHECK( mr2->
connected() == false );
348 Handle hl( mr2->getNewDataOnPortEvent()->setup(
355 std::vector<double> data(20, 3.33);
358 ports->
addPort(&vin,
"input port");
359 ports2->
addPort(&vout,
"output port");
364 for(
int i=0; i != 20; ++i)
365 BOOST_CHECK_CLOSE( data[i], 3.33, 0.01);
378 data.resize(10, 6.66);
379 for(
int i=0; i != data.size(); ++i)
380 BOOST_CHECK_CLOSE( data[i], 6.66, 0.01);
388 data.resize(20, 0.0);
396 BOOST_CHECK_EQUAL( data.size(), 10);
397 BOOST_CHECK_EQUAL( data.capacity(), 20);
398 for(
int i=0; i != data.size(); ++i)
399 BOOST_CHECK_CLOSE( data[i], 6.66, 0.01);
void setDataSample(const T &sample)
base::PortInterface & addPort(const std::string &name, base::PortInterface &port)
#define BOOST_FIXTURE_TEST_SUITE(suite_name, F)
BOOST_AUTO_TEST_CASE(testPortConnections)
#define BOOST_AUTO_TEST_SUITE_END()
void testPortDisconnected()
int usleep(unsigned int us)
void testPortBufferConnection()
void rtos_disable_rt_warning()
virtual bool createStream(ConnPolicy const &policy)
WriteStatus write(const T &sample)
static const int LOCK_FREE
virtual bool connected() const
#define ASSERT_PORT_SIGNALLING(code, read_port)
virtual void disconnect()
void new_data_listener(PortInterface *port)
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
void testPortDataConnection()
void rtos_enable_rt_warning()
T getLastWrittenValue() const
The Handle holds the information, and allows manipulation, of a connection between a internal::Signal...
#define ORO_MQUEUE_PROTOCOL_ID