-
Notifications
You must be signed in to change notification settings - Fork 2
/
TestResultData.prg
120 lines (75 loc) · 3.19 KB
/
TestResultData.prg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//-- copyright
// hbunit is a unit-testing framework for the Harbour language.
//
// Copyright (C) 2014 Enderson maia <endersonmaia _at_ gmail _dot_ com>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// See COPYRIGHT for more details.
//++
#include "hbunit.ch"
//---------------------------------------------------------------------------//
CLASS TestResultData
CLASSDATA aErrors
CLASSDATA aAsserts
CLASSDATA aFailures
CLASSDATA nTestCases
CLASSDATA nAssertCount
METHOD new() CONSTRUCTOR
METHOD countErrors()
METHOD countFailures()
METHOD addError( oError )
METHOD addFailure( oFailure )
METHOD addAssert( oFailure )
METHOD incrementAssertCount()
METHOD addTestCaseCount( nCount )
METHOD getErrors()
METHOD getFailures()
METHOD getTestCasesCount()
METHOD getAssertCount()
ENDCLASS
//---------------------------------------------------------------------------//
METHOD new() CLASS TestResultData
iif( ::aErrors == nil, ::aErrors := {}, )
iif( ::aFailures == nil, ::aFailures := {}, )
iif( ::aAsserts == nil, ::aAsserts := {}, )
iif( ::nTestCases == nil, ::nTestCases := 0, )
iif( ::nAssertCount == nil, ::nAssertCount := 0, )
RETURN ( SELF )
//---------------------------------------------------------------------------//
METHOD countErrors() CLASS TestResultData
RETURN ( len( ::aErrors ) )
//---------------------------------------------------------------------------//
METHOD countFailures() CLASS TestResultData
RETURN ( len( ::aFailures ) )
//---------------------------------------------------------------------------//
METHOD addError( oError ) CLASS TestResultData
RETURN ( aadd( ::aErrors, oError ) )
//---------------------------------------------------------------------------//
METHOD addFailure( oFailure ) CLASS TestResultData
RETURN ( aadd( ::aFailures, oFailure ) )
//---------------------------------------------------------------------------//
METHOD addAssert( cAssert ) CLASS TestResultData
RETURN ( aadd( ::aAsserts, cAssert ) )
//---------------------------------------------------------------------------//
METHOD incrementAssertCount() CLASS TestResultData
RETURN ( ::nAssertCount++ )
//---------------------------------------------------------------------------//
METHOD addTestCaseCount( nCount ) CLASS TestResultData
RETURN ( ::nTestCases += nCount )
//---------------------------------------------------------------------------//
METHOD getErrors() CLASS TestResultData
RETURN ( ::aErrors )
//---------------------------------------------------------------------------//
METHOD getFailures() CLASS TestResultData
RETURN ( ::aFailures )
//---------------------------------------------------------------------------//
METHOD getTestCasesCount() CLASS TestResultData
RETURN ( ::nTestCases )
//---------------------------------------------------------------------------//
METHOD getAssertCount() CLASS TestResultData
RETURN ( ::nAssertCount )
//---------------------------------------------------------------------------//