Class: SixthSense::Model::CheckedCoverageMap

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#executed_linesObject

Returns the value of attribute executed_lines

Returns:

  • (Object)

    the current value of executed_lines



143
144
145
# File 'lib/sixth_sense/model.rb', line 143

def executed_lines
  @executed_lines
end

#per_test_checked_linesObject

Returns the value of attribute per_test_checked_lines

Returns:

  • (Object)

    the current value of per_test_checked_lines



143
144
145
# File 'lib/sixth_sense/model.rb', line 143

def per_test_checked_lines
  @per_test_checked_lines
end

Instance Method Details

#checked_ratioObject

Paper basis: Schuler/Zeller 2011 (doi:10.1109/ICST.2011.32) scores the fraction of executed code that is checked by an oracle.



146
147
148
149
150
151
152
153
154
# File 'lib/sixth_sense/model.rb', line 146

def checked_ratio
  executed = normalize_requirements(executed_lines || {})
  return nil if executed.empty?

  checked = per_test_checked_lines.values.flat_map do |requirements_by_path|
    normalize_requirements(requirements_by_path).to_a
  end.to_set
  (checked & executed).length.to_f / executed.length
end

#unchecked_linesObject

Paper basis: Schuler/Zeller 2011; unchecked executed lines are reported as oracle-quality gaps rather than ordinary coverage gaps.



158
159
160
161
162
163
# File 'lib/sixth_sense/model.rb', line 158

def unchecked_lines
  checked = per_test_checked_lines.values.flat_map do |requirements_by_path|
    normalize_requirements(requirements_by_path).to_a
  end.to_set
  normalize_requirements(executed_lines || {}) - checked
end