test-runner.cpp
Go to the documentation of this file.
1 // Copyright (C) 2007 Klaas Gadeyne <first dot last at gmail dot com>
2 //
3 // This program is free software; you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation; either version 2 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 //
17 
18 /* Modified from orocos cppunit test code, also published under GPLV2
19  begin : Mon January 10 2005
20  copyright : (C) 2005 Peter Soetens
21  email : peter.soetens@mech.kuleuven.ac.be
22 */
23 
24 #include <cppunit/XmlOutputter.h>
25 #include <cppunit/extensions/TestFactoryRegistry.h>
26 #include <cppunit/ui/text/TestRunner.h>
27 #include <iostream>
28 #include <fstream>
29 
30 int main(int argc, char** argv)
31 {
32  // Get the top level suite from the registry
33  CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
34 
35  // Adds the test to the list of test to run
36  CppUnit::TextUi::TestRunner runner;
37  runner.addTest( suite );
38 #ifndef TESTNAME
39  std::ofstream outputFile(std::string(suite->getName()+"-result.xml").c_str());
40 #else
41  std::ofstream outputFile((std::string(TESTNAME)+std::string("-result.xml")).c_str());
42 #endif
43  // Change the default outputter to a compiler error format outputter
44  runner.setOutputter( new CppUnit::XmlOutputter( &runner.result(),outputFile ) );
45 
46  // Run the tests.
47  bool wasSucessful = runner.run();
48 
49  outputFile.close();
50  // Return error code 1 if the one of test failed.
51  return wasSucessful ? 0 : 1;
52 }
int main(int argc, char **argv)
Definition: test-runner.cpp:30


orocos_kdl
Author(s):
autogenerated on Sat Jun 15 2019 19:07:36