00001 /****************************************************************************************************************/ 00002 /* */ 00003 /* Flood: An Open Source Neural Networks C++ Library */ 00004 /* www.cimne.com/flood */ 00005 /* */ 00006 /* U N I T T E S T I N G C L A S S H E A D E R */ 00007 /* */ 00008 /* Roberto Lopez */ 00009 /* International Center for Numerical Methods in Engineering (CIMNE) */ 00010 /* Technical University of Catalonia (UPC) */ 00011 /* Barcelona, Spain */ 00012 /* E-mail: rlopez@cimne.upc.edu */ 00013 /* */ 00014 /****************************************************************************************************************/ 00015 00016 #ifndef __UNITTESTING_H__ 00017 #define __UNITTESTING_H__ 00018 00019 // Flood includes 00020 00021 #include "Vector.h" 00022 #include "Matrix.h" 00023 00024 namespace Flood 00025 { 00026 00028 00029 class UnitTesting 00030 { 00031 00032 public: 00033 00034 // DEFAULT CONSTRUCTOR 00035 00036 explicit UnitTesting(void); 00037 00038 // DESTRUCTOR 00039 00040 virtual ~UnitTesting(void); 00041 00042 // METHODS 00043 00044 // Get methods 00045 00046 int get_tests_count(void); 00047 int get_tests_passed_count(void); 00048 int get_tests_failed_count(void); 00049 00050 std::string& get_message(void); 00051 00052 bool get_display(void); 00053 00054 // Set methods 00055 00056 void set_tests_count(int); 00057 void set_tests_passed_count(int); 00058 void set_tests_failed_count(int); 00059 00060 void set_message(const std::string&); 00061 00062 void set_display(bool); 00063 00064 // Unit testing methods 00065 00066 void assert_true(bool, const std::string&); 00067 void assert_false(bool, const std::string&); 00068 00069 // Test case methods 00070 00072 00073 virtual void run_test_case(void) = 0; 00074 00075 void print_results(void); 00076 00077 protected: 00078 00080 00081 int tests_count; 00082 00084 00085 int tests_passed_count; 00086 00088 00089 int tests_failed_count; 00090 00092 00093 std::string message; 00094 00096 00097 bool display; 00098 }; 00099 00100 } 00101 00102 #endif 00103 00104 // Flood: An Open Source Neural Networks C++ Library. 00105 // Copyright (C) 2005-2010 Roberto Lopez 00106 // 00107 // This library is free software; you can redistribute it and/or 00108 // modify it under the s of the GNU Lesser General Public 00109 // License as published by the Free Software Foundation; either 00110 // version 2.1 of the License, or any later version. 00111 // 00112 // This library is distributed in the hope that it will be useful, 00113 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00114 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00115 // Lesser General Public License for more details. 00116 00117 // You should have received a copy of the GNU Lesser General Public 00118 // License along with this library; if not, write to the Free Software 00119 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA