1 : // $Id: TestRunner.cc 35 2007-04-27 11:26:33Z tb $
2 :
3 : /*
4 : * STX B+ Tree Template Classes v0.7
5 : * Copyright (C) 2007 Timo Bingmann
6 : *
7 : * This library is free software; you can redistribute it and/or modify it
8 : * under the terms of the GNU Lesser General Public License as published by the
9 : * Free Software Foundation; either version 2.1 of the License, or (at your
10 : * option) any later version.
11 : *
12 : * This library is distributed in the hope that it will be useful, but WITHOUT
13 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 : * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15 : * for more details.
16 : *
17 : * You should have received a copy of the GNU Lesser General Public License
18 : * along with this library; if not, write to the Free Software Foundation,
19 : * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 : */
21 :
22 : #include <cppunit/TextTestRunner.h>
23 : #include <cppunit/TextOutputter.h>
24 : #include <cppunit/TextTestProgressListener.h>
25 : #include <cppunit/BriefTestProgressListener.h>
26 :
27 : #include <cppunit/extensions/TestFactoryRegistry.h>
28 :
29 : #include <cppunit/TestResult.h>
30 :
31 1 : int main()
32 : {
33 : // Get the top level suite from the registry
34 1 : CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
35 :
36 : // Adds the test to the list of test to run
37 1 : CppUnit::TextTestRunner runner;
38 1 : runner.addTest( suite );
39 :
40 : // add brief output before running each test
41 1 : CppUnit::BriefTestProgressListener briefoutputlistener;
42 1 : runner.eventManager().addListener(&briefoutputlistener);
43 :
44 : // Change the default outputter to a compiler error format outputter
45 1 : runner.setOutputter( new CppUnit::TextOutputter( &runner.result(), std::cout ) );
46 :
47 : // Run the tests.
48 1 : bool wasSucessful = runner.run();
49 :
50 : // Return error code 1 if the one of test failed.
51 2 : return wasSucessful ? 0 : 1;
52 2 : }
|