SdoServiceTests.cpp
Go to the documentation of this file.
00001 // -*- C++ -*-
00013 /*
00014  * $Log: SdoServiceTests.cpp,v $
00015  * Revision 1.1  2007/12/20 07:50:16  arafune
00016  * *** empty log message ***
00017  *
00018  * Revision 1.1  2006/11/27 08:38:37  n-ando
00019  * TestSuites are devided into each directory.
00020  *
00021  *
00022  */
00023 
00024 #ifndef SdoService_cpp
00025 #define SdoService_cpp
00026 
00027 #include <cppunit/ui/text/TestRunner.h>
00028 #include <cppunit/TextOutputter.h>
00029 #include <cppunit/extensions/TestFactoryRegistry.h>
00030 #include <cppunit/extensions/HelperMacros.h>
00031 #include <cppunit/TestAssert.h>
00032 
00033 //#include <rtm/SdoService.h>
00034 
00039 namespace SdoService
00040 {
00041   //  using namespace SDOPackage;
00042   using namespace std;
00043 
00044   class SdoServiceTests
00045    : public CppUnit::TestFixture
00046   {
00047     CPPUNIT_TEST_SUITE(SdoServiceTests);
00048     CPPUNIT_TEST(test_getProfile);
00049     CPPUNIT_TEST(test_set_getName);
00050     CPPUNIT_TEST(test_set_getInterfaceType);
00051     CPPUNIT_TEST(test_set_getIdlDefinition);
00052     CPPUNIT_TEST(test_set_getProperties);
00053     CPPUNIT_TEST(test_set_getServiceRef);
00054     CPPUNIT_TEST_SUITE_END();
00055   
00056   private:
00057     //    SDOServiceProfile* m_pSSP;
00058   public:
00059   
00063     SdoServiceTests()
00064     {
00065     }
00066     
00070     ~SdoServiceTests()
00071     {
00072     }
00073   
00077     virtual void setUp()
00078     {
00079       //      m_pSSP = new SDOServiceProfile();
00080     }
00081     
00085     virtual void tearDown()
00086     {
00087       //      delete m_pSSP; 
00088     }
00089     /* tests for */
00090     void test_getProfile() {
00091     }
00092     
00093     /* tests for */
00094     void test_set_getName() {
00095     }
00096     
00097     /* tests for */
00098     void test_set_getInterfaceType() {
00099     }
00100     
00101     /* tests for */
00102     void test_set_getIdlDefinition() {
00103     }
00104     
00105     /* tests for */
00106     void test_set_getProperties() {
00107     }
00108     
00109     /* tests for */
00110     void test_set_getServiceRef() {
00111     }
00112   };
00113 }; // namespace SdoService
00114 
00115 /*
00116  * Register test suite
00117  */
00118 CPPUNIT_TEST_SUITE_REGISTRATION(SdoService::SdoServiceTests);
00119 
00120 #ifdef LOCAL_MAIN
00121 int main(int argc, char* argv[])
00122 {
00123 
00124   FORMAT format = TEXT_OUT;
00125   int target = 0;
00126   std::string xsl;
00127   std::string ns;
00128   std::string fname;
00129   std::ofstream ofs;
00130 
00131   int i(1);
00132   while (i < argc)
00133     {
00134       std::string arg(argv[i]);
00135       std::string next_arg;
00136       if (i + 1 < argc) next_arg = argv[i + 1];
00137       else              next_arg = "";
00138 
00139       if (arg == "--text") { format = TEXT_OUT; break; }
00140       if (arg == "--xml")
00141         {
00142           if (next_arg == "")
00143             {
00144               fname = argv[0];
00145               fname += ".xml";
00146             }
00147           else
00148             {
00149               fname = next_arg;
00150             }
00151           format = XML_OUT;
00152           ofs.open(fname.c_str());
00153         }
00154       if ( arg == "--compiler"  ) { format = COMPILER_OUT; break; }
00155       if ( arg == "--cerr"      ) { target = 1; break; }
00156       if ( arg == "--xsl"       )
00157         {
00158           if (next_arg == "") xsl = "default.xsl"; 
00159           else                xsl = next_arg;
00160         }
00161       if ( arg == "--namespace" )
00162         {
00163           if (next_arg == "")
00164             {
00165               std::cerr << "no namespace specified" << std::endl;
00166               exit(1); 
00167             }
00168           else
00169             {
00170               xsl = next_arg;
00171             }
00172         }
00173       ++i;
00174     }
00175   CppUnit::TextUi::TestRunner runner;
00176   if ( ns.empty() )
00177     runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
00178   else
00179     runner.addTest(CppUnit::TestFactoryRegistry::getRegistry(ns).makeTest());
00180   CppUnit::Outputter* outputter = 0;
00181   std::ostream* stream = target ? &std::cerr : &std::cout;
00182   switch ( format )
00183     {
00184     case TEXT_OUT :
00185       outputter = new CppUnit::TextOutputter(&runner.result(),*stream);
00186       break;
00187     case XML_OUT :
00188       std::cout << "XML_OUT" << std::endl;
00189       outputter = new CppUnit::XmlOutputter(&runner.result(),
00190                                             ofs, "shift_jis");
00191       static_cast<CppUnit::XmlOutputter*>(outputter)->setStyleSheet(xsl);
00192       break;
00193     case COMPILER_OUT :
00194       outputter = new CppUnit::CompilerOutputter(&runner.result(),*stream);
00195       break;
00196     }
00197   runner.setOutputter(outputter);
00198   runner.run();
00199   return 0; // runner.run() ? 0 : 1;
00200 }
00201 #endif // MAIN
00202 #endif // SdoService_cpp


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Sat Jun 8 2019 18:49:07