Removed the commented leftovers from the changes.
[amule.git] / unittests / muleunit / testcase.h
blobe18e0fcf3c4911c2ec25df4bc6fd2a1571dc7e73
1 //
2 // MuleUnit: A minimalistic C++ Unit testing framework based on EasyUnit.
3 //
4 // Copyright (c) 2005-2011 aMule Team ( admin@amule.org / http://www.amule.org )
5 // Copyright (c) 2004-2011 Barthelemy Dagenais ( barthelemy@prologique.com )
6 //
7 // This library is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU Lesser General Public
9 // License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // Lesser General Public License for more details.
17 // You should have received a copy of the GNU Lesser General Public
18 // License along with this library; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #ifndef TESTCASE_H
24 #define TESTCASE_H
27 #include <wx/string.h>
28 #include <list>
31 namespace muleunit
34 class Test;
36 typedef std::list<Test*> TestList;
39 /**
40 * A TestCase is a collection of unit tests (instance of Test) and is
41 * always specified by the first parameter of a Test declaration.
43 class TestCase
45 public:
47 /**
48 * Main TestCase constructor.
50 * @param name TestCase name
52 TestCase(const wxString& name);
54 virtual ~TestCase();
56 /**
57 * Add a Test to the Test list. This method is used by TestRegistry.
59 * @param test Test instance to add to the Test list.
61 void addTest(Test *test);
63 /**
64 * Get the Test list.
66 * @return Test list
68 const TestList& getTests() const;
70 /**
71 * Execute all Tests in the Test list of this TestCase, returning false if there were failures.
73 bool run();
75 /**
76 * Get the Test list size (number of Tests in this TestCase).
78 * @return The Test list size
80 int getTestsCount() const;
82 /**
83 * Get the total number of failures reported by all Tests.
85 * @return The total number of failures reported by all Tests. 0
86 * if no test were run or if no failures were reported.
88 int getFailuresCount() const;
90 /**
91 * Get the total number of successes reported by all Tests.
93 * @return The total number of successes reported by all Tests. 0
94 * if no test were run or if no successes were reported.
96 int getSuccessesCount() const;
98 /**
99 * Get the TestCase name. This name is specified by the first parameter
100 * of the Test declaration. For example, if a test was declared as
101 * TEST(TESTCASE1, TEST1), the TestCase name would be "TESTCASE1".
103 * @return The name of the TestCase
105 const wxString& getName() const;
107 protected:
108 int m_failuresCount;
109 int m_successesCount;
110 TestList m_tests;
111 wxString m_name;
113 private:
114 void runTests(Test *test);
117 } // MuleUnit ns
118 #endif // TESTCASE_H