10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/sixth_sense/runners/checked_coverage_estimator.rb', line 10
def estimate(test_file, coverage_map)
checked = {}
executed = Hash.new { |hash, key| hash[key] = Set.new }
test_file.test_cases.each do |test_case|
covered_by_path = group_requirements(coverage_map.line_requirements_for(test_case.id))
sut_paths = test_file.sut_candidates.map { |unit| File.expand_path(unit.path) }.to_set
covered_by_path.each do |path, lines|
executed[path].merge(lines) if sut_paths.include?(File.expand_path(path))
end
checked[test_case.id] = checked_lines_for(test_file, test_case, covered_by_path)
end
Model::CheckedCoverageMap.new(
per_test_checked_lines: checked,
executed_lines: executed.transform_values(&:to_a)
)
end
|