33 #include <cppunit/ui/text/TestRunner.h> 34 #include <cppunit/XmlOutputter.h> 35 #include <cppunit/TextOutputter.h> 36 #include <cppunit/CompilerOutputter.h> 37 #include <cppunit/extensions/TestFactoryRegistry.h> 46 int main(
int argc,
char* argv[])
59 std::string arg(argv[i]);
61 if (i + 1 < argc) next_arg = argv[i + 1];
64 if (arg ==
"--text") { format =
TEXT_OUT;
break; }
77 ofs.open(fname.c_str());
79 if ( arg ==
"--compiler" ) { format =
COMPILER_OUT;
break; }
80 if ( arg ==
"--cerr" ) { target = 1;
break; }
83 if (next_arg ==
"") xsl =
"default.xsl";
86 if ( arg ==
"--namespace" )
90 std::cerr <<
"no namespace specified" << std::endl;
100 CppUnit::TextUi::TestRunner runner;
102 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
104 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry(ns).makeTest());
105 CppUnit::Outputter* outputter = 0;
106 std::ostream* stream = target ? &std::cerr : &std::cout;
110 outputter =
new CppUnit::TextOutputter(&runner.result(),*stream);
113 std::cout <<
"XML_OUT" << std::endl;
114 outputter =
new CppUnit::XmlOutputter(&runner.result(),
116 static_cast<CppUnit::XmlOutputter*
>(outputter)->setStyleSheet(xsl);
119 outputter =
new CppUnit::CompilerOutputter(&runner.result(),*stream);
122 runner.setOutputter(outputter);
123 return runner.run() ? 0 : 1;
int main(int argc, char *argv[])