16 #ifndef CORBA_IORUtil_cpp 17 #define CORBA_IORUtil_cpp 21 #include <cppunit/ui/text/TestRunner.h> 22 #include <cppunit/TextOutputter.h> 23 #include <cppunit/extensions/TestFactoryRegistry.h> 24 #include <cppunit/extensions/HelperMacros.h> 25 #include <cppunit/TestAssert.h> 39 :
public CppUnit::TestFixture
86 std::string str_ior(
"IOR:010000001400000049444c3a52544d2f4d616e616765723a312e300001000000000000006000000001010200100000003139322e3136382e3130302e323430007acf0000070000006d616e61676572000200000000000000080000000100000000545441010000001c00000001000000010001000100000001000105090101000100000009010100");
90 std::string str_ior_ret;
94 CPPUNIT_ASSERT( !bret );
98 CPPUNIT_ASSERT( !bret );
102 CPPUNIT_ASSERT( !bret );
106 CPPUNIT_ASSERT( bret );
110 CPPUNIT_ASSERT( bret );
111 CPPUNIT_ASSERT_EQUAL(str_ior, str_ior2);
115 CPPUNIT_ASSERT( bret );
119 CPPUNIT_ASSERT( str_ior_ret.size() > 0 );
131 int main(
int argc,
char* argv[])
144 std::string arg(argv[i]);
145 std::string next_arg;
146 if (i + 1 < argc) next_arg = argv[i + 1];
149 if (arg ==
"--text") { format =
TEXT_OUT;
break; }
162 ofs.open(fname.c_str());
164 if ( arg ==
"--compiler" ) { format =
COMPILER_OUT;
break; }
165 if ( arg ==
"--cerr" ) { target = 1;
break; }
166 if ( arg ==
"--xsl" )
168 if (next_arg ==
"") xsl =
"default.xsl";
171 if ( arg ==
"--namespace" )
175 std::cerr <<
"no namespace specified" << std::endl;
185 CppUnit::TextUi::TestRunner runner;
187 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
189 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry(ns).makeTest());
190 CppUnit::Outputter* outputter = 0;
191 std::ostream* stream = target ? &std::cerr : &std::cout;
195 outputter =
new CppUnit::TextOutputter(&runner.result(),*stream);
198 std::cout <<
"XML_OUT" << std::endl;
199 outputter =
new CppUnit::XmlOutputter(&runner.result(),
201 static_cast<CppUnit::XmlOutputter*
>(outputter)->setStyleSheet(xsl);
204 outputter =
new CppUnit::CompilerOutputter(&runner.result(),*stream);
207 runner.setOutputter(outputter);
212 #endif // CORBA_IORUtil_cpp int main(int argc, char **argv)
virtual void setUp()
Test initialization.
bool toString(IOP::IOR &ior, std::string &iorstr)
Convert from IOR structure to IOR string.
bool replaceEndpoint(std::string &iorstr, const std::string &endpoint)
Replace endpoint address in IOR entry.
CORBA_IORUtilTests()
Constructor.
std::string formatIORinfo(const char *iorstr)
Extracts information from IOR string and returns formatted string.
CPPUNIT_TEST_SUITE(CORBA_IORUtilTests)
virtual void tearDown()
Test finalization.
void test_case0()
toIOR(), toString(), replaceEndpoint(), formatIORinfo() メソッドテスト
bool toIOR(const char *iorstr, IOP::IOR &ior)
Convert from IOR string to IOR structure.
~CORBA_IORUtilTests()
Destructor.
CORBA IOR manipulation utility functions.
CPPUNIT_TEST_SUITE_REGISTRATION(CORBA_IORUtil::CORBA_IORUtilTests)