Class: SixthSense::Model::CoverageMap

Inherits:
Struct
  • Object
show all
Defined in:
lib/sixth_sense/model.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#per_test_branchesObject

Returns the value of attribute per_test_branches

Returns:

  • (Object)

    the current value of per_test_branches



92
93
94
# File 'lib/sixth_sense/model.rb', line 92

def per_test_branches
  @per_test_branches
end

#per_test_linesObject

Returns the value of attribute per_test_lines

Returns:

  • (Object)

    the current value of per_test_lines



92
93
94
# File 'lib/sixth_sense/model.rb', line 92

def per_test_lines
  @per_test_lines
end

#total_branchesObject

Returns the value of attribute total_branches

Returns:

  • (Object)

    the current value of total_branches



92
93
94
# File 'lib/sixth_sense/model.rb', line 92

def total_branches
  @total_branches
end

#total_linesObject

Returns the value of attribute total_lines

Returns:

  • (Object)

    the current value of total_lines



92
93
94
# File 'lib/sixth_sense/model.rb', line 92

def total_lines
  @total_lines
end

Instance Method Details

#branch_coverage_ratioObject

Paper basis: Zhu/Hall/May 1997; this is the raw satisfied-branch requirement ratio preferred by adequacy/coverage.



119
120
121
# File 'lib/sixth_sense/model.rb', line 119

def branch_coverage_ratio
  ratio_for(per_test_branches, total_branches)
end

#branch_requirements_for(test_case_id) ⇒ Object

Paper basis: Zhu/Hall/May 1997; branch requirements provide a stronger structural adequacy signal than line requirements when available.



107
108
109
# File 'lib/sixth_sense/model.rb', line 107

def branch_requirements_for(test_case_id)
  normalize_requirements(per_test_branches.fetch(test_case_id, {}))
end

#line_coverage_ratioObject

Paper basis: Zhu/Hall/May 1997; this is the raw satisfied-line requirement ratio used by adequacy/coverage.



113
114
115
# File 'lib/sixth_sense/model.rb', line 113

def line_coverage_ratio
  ratio_for(per_test_lines, total_lines)
end

#line_requirements_for(test_case_id) ⇒ Object

Paper basis: Zhu/Hall/May 1997 (doi:10.1145/267580.267590) treats executed lines as coverage requirements for adequacy criteria.



101
102
103
# File 'lib/sixth_sense/model.rb', line 101

def line_requirements_for(test_case_id)
  normalize_requirements(per_test_lines.fetch(test_case_id, {}))
end