2013-02-01 17:06:07 -05:00
|
|
|
module Mutant
|
|
|
|
class Runner
|
|
|
|
# Subject specific runner
|
|
|
|
class Subject < self
|
2013-05-21 20:40:33 -04:00
|
|
|
include Concord::Public.new(:config, :subject)
|
2013-02-01 17:06:07 -05:00
|
|
|
|
2013-03-27 10:52:02 -04:00
|
|
|
# Return subject
|
2013-02-01 17:06:07 -05:00
|
|
|
#
|
2013-03-27 10:52:02 -04:00
|
|
|
# @return [Subject]
|
2013-02-01 17:06:07 -05:00
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
2013-03-27 10:52:02 -04:00
|
|
|
attr_reader :subject
|
2013-02-01 17:06:07 -05:00
|
|
|
|
|
|
|
# Initialize object
|
|
|
|
#
|
2013-03-27 10:52:02 -04:00
|
|
|
# @param [Config] config
|
2013-02-01 17:06:07 -05:00
|
|
|
# @param [Subject] subject
|
|
|
|
#
|
|
|
|
# @return [undefined]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def initialize(config, subject)
|
|
|
|
@subject = subject
|
|
|
|
super(config)
|
|
|
|
end
|
|
|
|
|
2013-03-27 10:52:02 -04:00
|
|
|
# Return mutation runners
|
|
|
|
#
|
|
|
|
# @return [Enumerable<Runner::Mutation>]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
attr_reader :mutations
|
|
|
|
|
|
|
|
# Return failed mutations
|
|
|
|
#
|
|
|
|
# @return [Enumerable<Mutation>]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def failed_mutations
|
|
|
|
mutations.select(&:failed?)
|
|
|
|
end
|
|
|
|
memoize :failed_mutations
|
|
|
|
|
|
|
|
# Test if subject was processed successful
|
|
|
|
#
|
|
|
|
# @return [true]
|
|
|
|
# if successful
|
|
|
|
#
|
|
|
|
# @return [false]
|
|
|
|
# otherwise
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def success?
|
|
|
|
failed_mutations.empty?
|
|
|
|
end
|
|
|
|
|
2013-02-01 17:06:07 -05:00
|
|
|
private
|
|
|
|
|
|
|
|
# Perform operation
|
|
|
|
#
|
|
|
|
# @return [undefined]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def run
|
2013-04-20 20:48:58 -04:00
|
|
|
subject = self.subject
|
2013-04-20 20:20:18 -04:00
|
|
|
report(subject)
|
2013-04-17 21:57:17 -04:00
|
|
|
@mutations = subject.map do |mutation|
|
2013-03-27 10:52:02 -04:00
|
|
|
Mutation.run(config, mutation)
|
2013-02-01 19:00:05 -05:00
|
|
|
end
|
2013-04-20 20:20:18 -04:00
|
|
|
report(self)
|
2013-02-01 17:06:07 -05:00
|
|
|
end
|
|
|
|
|
2013-06-14 14:54:02 -04:00
|
|
|
end # Subject
|
|
|
|
end # Runner
|
|
|
|
end # Mutant
|