test-runner.cpp
Go to the documentation of this file.
1 // Copyright (C) 2007 Klaas Gadeyne
2 
3 /* Modified from orocos cppunit test code
4  begin : Mon January 10 2005
5  copyright : (C) 2005 Peter Soetens
6  email : peter.soetens@mech.kuleuven.ac.be
7 */
8 
9 #include <cppunit/XmlOutputter.h>
10 #include <cppunit/extensions/TestFactoryRegistry.h>
11 #include <cppunit/ui/text/TestRunner.h>
12 #include <iostream>
13 #include <fstream>
14 
15 int main(int argc, char** argv)
16 {
17  // Get the top level suite from the registry
18  CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
19 
20  // Adds the test to the list of test to run
21  CppUnit::TextUi::TestRunner runner;
22  runner.addTest( suite );
23 #ifndef TESTNAME
24  std::ofstream outputFile(std::string(suite->getName()+"-result.xml").c_str());
25 #else
26  std::ofstream outputFile((std::string(TESTNAME)+std::string("-result.xml")).c_str());
27 #endif
28  // Change the default outputter to a compiler error format outputter
29  runner.setOutputter( new CppUnit::XmlOutputter( &runner.result(),outputFile ) );
30 
31  // Run the tests.
32  bool wasSucessful = runner.run();
33 
34  outputFile.close();
35  // Return error code 1 if the one of test failed.
36  return wasSucessful ? 0 : 1;
37 }
int main(int argc, char **argv)
Definition: test-runner.cpp:15


orocos_kdl
Author(s):
autogenerated on Thu Apr 13 2023 02:19:14