2014-04-28 15:17:25 -04:00
|
|
|
module Mutant
|
|
|
|
class Runner
|
|
|
|
# Killer runner
|
|
|
|
class Killer < self
|
|
|
|
include Equalizer.new(:config, :killer)
|
|
|
|
|
|
|
|
register Mutant::Killer
|
|
|
|
|
|
|
|
# Return killer
|
|
|
|
#
|
|
|
|
# @return [Killer]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
attr_reader :killer
|
|
|
|
protected :killer
|
|
|
|
|
2014-05-22 23:15:36 -04:00
|
|
|
# Return kill report
|
|
|
|
#
|
|
|
|
# @return [Killer::Report]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
attr_reader :report
|
|
|
|
|
2014-04-28 15:17:25 -04:00
|
|
|
# Test if killer ran successfully
|
|
|
|
#
|
|
|
|
# @return [Boolean]
|
|
|
|
#
|
|
|
|
# @api private
|
2014-06-28 16:52:47 -04:00
|
|
|
#
|
2014-04-28 15:17:25 -04:00
|
|
|
def success?
|
|
|
|
@report.success?
|
|
|
|
end
|
|
|
|
|
2014-05-27 12:43:16 -04:00
|
|
|
# Test if this killer ALONE can determine if mutation is dead
|
|
|
|
#
|
|
|
|
# @return [Boolean]
|
|
|
|
#
|
2014-06-28 16:52:47 -04:00
|
|
|
# @api private
|
|
|
|
#
|
2014-05-27 12:43:16 -04:00
|
|
|
def mutation_dead?
|
|
|
|
test_report = report.test_report
|
|
|
|
killer.mutation.should_fail? && test_report.failed?
|
|
|
|
end
|
|
|
|
|
2014-04-28 15:17:25 -04:00
|
|
|
# Initialize object
|
|
|
|
#
|
|
|
|
# @param [Config] config
|
|
|
|
# @param [Mutation] mutation
|
|
|
|
#
|
|
|
|
# @return [undefined]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def initialize(config, killer)
|
|
|
|
@killer = killer
|
|
|
|
super(config)
|
|
|
|
end
|
|
|
|
|
2014-05-27 12:43:16 -04:00
|
|
|
private
|
|
|
|
|
2014-04-28 15:17:25 -04:00
|
|
|
# Run killer
|
|
|
|
#
|
2014-06-28 16:52:47 -04:00
|
|
|
# @return [undefined]
|
|
|
|
#
|
2014-04-28 15:17:25 -04:00
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def run
|
|
|
|
@report = killer.run
|
|
|
|
end
|
|
|
|
|
|
|
|
end # Killer
|
|
|
|
end # Runner
|
|
|
|
end # Mutant
|