Remove Mutant::Reporter::Stats

This mutable class was used to steer the control flow. The runner tree
will form the same stats with a far better level of detail.
This commit is contained in:
Markus Schirp 2013-04-20 20:48:38 +02:00
parent 90fade2ca5
commit c92ddc64f8
2 changed files with 0 additions and 163 deletions

View file

@ -121,6 +121,5 @@ require 'mutant/cli/classifier/method'
require 'mutant/color'
require 'mutant/differ'
require 'mutant/reporter'
require 'mutant/reporter/stats'
require 'mutant/reporter/null'
require 'mutant/reporter/cli'

View file

@ -1,162 +0,0 @@
module Mutant
class Reporter
# Stats gathered while reporter is running
class Stats
# A counter with fail counts
class Counter
include Equalizer.new(:count, :fails)
# Return count
#
# @return [Fixnum]
#
# @api private
#
attr_reader :count
# Return fail count
#
# @return [Fixnum]
#
# @api private
#
attr_reader :fails
# Initialize object
#
# @return [undefined]
#
# @api private
#
def initialize
@count = @fails = 0
end
# Count killer
#
# @param [Killer] killer
#
# @return [self]
#
# @api private
#
def handle(killer)
@count += 1
unless killer.success?
@fails += 1
end
self
end
end
include Equalizer.new(:start, :counts, :killers)
# Initialize object
#
# @return [undefined]
#
# @api private
#
def initialize
@start = start
@counts = Hash.new(0)
@killers = {}
end
protected
# Return counts
#
# @return [Hash]
#
# @api private
#
attr_reader :counts
# Return start time
#
# @return [Time]
#
# @api private
#
attr_reader :start
# Return killers
#
# @return [Hash]
#
# @api private
#
attr_reader :killers
public
# Count subject
#
# @return [self]
#
# @api private
#
def count_subject
@counts[:subject] += 1
end
# Test for success?
#
# @return [true]
# if there are subjects and no errors
#
# @return [false]
# otherwise
#
# @api private
#
def success?
@counts[:subject].nonzero? && !errors?
end
# Count killer
#
# @param [Killer] killer
#
# @return [self]
#
# @api private
#
def count_killer(killer)
counter = @killers[killer.mutation.class] ||= Counter.new
counter.handle(killer)
self
end
# Test for errors
#
# @return [true]
# if there are errors
#
# @return [false]
# otherwise
#
# @api private
#
def errors?
@killers.values.any? do |counter|
counter.nonzero?
end
end
# Return runtime in seconds
#
# @return [Float]
#
# @api private
#
def runtime
Time.now - @start
end
end
end
end