Sha256: 87237542ccfccb03bc21d46d14abbeda1d924b629efbd038d56b1caf2fcebced

Contents?: true

Size: 1010 Bytes

Versions: 5

Compression:

Stored size: 1010 Bytes

Contents

module Mutant
  class Reporter

    # Stats gathered while reporter is running
    class Stats

      # Return subject count
      #
      # @return [Fixnum]
      #
      # @api private
      #
      attr_reader :subject

      # Return mutation count
      #
      # @return [Fixnum]
      #
      # @api private
      #
      attr_reader :mutation

      # Return kill count
      #
      # @return [Fixnum]
      #
      # @api private
      #
      attr_reader :kill

      # Return mutation runtime
      #
      # @return [Float]
      #
      # @api private
      #
      attr_reader :time

      def initialize
        @start = Time.now
        @subject = @mutation = @kill = @time = 0
      end

      def runtime
        Time.now - @start
      end

      def subject
        @subject +=1
      end

      def alive
        @mutation - @kill
      end

      def killer(killer)
        @mutation +=1
        @kill +=1 unless killer.fail?
        @time += killer.runtime
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mutant-0.2.4 lib/mutant/reporter/stats.rb
mutant-0.2.3 lib/mutant/reporter/stats.rb
mutant-0.2.2 lib/mutant/reporter/stats.rb
mutant-0.2.1 lib/mutant/reporter/stats.rb
mutant-0.2.0 lib/mutant/reporter/stats.rb