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> 50 int main(
int argc,
char* argv[])
63 std::string arg(argv[i]);
65 if (i + 1 < argc) next_arg = argv[i + 1];
68 if (arg ==
"--text") { format =
TEXT_OUT;
break; }
81 ofs.open(fname.c_str());
83 if ( arg ==
"--compiler" ) { format =
COMPILER_OUT;
break; }
84 if ( arg ==
"--cerr" ) { target = 1;
break; }
87 if (next_arg ==
"") xsl =
"default.xsl";
90 if ( arg ==
"--namespace" )
94 std::cerr <<
"no namespace specified" << std::endl;
104 CppUnit::TextUi::TestRunner runner;
106 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
108 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry(ns).makeTest());
109 CppUnit::Outputter* outputter = 0;
110 std::ostream* stream = target ? &std::cerr : &std::cout;
114 outputter =
new CppUnit::TextOutputter(&runner.result(),*stream);
117 std::cout <<
"XML_OUT" << std::endl;
118 outputter =
new CppUnit::XmlOutputter(&runner.result(),
120 static_cast<CppUnit::XmlOutputter*
>(outputter)->setStyleSheet(xsl);
123 outputter =
new CppUnit::CompilerOutputter(&runner.result(),*stream);
126 runner.setOutputter(outputter);
127 return runner.run() ? 0 : 1;
int main(int argc, char *argv[])