Class: SixthSense::Model::KillMatrix
- Inherits:
-
Struct
- Object
- Struct
- SixthSense::Model::KillMatrix
- Defined in:
- lib/sixth_sense/model.rb
Instance Attribute Summary collapse
-
#kills ⇒ Object
Returns the value of attribute kills.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#mutants ⇒ Object
Returns the value of attribute mutants.
Instance Method Summary collapse
-
#equivalent_ratio ⇒ Object
Paper basis: Jia/Harman 2011 highlights equivalent mutants; the ratio is surfaced to warn about excessive denominator exclusions.
-
#kill_requirements_for(test_case_id) ⇒ Object
Paper basis: Koochakzadeh/Garousi 2010 uses killed-mutant sets as requirements for mutation-based redundancy detection.
- #matrix? ⇒ Boolean
-
#mutation_score ⇒ Object
Paper basis: Jia/Harman 2011 defines mutation score as killed mutants over non-excluded mutants; Just et al.
- #sampled? ⇒ Boolean
- #surviving_mutants ⇒ Object
- #timeout_ratio ⇒ Object
Instance Attribute Details
#kills ⇒ Object
Returns the value of attribute kills
217 218 219 |
# File 'lib/sixth_sense/model.rb', line 217 def kills @kills end |
#metadata ⇒ Object
Returns the value of attribute metadata
217 218 219 |
# File 'lib/sixth_sense/model.rb', line 217 def @metadata end |
#mutants ⇒ Object
Returns the value of attribute mutants
217 218 219 |
# File 'lib/sixth_sense/model.rb', line 217 def mutants @mutants end |
Instance Method Details
#equivalent_ratio ⇒ Object
Paper basis: Jia/Harman 2011 highlights equivalent mutants; the ratio is surfaced to warn about excessive denominator exclusions.
251 252 253 254 255 |
# File 'lib/sixth_sense/model.rb', line 251 def equivalent_ratio return 0.0 if mutants.empty? mutants.count { |mutant| mutant.status == :equivalent || mutant.status == "equivalent" }.to_f / mutants.length end |
#kill_requirements_for(test_case_id) ⇒ Object
Paper basis: Koochakzadeh/Garousi 2010 uses killed-mutant sets as requirements for mutation-based redundancy detection.
259 260 261 |
# File 'lib/sixth_sense/model.rb', line 259 def kill_requirements_for(test_case_id) kills.fetch(test_case_id, Set.new).to_set end |
#matrix? ⇒ Boolean
230 231 232 |
# File 'lib/sixth_sense/model.rb', line 230 def matrix? ( || {}).fetch("mode", "matrix") == "matrix" end |
#mutation_score ⇒ Object
Paper basis: Jia/Harman 2011 defines mutation score as killed mutants over non-excluded mutants; Just et al. 2014 validates its fault relation.
220 221 222 223 224 225 226 227 228 |
# File 'lib/sixth_sense/model.rb', line 220 def mutation_score override = ( || {}).dig("summary", "mutation_score") return override.to_f if override countable = mutants.reject(&:excluded?) return nil if countable.empty? countable.count(&:killed?).to_f / countable.length end |
#sampled? ⇒ Boolean
245 246 247 |
# File 'lib/sixth_sense/model.rb', line 245 def sampled? !!( || {}).dig("sampling", "sampled") end |
#surviving_mutants ⇒ Object
234 235 236 |
# File 'lib/sixth_sense/model.rb', line 234 def surviving_mutants mutants.reject(&:excluded?).reject(&:killed?) end |
#timeout_ratio ⇒ Object
238 239 240 241 242 243 |
# File 'lib/sixth_sense/model.rb', line 238 def timeout_ratio countable = mutants.reject(&:excluded?) return 0.0 if countable.empty? countable.count { |mutant| mutant.status == :timeout || mutant.status == "timeout" }.to_f / countable.length end |