Debian Codegraph @

Source/Test/CReasonerTestfileTestResult.cpp

raw
1 /*
2 * Copyright (C) 2013-2015, 2019 by the Konclude Developer Team.
3 *
4 * This file is part of the reasoning system Konclude.
5 * For details and support, see <http://konclude.com/>.
6 *
7 * Konclude is free software: you can redistribute it and/or modify
8 * it under the terms of version 3 of the GNU Lesser General Public
9 * License (LGPLv3) as published by the Free Software Foundation.
10 *
11 * Konclude is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU (Lesser) General Public License for more details.
15 *
16 * You should have received a copy of the GNU (Lesser) General Public
17 * License along with Konclude. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21 #include "CReasonerTestfileTestResult.h"
22
23
24 namespace Konclude {
25
26 namespace Test {
27
28
29
30 CReasonerTestfileTestResult::CReasonerTestfileTestResult() {
31 avgResponseTime = 0;
32 corrRespCount = 0;
33 totTestCount = 0;
34 crashCount = 0;
35 timeoutCount = 0;
36 wrongRespCount = 0;
37 failedCount = 0;
38 errorCount = 0;
39 }
40
41
42 CReasonerTestfileTestResult::~CReasonerTestfileTestResult() {
43 }
44
45 double CReasonerTestfileTestResult::getAverageCorrectResponseTime() {
46 return avgResponseTime;
47 }
48
49 qint64 CReasonerTestfileTestResult::getCorrectResponseCount() {
50 return corrRespCount;
51 }
52
53 qint64 CReasonerTestfileTestResult::getWrongResponseCount() {
54 return wrongRespCount;
55 }
56
57 qint64 CReasonerTestfileTestResult::getFailedCount() {
58 return failedCount;
59 }
60
61 qint64 CReasonerTestfileTestResult::getCrashCount() {
62 return crashCount;
63 }
64
65 qint64 CReasonerTestfileTestResult::getErrorCount() {
66 return errorCount;
67 }
68
69 qint64 CReasonerTestfileTestResult::getTimeoutCount() {
70 return timeoutCount;
71 }
72
73 qint64 CReasonerTestfileTestResult::getTotalTestCount() {
74 return totTestCount;
75 }
76
77
78 CReasonerTestfileTestResult *CReasonerTestfileTestResult::addFailedResult() {
79 totTestCount++;
80 failedCount++;
81 return this;
82 }
83
84
85 CReasonerTestfileTestResult *CReasonerTestfileTestResult::addTestResult(bool crashed, bool timeout, bool error, bool correctResponse, double responseTime) {
86 totTestCount++;
87 if (crashed) {
88 crashCount++;
89 if (timeout) {
90 timeoutCount++;
91 }
92 } else if (timeout) {
93 timeoutCount++;
94 } else if (error) {
95 errorCount++;
96 } else {
97 if (correctResponse) {
98 corrRespCount++;
99 avgResponseTime = avgResponseTime + (1./corrRespCount) * (responseTime - avgResponseTime);
100 }
101 }
102 return this;
103 }
104
105
106
107
108 }; // end namespace Test
109
110 }; // end namespace Konclude