class Mutiny::Mode::Score
Public Instance Methods
run()
click to toggle source
# File lib/mutiny/mode/score.rb, line 6 def run report "Scoring..." report "#{mutant_set.size} mutants, #{results.kill_count} killed" report "" report summary end
Private Instance Methods
initialize_mutant_set()
click to toggle source
# File lib/mutiny/mode/score.rb, line 63 def initialize_mutant_set if options[:cached] configuration.mutant_storage.load_for(environment.subjects) else configuration.mutator.mutants_for(environment.subjects) end end
mutant_set()
click to toggle source
# File lib/mutiny/mode/score.rb, line 59 def mutant_set @mutant_set ||= initialize_mutant_set end
results()
click to toggle source
# File lib/mutiny/mode/score.rb, line 55 def results @results ||= configuration.analyser.call(mutant_set) end
status_for_mutant(mutant)
click to toggle source
# File lib/mutiny/mode/score.rb, line 32 def status_for_mutant(mutant) if mutant.stillborn? "stillborn" elsif results.survived?(mutant) "survived" else "killed" end end
summarise(mutant)
click to toggle source
# File lib/mutiny/mode/score.rb, line 26 def summarise(mutant) identifier = mutant.identifier status = status_for_mutant(mutant) [identifier, status] + summarise_tests(mutant) end
summarise_tests(mutant)
click to toggle source
# File lib/mutiny/mode/score.rb, line 42 def summarise_tests(mutant) if mutant.stillborn? number_of_tests = "n/a" runtime = "n/a" else executed_count = results.test_run_for(mutant).executed_count total_count = results.test_run_for(mutant).tests.size runtime = results.test_run_for(mutant).runtime number_of_tests = "#{executed_count} (of #{total_count})" end [number_of_tests, runtime] end
summary()
click to toggle source
# File lib/mutiny/mode/score.rb, line 15 def summary Output::Table.new.tap do |summary| summary.add_row(summary_header) summary.add_rows(results.mutants.ordered.map { |m| summarise(m) }) end end
summary_header()
click to toggle source
# File lib/mutiny/mode/score.rb, line 22 def summary_header ["Mutant", "Status", "# Tests", "Time"] end