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