@@ -187,24 +187,36 @@ private static Dictionary<int, ICollection<Branch>> GetBranches(IEnumerable<XEle
187
187
int negativeBrancheCovered = int . Parse ( line . Attribute ( "falsecount" ) . Value , CultureInfo . InvariantCulture ) ;
188
188
int positiveBrancheCovered = int . Parse ( line . Attribute ( "truecount" ) . Value , CultureInfo . InvariantCulture ) ;
189
189
190
- var branches = new HashSet < Branch > ( ) ;
190
+ if ( result . ContainsKey ( lineNumber ) )
191
+ {
192
+ var branches = result [ lineNumber ] ;
193
+
194
+ Branch negativeBranch = branches . First ( ) ;
195
+ Branch positiveBranch = branches . ElementAt ( 1 ) ;
191
196
192
- string identifier1 = string . Format (
197
+ negativeBranch . BranchVisits = Math . Max ( negativeBrancheCovered > 0 ? 1 : 0 , negativeBranch . BranchVisits ) ;
198
+ positiveBranch . BranchVisits = Math . Max ( positiveBrancheCovered > 0 ? 1 : 0 , positiveBranch . BranchVisits ) ;
199
+ }
200
+ else
201
+ {
202
+ string identifier1 = string . Format (
193
203
CultureInfo . InvariantCulture ,
194
204
"{0}_{1}" ,
195
205
lineNumber ,
196
206
"0" ) ;
197
207
198
- string identifier2 = string . Format (
199
- CultureInfo . InvariantCulture ,
200
- "{0}_{1}" ,
201
- lineNumber ,
202
- "1" ) ;
208
+ string identifier2 = string . Format (
209
+ CultureInfo . InvariantCulture ,
210
+ "{0}_{1}" ,
211
+ lineNumber ,
212
+ "1" ) ;
203
213
204
- branches . Add ( new Branch ( negativeBrancheCovered > 0 ? 1 : 0 , identifier1 ) ) ;
205
- branches . Add ( new Branch ( positiveBrancheCovered > 0 ? 1 : 0 , identifier2 ) ) ;
214
+ var branches = new HashSet < Branch > ( ) ;
215
+ branches . Add ( new Branch ( negativeBrancheCovered > 0 ? 1 : 0 , identifier1 ) ) ;
216
+ branches . Add ( new Branch ( positiveBrancheCovered > 0 ? 1 : 0 , identifier2 ) ) ;
206
217
207
- result . Add ( lineNumber , branches ) ;
218
+ result . Add ( lineNumber , branches ) ;
219
+ }
208
220
}
209
221
210
222
return result ;
0 commit comments