SdoServiceTests.cpp
Go to the documentation of this file.
1 // -*- C++ -*-
13 /*
14  * $Log: SdoServiceTests.cpp,v $
15  * Revision 1.1 2007/12/20 07:50:16 arafune
16  * *** empty log message ***
17  *
18  * Revision 1.1 2006/11/27 08:38:37 n-ando
19  * TestSuites are devided into each directory.
20  *
21  *
22  */
23 
24 #ifndef SdoService_cpp
25 #define SdoService_cpp
26 
27 #include <cppunit/ui/text/TestRunner.h>
28 #include <cppunit/TextOutputter.h>
29 #include <cppunit/extensions/TestFactoryRegistry.h>
30 #include <cppunit/extensions/HelperMacros.h>
31 #include <cppunit/TestAssert.h>
32 
33 //#include <rtm/SdoService.h>
34 
39 namespace SdoService
40 {
41  // using namespace SDOPackage;
42  using namespace std;
43 
45  : public CppUnit::TestFixture
46  {
47  CPPUNIT_TEST_SUITE(SdoServiceTests);
48  CPPUNIT_TEST(test_getProfile);
49  CPPUNIT_TEST(test_set_getName);
50  CPPUNIT_TEST(test_set_getInterfaceType);
51  CPPUNIT_TEST(test_set_getIdlDefinition);
52  CPPUNIT_TEST(test_set_getProperties);
53  CPPUNIT_TEST(test_set_getServiceRef);
54  CPPUNIT_TEST_SUITE_END();
55 
56  private:
57  // SDOServiceProfile* m_pSSP;
58  public:
59 
64  {
65  }
66 
71  {
72  }
73 
77  virtual void setUp()
78  {
79  // m_pSSP = new SDOServiceProfile();
80  }
81 
85  virtual void tearDown()
86  {
87  // delete m_pSSP;
88  }
89  /* tests for */
90  void test_getProfile() {
91  }
92 
93  /* tests for */
95  }
96 
97  /* tests for */
99  }
100 
101  /* tests for */
103  }
104 
105  /* tests for */
107  }
108 
109  /* tests for */
111  }
112  };
113 }; // namespace SdoService
114 
115 /*
116  * Register test suite
117  */
119 
120 #ifdef LOCAL_MAIN
121 int main(int argc, char* argv[])
122 {
123 
124  FORMAT format = TEXT_OUT;
125  int target = 0;
126  std::string xsl;
127  std::string ns;
128  std::string fname;
129  std::ofstream ofs;
130 
131  int i(1);
132  while (i < argc)
133  {
134  std::string arg(argv[i]);
135  std::string next_arg;
136  if (i + 1 < argc) next_arg = argv[i + 1];
137  else next_arg = "";
138 
139  if (arg == "--text") { format = TEXT_OUT; break; }
140  if (arg == "--xml")
141  {
142  if (next_arg == "")
143  {
144  fname = argv[0];
145  fname += ".xml";
146  }
147  else
148  {
149  fname = next_arg;
150  }
151  format = XML_OUT;
152  ofs.open(fname.c_str());
153  }
154  if ( arg == "--compiler" ) { format = COMPILER_OUT; break; }
155  if ( arg == "--cerr" ) { target = 1; break; }
156  if ( arg == "--xsl" )
157  {
158  if (next_arg == "") xsl = "default.xsl";
159  else xsl = next_arg;
160  }
161  if ( arg == "--namespace" )
162  {
163  if (next_arg == "")
164  {
165  std::cerr << "no namespace specified" << std::endl;
166  exit(1);
167  }
168  else
169  {
170  xsl = next_arg;
171  }
172  }
173  ++i;
174  }
175  CppUnit::TextUi::TestRunner runner;
176  if ( ns.empty() )
177  runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
178  else
179  runner.addTest(CppUnit::TestFactoryRegistry::getRegistry(ns).makeTest());
180  CppUnit::Outputter* outputter = 0;
181  std::ostream* stream = target ? &std::cerr : &std::cout;
182  switch ( format )
183  {
184  case TEXT_OUT :
185  outputter = new CppUnit::TextOutputter(&runner.result(),*stream);
186  break;
187  case XML_OUT :
188  std::cout << "XML_OUT" << std::endl;
189  outputter = new CppUnit::XmlOutputter(&runner.result(),
190  ofs, "shift_jis");
191  static_cast<CppUnit::XmlOutputter*>(outputter)->setStyleSheet(xsl);
192  break;
193  case COMPILER_OUT :
194  outputter = new CppUnit::CompilerOutputter(&runner.result(),*stream);
195  break;
196  }
197  runner.setOutputter(outputter);
198  runner.run();
199  return 0; // runner.run() ? 0 : 1;
200 }
201 #endif // MAIN
202 #endif // SdoService_cpp
int main(int argc, char **argv)
virtual void tearDown()
Test finalization.
virtual void setUp()
Test initialization.
CPPUNIT_TEST_SUITE_REGISTRATION(SdoService::SdoServiceTests)


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Mon Jun 10 2019 14:07:56