30 #ifndef PublisherFlush_cpp 31 #define PublisherFlush_cpp 33 #include <cppunit/ui/text/TestRunner.h> 34 #include <cppunit/TextOutputter.h> 35 #include <cppunit/extensions/TestFactoryRegistry.h> 36 #include <cppunit/extensions/HelperMacros.h> 37 #include <cppunit/TestAssert.h> 43 #include <rtm/idl/BasicDataTypeSkel.h> 70 const RTC::TimedLong&
data)
72 std::cout <<
"------------------------------" << std::endl;
73 std::cout <<
"Listener: " <<
m_name << std::endl;
74 std::cout <<
" Data: " << data.data << std::endl;
75 std::cout <<
"------------------------------" << std::endl;
110 if (m_buffer->full())
142 else if(m_OnCheck == 1) {
145 else if(m_OnCheck == 2) {
148 else if(m_OnCheck == 3) {
151 else if(m_OnCheck == 4) {
154 else if(m_OnCheck == 5) {
177 :
public CppUnit::TestFixture
181 CPPUNIT_TEST(test_setConsumer);
182 CPPUNIT_TEST(test_activate_deactivate_isActive);
183 CPPUNIT_TEST(test_write);
186 CPPUNIT_TEST_SUITE_END();
261 CPPUNIT_ASSERT_EQUAL(
false,
267 CPPUNIT_ASSERT_EQUAL(
true,
276 CPPUNIT_ASSERT_EQUAL(
true,
282 CPPUNIT_ASSERT_EQUAL(
false,
291 CPPUNIT_ASSERT_EQUAL(
false,
347 publisher.
write(cdr,0,0));
360 publisher.
write(cdr,0,0));
364 CORBA::Long testdata[8] = { 123,279,3106,31611,125563,
365 125563,846459,2071690107 };
367 for(
int icc(0);icc<7;++icc)
371 td.data = testdata[icc+1];
375 publisher.
write(cdr,0,0));
386 publisher.
write(cdr,0,0));
389 for(
int icc(0);icc<8;++icc)
391 cdrMemoryStream
data;
393 CORBA::ULong inlen = data.bufSize();
394 CPPUNIT_ASSERT_EQUAL(12,(
int)inlen);
399 CPPUNIT_ASSERT_EQUAL((
long)testdata[icc], (
long)rtd.data);
410 publisher.
write(cdr,0,0));
419 publisher.
write(cdr,0,0);
421 publisher.
write(cdr,0,0);
423 publisher.
write(cdr,0,0);
425 publisher.
write(cdr,0,0);
427 publisher.
write(cdr,0,0);
481 int main(
int argc,
char* argv[])
494 std::string arg(argv[i]);
495 std::string next_arg;
496 if (i + 1 < argc) next_arg = argv[i + 1];
499 if (arg ==
"--text") { format =
TEXT_OUT;
break; }
512 ofs.open(fname.c_str());
514 if ( arg ==
"--compiler" ) { format =
COMPILER_OUT;
break; }
515 if ( arg ==
"--cerr" ) { target = 1;
break; }
516 if ( arg ==
"--xsl" )
518 if (next_arg ==
"") xsl =
"default.xsl";
521 if ( arg ==
"--namespace" )
525 std::cerr <<
"no namespace specified" << std::endl;
535 CppUnit::TextUi::TestRunner runner;
537 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
539 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry(ns).makeTest());
540 CppUnit::Outputter* outputter = 0;
541 std::ostream* stream = target ? &std::cerr : &std::cout;
545 outputter =
new CppUnit::TextOutputter(&runner.result(),*stream);
548 std::cout <<
"XML_OUT" << std::endl;
549 outputter =
new CppUnit::XmlOutputter(&runner.result(),
551 static_cast<CppUnit::XmlOutputter*
>(outputter)->setStyleSheet(xsl);
554 outputter =
new CppUnit::CompilerOutputter(&runner.result(),*stream);
557 runner.setOutputter(outputter);
562 #endif // PublisherFlush_cpp
void test_write(void)
write()メソッドのテスト
ConnectorListeners class.
int main(int argc, char **argv)
virtual ReturnCode write(const cdrMemoryStream &data, unsigned long sec, unsigned long usec)
Write data.
virtual ReturnCode deactivate()
deactivation
InPortCorbaCdrConsumer class.
virtual ::RTC::DataPortStatus::Enum setListener(ConnectorInfo &profile, RTC::ConnectorListeners *listeners)
Set the listener.
virtual ReturnCode setConsumer(InPortConsumer *consumer)
Store InPort consumer.
void addListener(ConnectorDataListener *listener, bool autoclean)
Add the listener.
RTC::ReturnCode_t ret(RTC::Local::ReturnCode_t r)
void test_activate_deactivate_isActive(void)
activate(),deactivate(),isActiveメソッドのテスト
void test_setConsumer(void)
setConsumer()メソッドのテスト
RingBuffer< cdrMemoryStream > CdrRingBuffer
Enum
DataPortStatus return codes.
virtual void operator()(const RTC::ConnectorInfo &info, const RTC::TimedLong &data)
Virtual Callback method.
std::vector< std::string > vstring
RTC::CdrBufferBase * m_buffer
ConnectorDataListenerHolder connectorData_[CONNECTOR_DATA_LISTENER_NUM]
ConnectorDataListenerType listener array The ConnectorDataListenerType listener is stored...
ConnectorDataListenerT class.
virtual void tearDown()
Test finalization.
CPPUNIT_TEST_SUITE_REGISTRATION(PublisherFlush::PublisherFlushTests)
cdrMemoryStream get_m_put_data(void)
InPortCorbaCdrConsumerMock(void)
virtual bool isActive()
If publisher is active state.
virtual ~InPortCorbaCdrConsumerMock()
prop
Organization::get_organization_property ();.
Class represents a set of properties.
InPortCorbaCdrConsumer class.
virtual void setUp()
Test initialization.
virtual ReturnCode activate()
activation
DataListener(const char *name)
PublisherFlushTests()
Constructor.
~PublisherFlushTests()
Destructor.
BufferBase abstract class.
::OpenRTM::CdrData m_put_data
RTC::ConnectorListeners m_listeners
virtual ReturnCode put(const cdrMemoryStream &data)
Send data to the destination port.