free_mutant/lib/mutant/runner/mutation.rb

66 lines
1.1 KiB
Ruby
Raw Normal View History

module Mutant
class Runner
# Mutation runner
class Mutation < self
2013-03-27 10:52:02 -04:00
include Concord.new(:config, :mutation)
2013-03-27 10:52:02 -04:00
# Return mutation
#
2013-03-27 10:52:02 -04:00
# @return [Mutation]
#
# @api private
#
2013-03-27 10:52:02 -04:00
attr_reader :mutation
# Initialize object
#
2013-03-27 10:52:02 -04:00
# @param [Config] config
# @param [Mutation] mutation
#
# @return [undefined]
#
# @api private
#
def initialize(config, mutation)
@mutation = mutation
super(config)
end
2013-03-27 10:52:02 -04:00
# Return killer instance
#
# @return [Killer]
#
# @api private
#
attr_reader :killer
# Test if mutation was handeled successfully
#
# @return [true]
# if successful
#
# @return [false]
# otherwise
#
# @api private
#
def success?
mutation.success?(killer)
end
private
# Perform operation
#
# @return [undefined]
#
# @api private
#
def run
2013-03-27 10:52:02 -04:00
@killer = config.strategy.kill(mutation)
end
end
end
end