Merge remote-tracking branch 'upstream/edge' into upstream-master
[clinton/Smoothieware.git] / src / testframework / easyunit / testresult.h
1 /*
2 EasyUnit : Simple C++ Unit testing framework
3 Copyright (C) 2004 Barthelemy Dagenais
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 Barthelemy Dagenais
20 barthelemy@prologique.com
21 */
22
23 #ifndef testresult_H
24 #define testresult_H
25
26 #include "testcase.h"
27
28
29 class TestResult
30 {
31 public:
32 TestResult();
33 virtual ~TestResult();
34
35
36 /**
37 * Get the total number of successes registered by all
38 * test cases ran. This is the sum of all TestCase->getSuccessesCount().
39 *
40 *@return The number of successes registered by all testcases.
41 */
42 int getTotalSuccesses() const;
43
44 /**
45 * Get the total number of errors registered by all
46 * test cases ran. This is the sum of all TestCase->getErrorsCount().
47 *
48 *@return The number of errors registered by all testcases.
49 */
50 int getTotalErrors() const;
51
52 /**
53 * Get the total number of failures registered by all
54 * test cases ran. This is the sum of all TestCase->getFailuresCount().
55 *
56 * @return The number of failures registered by all testcases.
57 */
58 int getTotalFailures() const;
59
60 /**
61 * Get the number of testcases ran that succeeded.
62 *
63 * @return The number of testcases ran that succeeded.
64 */
65 int getSuccesses() const;
66
67 /**
68 * Get the number of testcases ran that failed.
69 *
70 * @return The number of testcases ran that failed.
71 */
72 int getFailures() const;
73
74 /**
75 * Get the number of testcases ran that reported an error.
76 *
77 * @return The number of testcases ran that reported an error.
78 */
79 int getErrors() const;
80
81 /**
82 * Get the number of testcases in the TestCase list.
83 *
84 * @return The size of the TestCase list
85 */
86 int getTestCaseCount() const;
87
88 /**
89 * Get the number of tests
90 *
91 * @return The number of tests ran that succeeded
92 */
93 int getTestRanCount() const;
94
95 /**
96 * Get the number of testcases ran.
97 *
98 * @return The number of testcases ran
99 */
100 int getTestCaseRanCount() const;
101
102 /**
103 * Get the TestCase list. This list contains all TestCase registered and
104 * not only those that were ran.
105 *
106 * @return The TestCase list
107 */
108 TestCase* getTestCases() const;
109
110 /**
111 * Set the TestCase list and the size of the list.
112 *
113 * @param testCases TestCase list
114 * @param testCaseCount size of the TestCase list
115 */
116 void setTestCases(TestCase *testCases, int testCaseCount);
117
118 /**
119 * Add a TestCase result. This is used by a TestCase after it has
120 * completed.
121 *
122 * @param testCase TestCase that ran and contains results to add to
123 * global results
124 */
125 virtual void addResult(TestCase *testCase);
126
127 protected:
128 int testCaseCount_{0};
129 int testRanCount_{0};
130 int testCaseRanCount_{0};
131
132 int totalSuccesses_{0};
133 int totalErrors_{0};
134 int totalFailures_{0};
135
136 int successes_{0};
137 int errors_{0};
138 int failures_{0};
139
140 TestCase* testCases_{0};
141
142 };
143
144
145 #endif // testresult_H
146