00001 // cwchessboard -- A C++ chessboard tool set for gtkmm 00002 // 00003 //! @file testsuite.cc A testsuite for the %cwchess classes. 00004 // 00005 // Copyright (C) 2008, by 00006 // 00007 // Carlo Wood, Run on IRC <carlo@alinoe.com> 00008 // RSA-1024 0x624ACAD5 1997-01-26 Sign & Encrypt 00009 // Fingerprint16 = 32 EC A7 B6 AC DB 65 A6 F6 F6 55 DD 1C DC FF 61 00010 // 00011 // This program is free software: you can redistribute it and/or modify 00012 // it under the terms of the GNU General Public License as published by 00013 // the Free Software Foundation, either version 2 of the License, or 00014 // (at your option) any later version. 00015 // 00016 // This program is distributed in the hope that it will be useful, 00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 // GNU General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU General Public License 00022 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00023 00024 #include "sys.h" 00025 #include <cppunit/CompilerOutputter.h> 00026 #include <cppunit/extensions/TestFactoryRegistry.h> 00027 #include <cppunit/ui/text/TestRunner.h> 00028 #include "debug.h" 00029 00030 #define TESTSUITE_IMPLEMENTATION 00031 #include "ColorTest.h" 00032 #include "TypeTest.h" 00033 #include "CodeTest.h" 00034 #include "IndexTest.h" 00035 #include "FlagsTest.h" 00036 #include "BitBoardTest.h" 00037 #include "PieceTest.h" 00038 #include "ChessPositionTest.h" 00039 00040 int main() 00041 { 00042 Debug(debug::init()); 00043 00044 // Get the top level suite from the registry 00045 CppUnit::Test* suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); 00046 00047 // Adds the test to the list of test to run 00048 CppUnit::TextUi::TestRunner runner; 00049 runner.addTest(suite); 00050 00051 // Change the default outputter to a compiler error format outputter 00052 runner.setOutputter(new CppUnit::CompilerOutputter(&runner.result(), std::cerr)); 00053 // Run the tests. 00054 bool wasSucessful = runner.run(); 00055 00056 // Return error code 1 if the one of test failed. 00057 return wasSucessful ? 0 : 1; 00058 }