OTest2
A C++ testing framework
reporterstatistics.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Ondrej Starek
3  *
4  * This file is part of OTest2.
5  *
6  * OTest2 is free software: you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License,
9  * or (at your option) any later version.
10  *
11  * OTest2 is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14  * License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with OTest2. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef OTest2__INCLUDE_OTEST2_REPORTERSTATISTICS_H_
21 #define OTest2__INCLUDE_OTEST2_REPORTERSTATISTICS_H_
22 
23 namespace OTest2 {
24 
31  private:
32  int suites_ok;
33  int suites_failed;
34  int cases_ok;
35  int cases_failed;
36  int assertions_ok;
37  int assertions_failed;
38  int errors;
39 
40  public:
41  /* -- avoid copying */
43  const ReporterStatistics&) = delete;
45  const ReporterStatistics&) = delete;
46 
51 
56 
62  void reportSuite(
63  bool result_);
64 
70  void reportCase(
71  bool result_);
72 
78  void reportAssertion(
79  bool result_);
80 
84  void reportError();
85 
89  int getSuites() const;
90 
94  int getSuitesOK() const;
95 
99  int getSuitesFailed() const;
100 
104  int getCases() const;
105 
109  int getCasesOK() const;
110 
114  int getCasesFailed() const;
115 
119  int getAssertions() const;
120 
124  int getAssertionsOK() const;
125 
129  int getAssertionsFailed() const;
130 
134  int getErrors() const;
135 };
136 
137 } /* namespace OTest2 */
138 
139 #endif /* OTest2__INCLUDE_OTEST2_REPORTERSTATISTICS_H_ */
OTest2::ReporterStatistics::reportCase
void reportCase(bool result_)
Count new test case.
Definition: reporterstatistics.cpp:47
OTest2::ReporterStatistics::getAssertionsFailed
int getAssertionsFailed() const
Get count of failed assertions.
Definition: reporterstatistics.cpp:99
OTest2::ReporterStatistics::getCases
int getCases() const
Get count of test cases.
Definition: reporterstatistics.cpp:79
OTest2::ReporterStatistics::~ReporterStatistics
~ReporterStatistics()
Dtor.
Definition: reporterstatistics.cpp:35
OTest2::ReporterStatistics::getCasesFailed
int getCasesFailed() const
Get count of failed test cases.
Definition: reporterstatistics.cpp:87
OTest2::ReporterStatistics::reportError
void reportError()
Report a framework error.
Definition: reporterstatistics.cpp:63
OTest2::ReporterStatistics::reportAssertion
void reportAssertion(bool result_)
Count new assertion.
Definition: reporterstatistics.cpp:55
OTest2::ReporterStatistics::getCasesOK
int getCasesOK() const
Get count of passed test cases.
Definition: reporterstatistics.cpp:83
OTest2::ReporterStatistics::operator=
ReporterStatistics & operator=(const ReporterStatistics &)=delete
OTest2
Definition: assertbean.h:25
OTest2::ReporterStatistics::getSuitesFailed
int getSuitesFailed() const
Get count of failed suites.
Definition: reporterstatistics.cpp:75
OTest2::ReporterStatistics::getAssertionsOK
int getAssertionsOK() const
Get count of passed assertions.
Definition: reporterstatistics.cpp:95
OTest2::ReporterStatistics
A helper class keeping statistic counters.
Definition: reporterstatistics.h:30
OTest2::ReporterStatistics::ReporterStatistics
ReporterStatistics()
Ctor.
Definition: reporterstatistics.cpp:24
OTest2::ReporterStatistics::getErrors
int getErrors() const
Get count of the errors.
Definition: reporterstatistics.cpp:103
OTest2::ReporterStatistics::getAssertions
int getAssertions() const
Get count of assertions.
Definition: reporterstatistics.cpp:91
OTest2::ReporterStatistics::reportSuite
void reportSuite(bool result_)
Count new suite.
Definition: reporterstatistics.cpp:39
OTest2::ReporterStatistics::getSuitesOK
int getSuitesOK() const
Get count of passed suites.
Definition: reporterstatistics.cpp:71
OTest2::ReporterStatistics::getSuites
int getSuites() const
Get count of suites.
Definition: reporterstatistics.cpp:67