2012-08-01 19:05:34 +02:00
|
|
|
module Mutant
|
2014-04-28 19:17:25 +00:00
|
|
|
# Mutation killer
|
2012-08-14 12:27:56 +02:00
|
|
|
class Killer
|
2014-05-23 01:03:09 +00:00
|
|
|
include Adamantium::Flat, Anima.new(:test, :mutation)
|
2013-02-01 23:39:00 +01:00
|
|
|
|
2014-04-28 19:17:25 +00:00
|
|
|
# Report object for kill results
|
|
|
|
class Report
|
|
|
|
include Anima.new(
|
|
|
|
:killer,
|
|
|
|
:test_report
|
|
|
|
)
|
2013-02-01 23:39:00 +01:00
|
|
|
|
2014-04-28 19:17:25 +00:00
|
|
|
# Test if kill was successful
|
|
|
|
#
|
|
|
|
# @return [Boolean]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def success?
|
|
|
|
killer.mutation.should_fail?.equal?(test_report.failed?)
|
|
|
|
end
|
2013-02-01 23:39:00 +01:00
|
|
|
|
2014-04-28 19:17:25 +00:00
|
|
|
end # Report
|
2013-04-17 20:31:21 -07:00
|
|
|
|
2014-05-11 14:57:33 +00:00
|
|
|
# Return killer report
|
2012-08-01 19:05:34 +02:00
|
|
|
#
|
2014-05-11 14:57:33 +00:00
|
|
|
# @return [Killer::Report]
|
2012-08-01 19:05:34 +02:00
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
2014-04-28 19:17:25 +00:00
|
|
|
def run
|
2014-06-08 17:55:13 +00:00
|
|
|
test_report = Isolation.call do
|
2014-05-09 23:15:25 +00:00
|
|
|
mutation.insert
|
|
|
|
test.run
|
|
|
|
end
|
|
|
|
|
2014-04-28 19:17:25 +00:00
|
|
|
Report.new(
|
2014-05-09 23:15:25 +00:00
|
|
|
killer: self,
|
|
|
|
test_report: test_report.update(test: test)
|
2014-04-28 19:17:25 +00:00
|
|
|
)
|
2013-01-15 23:46:05 +01:00
|
|
|
end
|
|
|
|
|
2013-06-14 20:54:02 +02:00
|
|
|
end # Killer
|
|
|
|
end # Mutant
|