@@ -22,8 +22,8 @@ public string Format(CoverageResult result)
22
22
23
23
XmlElement modules = xml . CreateElement ( "Modules" ) ;
24
24
25
- int numSequencePoints = 0 , numClasses = 0 , numMethods = 0 ;
26
- int visitedSequencePoints = 0 , visitedClasses = 0 , visitedMethods = 0 ;
25
+ int numSequencePoints = 0 , numBranchPoints = 0 , numClasses = 0 , numMethods = 0 ;
26
+ int visitedSequencePoints = 0 , visitedBranchPoints = 0 , visitedClasses = 0 , visitedMethods = 0 ;
27
27
28
28
int i = 1 ;
29
29
@@ -87,7 +87,7 @@ public string Format(CoverageResult result)
87
87
fileRef . SetAttribute ( "uid" , i . ToString ( ) ) ;
88
88
89
89
XmlElement methodPoint = xml . CreateElement ( "MethodPoint" ) ;
90
- methodPoint . SetAttribute ( "vc" , meth . Value . Select ( l => l . Value ) . Sum ( ) . ToString ( ) ) ;
90
+ methodPoint . SetAttribute ( "vc" , meth . Value . Select ( l => l . Value . Hits ) . Sum ( ) . ToString ( ) ) ;
91
91
methodPoint . SetAttribute ( "upsid" , "0" ) ;
92
92
methodPoint . SetAttribute ( "type" , "xsi" , "SequencePoint" ) ;
93
93
methodPoint . SetAttribute ( "ordinal" , j . ToString ( ) ) ;
@@ -102,14 +102,16 @@ public string Format(CoverageResult result)
102
102
103
103
// They're really just lines
104
104
XmlElement sequencePoints = xml . CreateElement ( "SequencePoints" ) ;
105
+ XmlElement branchPoints = xml . CreateElement ( "BranchPoints" ) ;
105
106
XmlElement methodSummary = xml . CreateElement ( "Summary" ) ;
106
107
int k = 0 ;
108
+ int kBr = 0 ;
107
109
var methodVisited = false ;
108
110
109
111
foreach ( var lines in meth . Value )
110
112
{
111
113
XmlElement sequencePoint = xml . CreateElement ( "SequencePoint" ) ;
112
- sequencePoint . SetAttribute ( "vc" , lines . Value . ToString ( ) ) ;
114
+ sequencePoint . SetAttribute ( "vc" , lines . Value . Hits . ToString ( ) ) ;
113
115
sequencePoint . SetAttribute ( "upsid" , lines . Key . ToString ( ) ) ;
114
116
sequencePoint . SetAttribute ( "ordinal" , k . ToString ( ) ) ;
115
117
sequencePoint . SetAttribute ( "sl" , lines . Key . ToString ( ) ) ;
@@ -121,12 +123,27 @@ public string Format(CoverageResult result)
121
123
sequencePoint . SetAttribute ( "fileid" , i . ToString ( ) ) ;
122
124
sequencePoints . AppendChild ( sequencePoint ) ;
123
125
126
+ if ( lines . Value . IsBranchPoint )
127
+ {
128
+ XmlElement branchPoint = xml . CreateElement ( "BranchPoint" ) ;
129
+ branchPoint . SetAttribute ( "vc" , lines . Value . Hits . ToString ( ) ) ;
130
+ branchPoint . SetAttribute ( "upsid" , lines . Key . ToString ( ) ) ;
131
+ branchPoint . SetAttribute ( "ordinal" , kBr . ToString ( ) ) ;
132
+ branchPoint . SetAttribute ( "sl" , lines . Key . ToString ( ) ) ;
133
+ branchPoint . SetAttribute ( "fileid" , i . ToString ( ) ) ;
134
+ branchPoints . AppendChild ( branchPoint ) ;
135
+ kBr ++ ;
136
+ numBranchPoints ++ ;
137
+ }
138
+
124
139
numSequencePoints ++ ;
125
- if ( lines . Value > 0 )
140
+ if ( lines . Value . Hits > 0 )
126
141
{
127
142
visitedSequencePoints ++ ;
128
143
classVisited = true ;
129
144
methodVisited = true ;
145
+ if ( lines . Value . IsBranchPoint )
146
+ visitedBranchPoints ++ ;
130
147
}
131
148
132
149
k ++ ;
@@ -137,9 +154,9 @@ public string Format(CoverageResult result)
137
154
visitedMethods ++ ;
138
155
139
156
methodSummary . SetAttribute ( "numSequencePoints" , meth . Value . Count ( ) . ToString ( ) ) ;
140
- methodSummary . SetAttribute ( "visitedSequencePoints" , meth . Value . Where ( l => l . Value > 0 ) . Count ( ) . ToString ( ) ) ;
141
- methodSummary . SetAttribute ( "numBranchPoints" , "0" ) ;
142
- methodSummary . SetAttribute ( "visitedBranchPoints" , "0" ) ;
157
+ methodSummary . SetAttribute ( "visitedSequencePoints" , meth . Value . Where ( l => l . Value . Hits > 0 ) . Count ( ) . ToString ( ) ) ;
158
+ methodSummary . SetAttribute ( "numBranchPoints" , meth . Value . Where ( l => l . Value . IsBranchPoint ) . Count ( ) . ToString ( ) ) ;
159
+ methodSummary . SetAttribute ( "visitedBranchPoints" , meth . Value . Where ( l => l . Value . IsBranchPoint && l . Value . Hits > 0 ) . Count ( ) . ToString ( ) ) ;
143
160
methodSummary . SetAttribute ( "sequenceCoverage" , "0" ) ;
144
161
methodSummary . SetAttribute ( "branchCoverage" , "0" ) ;
145
162
methodSummary . SetAttribute ( "maxCyclomaticComplexity" , "0" ) ;
@@ -154,7 +171,7 @@ public string Format(CoverageResult result)
154
171
method . AppendChild ( methodName ) ;
155
172
method . AppendChild ( fileRef ) ;
156
173
method . AppendChild ( sequencePoints ) ;
157
- method . AppendChild ( xml . CreateElement ( "BranchPoints" ) ) ;
174
+ method . AppendChild ( branchPoints ) ;
158
175
method . AppendChild ( methodPoint ) ;
159
176
methods . AppendChild ( method ) ;
160
177
j ++ ;
@@ -165,9 +182,9 @@ public string Format(CoverageResult result)
165
182
visitedClasses ++ ;
166
183
167
184
classSummary . SetAttribute ( "numSequencePoints" , cls . Value . Select ( c => c . Value . Count ) . Sum ( ) . ToString ( ) ) ;
168
- classSummary . SetAttribute ( "visitedSequencePoints" , cls . Value . Select ( c => c . Value . Where ( l => l . Value > 0 ) . Count ( ) ) . Sum ( ) . ToString ( ) ) ;
169
- classSummary . SetAttribute ( "numBranchPoints" , "0" ) ;
170
- classSummary . SetAttribute ( "visitedBranchPoints" , "0" ) ;
185
+ classSummary . SetAttribute ( "visitedSequencePoints" , cls . Value . Select ( c => c . Value . Where ( l => l . Value . Hits > 0 ) . Count ( ) ) . Sum ( ) . ToString ( ) ) ;
186
+ classSummary . SetAttribute ( "numBranchPoints" , cls . Value . Select ( c => c . Value . Count ( l => l . Value . IsBranchPoint ) ) . Sum ( ) . ToString ( ) ) ;
187
+ classSummary . SetAttribute ( "visitedBranchPoints" , cls . Value . Select ( c => c . Value . Where ( l => l . Value . Hits > 0 && l . Value . IsBranchPoint ) . Count ( ) ) . Sum ( ) . ToString ( ) ) ;
171
188
classSummary . SetAttribute ( "sequenceCoverage" , "0" ) ;
172
189
classSummary . SetAttribute ( "branchCoverage" , "0" ) ;
173
190
classSummary . SetAttribute ( "maxCyclomaticComplexity" , "0" ) ;
@@ -192,8 +209,8 @@ public string Format(CoverageResult result)
192
209
193
210
coverageSummary . SetAttribute ( "numSequencePoints" , numSequencePoints . ToString ( ) ) ;
194
211
coverageSummary . SetAttribute ( "visitedSequencePoints" , visitedSequencePoints . ToString ( ) ) ;
195
- coverageSummary . SetAttribute ( "numBranchPoints" , "0" ) ;
196
- coverageSummary . SetAttribute ( "visitedBranchPoints" , "0" ) ;
212
+ coverageSummary . SetAttribute ( "numBranchPoints" , numBranchPoints . ToString ( ) ) ;
213
+ coverageSummary . SetAttribute ( "visitedBranchPoints" , visitedBranchPoints . ToString ( ) ) ;
197
214
coverageSummary . SetAttribute ( "sequenceCoverage" , "0" ) ;
198
215
coverageSummary . SetAttribute ( "branchCoverage" , "0" ) ;
199
216
coverageSummary . SetAttribute ( "maxCyclomaticComplexity" , "0" ) ;
0 commit comments