test-runner.cpp
Go to the documentation of this file.
00001 // Copyright (C) 2007 Klaas Gadeyne <first dot last at gmail dot com>
00002 //
00003 // This program is free software; you can redistribute it and/or modify
00004 // it under the terms of the GNU General Public License as published by
00005 // the Free Software Foundation; either version 2 of the License, or
00006 // (at your option) any later version.
00007 //
00008 // This program is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 // GNU General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU General Public License
00014 // along with this program; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00016 //
00017 
00018 /* Modified from orocos cppunit test code, also published under GPLV2
00019     begin                : Mon January 10 2005
00020     copyright            : (C) 2005 Peter Soetens
00021     email                : peter.soetens@mech.kuleuven.ac.be
00022 */
00023 
00024 #include <cppunit/XmlOutputter.h>
00025 #include <cppunit/extensions/TestFactoryRegistry.h>
00026 #include <cppunit/ui/text/TestRunner.h>
00027 #include <iostream>
00028 #include <fstream>
00029 
00030 int main(int argc, char** argv)
00031 {
00032     // Get the top level suite from the registry
00033     CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
00034 
00035     // Adds the test to the list of test to run
00036     CppUnit::TextUi::TestRunner runner;
00037     runner.addTest( suite );
00038 #ifndef TESTNAME
00039     std::ofstream outputFile(std::string(suite->getName()+"-result.xml").c_str());
00040 #else
00041     std::ofstream outputFile((std::string(TESTNAME)+std::string("-result.xml")).c_str());
00042 #endif
00043     // Change the default outputter to a compiler error format outputter
00044     runner.setOutputter( new CppUnit::XmlOutputter( &runner.result(),outputFile ) );
00045     
00046     // Run the tests.
00047     bool wasSucessful = runner.run();
00048 
00049     outputFile.close();
00050     // Return error code 1 if the one of test failed.
00051     return wasSucessful ? 0 : 1;
00052 }


orocos_kdl
Author(s):
autogenerated on Sat Oct 7 2017 03:04:28