OTest2
A C++ testing framework
reporterstatistics.cpp
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 #include <reporterstatistics.h>
21 
22 namespace OTest2 {
23 
25  suites_ok(0),
26  suites_failed(0),
27  cases_ok(0),
28  cases_failed(0),
29  assertions_ok(0),
30  assertions_failed(0),
31  errors(0) {
32 
33 }
34 
36 
37 }
38 
40  bool result_) {
41  if(result_)
42  ++suites_ok;
43  else
44  ++suites_failed;
45 }
46 
48  bool result_) {
49  if(result_)
50  ++cases_ok;
51  else
52  ++cases_failed;
53 }
54 
56  bool result_) {
57  if(result_)
58  ++assertions_ok;
59  else
60  ++assertions_failed;
61 }
62 
64  ++errors;
65 }
66 
68  return suites_ok + suites_failed;
69 }
70 
72  return suites_ok;
73 }
74 
76  return suites_failed;
77 }
78 
80  return cases_ok + cases_failed;
81 }
82 
84  return cases_ok;
85 }
86 
88  return cases_failed;
89 }
90 
92  return assertions_ok + assertions_failed;
93 }
94 
96  return assertions_ok;
97 }
98 
100  return assertions_failed;
101 }
102 
104  return errors;
105 }
106 
107 } /* namespace OTest2 */
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
reporterstatistics.h
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::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