Skip to content

Commit

Permalink
Take maximum for line count instead of summation.
Browse files Browse the repository at this point in the history
  • Loading branch information
kennytm committed Sep 19, 2017
1 parent bc3a654 commit d10c8f4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions cov/src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use petgraph::Direction;
use petgraph::graph::{DiGraph, EdgeIndex, EdgeReference, NodeIndex};
use petgraph::visit::{Dfs, EdgeFiltered, EdgeRef, IntoNodeReferences};

use std::{io, mem, usize};
use std::{cmp, io, mem, usize};
use std::borrow::Cow;
use std::collections::{BTreeMap, Bound, HashSet};
use std::collections::hash_map::{Entry, HashMap};
Expand Down Expand Up @@ -261,7 +261,7 @@ impl Graph {
for (filename, line_number) in block.iter_lines() {
let file = r.files.entry(filename).or_default();
let line = file.lines.entry(line_number).or_default();
line.count += block_count;
line.count = cmp::max(line.count, block_count);
line.attr |= block.attr;
last_line = Some((filename, line_number));
}
Expand Down
6 changes: 3 additions & 3 deletions cov/test-data/branches.rustc/x.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"branches": []
},
"8": {
"count": 2,
"count": 1,
"attr": 0,
"branches": [
{
Expand All @@ -98,12 +98,12 @@
]
},
"9": {
"count": 2,
"count": 1,
"attr": 0,
"branches": []
},
"10": {
"count": 2,
"count": 1,
"attr": 0,
"branches": [
{
Expand Down
2 changes: 1 addition & 1 deletion cov/test-data/trivial.clang/x.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"x.cpp": {
"lines": {
"1": {
"count": 2,
"count": 1,
"attr": 0,
"branches": []
}
Expand Down
2 changes: 1 addition & 1 deletion cov/test-data/trivial.rustc/x.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"x.rs": {
"lines": {
"1": {
"count": 2,
"count": 1,
"attr": 0,
"branches": []
}
Expand Down

0 comments on commit d10c8f4

Please sign in to comment.