testsuite.cc
Go to the documentation of this file.
1 // cwchessboard -- A C++ chessboard tool set for gtkmm
2 //
3 //! @file testsuite.cc A testsuite for the %cwchess classes.
4 //
5 // Copyright (C) 2008, by
6 //
7 // Carlo Wood, Run on IRC <carlo@alinoe.com>
8 // RSA-1024 0x624ACAD5 1997-01-26 Sign & Encrypt
9 // Fingerprint16 = 32 EC A7 B6 AC DB 65 A6 F6 F6 55 DD 1C DC FF 61
10 //
11 // This program is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 2 of the License, or
14 // (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 
24 #include "sys.h"
25 #include <cppunit/CompilerOutputter.h>
26 #include <cppunit/extensions/TestFactoryRegistry.h>
27 #include <cppunit/ui/text/TestRunner.h>
28 #include "debug.h"
29 
30 #define TESTSUITE_IMPLEMENTATION
31 #include "ColorTest.h"
32 #include "TypeTest.h"
33 #include "CodeTest.h"
34 #include "IndexTest.h"
35 #include "FlagsTest.h"
36 #include "BitBoardTest.h"
37 #include "PieceTest.h"
38 #include "ChessPositionTest.h"
39 
40 int main()
41 {
42  Debug(NAMESPACE_DEBUG::init());
43 
44  // Get the top level suite from the registry
45  CppUnit::Test* suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
46 
47  // Adds the test to the list of test to run
48  CppUnit::TextUi::TestRunner runner;
49  runner.addTest(suite);
50 
51  // Change the default outputter to a compiler error format outputter
52  runner.setOutputter(new CppUnit::CompilerOutputter(&runner.result(), std::cerr));
53  // Run the tests.
54  bool wasSucessful = runner.run();
55 
56  // Return error code 1 if the one of test failed.
57  return wasSucessful ? 0 : 1;
58 }

Copyright © 2006 - 2010 Carlo Wood.  All rights reserved.