26 #include <cppunit/ui/text/TestRunner.h> 27 #include <cppunit/TextOutputter.h> 28 #include <cppunit/extensions/TestFactoryRegistry.h> 29 #include <cppunit/extensions/HelperMacros.h> 30 #include <cppunit/TestAssert.h> 33 #include <coil/Timer.h> 34 #include <coil/TimeValue.h> 45 :
public CppUnit::TestFixture
60 Listener(
const char* name =
"",
bool printMsg =
false)
124 time_t tmstart, tmend;
139 if(difftime(tmend,tmstart)>=10)
158 time_t tmstart, tmend;
174 if(difftime(tmend,tmstart)>=10)
195 if(difftime(tmend,tmstart)>=10)
217 time_t tmstart, tmend;
243 if(difftime(tmend,tmstart)>=10)
267 int main(
int argc,
char* argv[])
280 std::string arg(argv[i]);
281 std::string next_arg;
282 if (i + 1 < argc) next_arg = argv[i + 1];
285 if (arg ==
"--text") { format =
TEXT_OUT;
break; }
298 ofs.open(fname.c_str());
300 if ( arg ==
"--compiler" ) { format =
COMPILER_OUT;
break; }
301 if ( arg ==
"--cerr" ) { target = 1;
break; }
302 if ( arg ==
"--xsl" )
304 if (next_arg ==
"") xsl =
"default.xsl";
307 if ( arg ==
"--namespace" )
311 std::cerr <<
"no namespace specified" << std::endl;
321 CppUnit::TextUi::TestRunner runner;
323 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
325 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry(ns).makeTest());
326 CppUnit::Outputter* outputter = 0;
327 std::ostream* stream = target ? &std::cerr : &std::cout;
331 outputter =
new CppUnit::TextOutputter(&runner.result(),*stream);
334 std::cout <<
"XML_OUT" << std::endl;
335 outputter =
new CppUnit::XmlOutputter(&runner.result(),
337 static_cast<CppUnit::XmlOutputter*
>(outputter)->setStyleSheet(xsl);
340 outputter =
new CppUnit::CompilerOutputter(&runner.result(),*stream);
343 runner.setOutputter(outputter);
347 CppUnit::TextUi::TestRunner runner;
348 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
349 CppUnit::Outputter* outputter =
350 new CppUnit::TextOutputter(&runner.result(), std::cout);
351 runner.setOutputter(outputter);
CPPUNIT_TEST_SUITE(TimerTests)
int main(int argc, char **argv)
virtual void invoke()
Callback.
void test_activate_multi_timers_continuously()
複数のタイマーを時間的に直列に動笹正せE謄好
ListenerId registerListener(ListenerBase *listener, TimeValue tm)
Register listener.
void test_registerListener()
registerListener()メソッドのテスト
void test_activate_multi_timers_concurrently()
複数のタイマーを時間的に並列に動笹正せE謄好
void stop()
Stop Timer task.
CPPUNIT_TEST(test_registerListener)
void start()
Start Timer task.
std::string sprintf(char const *__restrict fmt,...)
Convert it into a format given with an argumen.
virtual void tearDown()
Test finalization.
Listener(const char *name="", bool printMsg=false)
virtual void setUp()
Test initialization.
CPPUNIT_TEST_SUITE_REGISTRATION(Timer::TimerTests)