Sha256: 0f548dc3a160363a7ea2b33a9ca28d54253881c283ed1400f41deba2e3fab642

Contents?: true

Size: 1.35 KB

Versions: 9

Compression:

Stored size: 1.35 KB

Contents

# frozen_string_literal: true

module Mutant
  class Reporter
    class CLI
      class Printer
        # Reporter for progressive output format on scheduler Status objects
        class StatusProgressive < self
          FORMAT = 'progress: %02d/%02d alive: %d runtime: %0.02fs killtime: %0.02fs mutations/s: %0.02f'

          delegate(
            :amount_mutation_results,
            :amount_mutations,
            :amount_mutations_alive,
            :amount_mutations_killed,
            :killtime,
            :overhead,
            :runtime
          )

          # Run printer
          #
          # @return [undefined]
          def run
            status(
              FORMAT,
              amount_mutation_results,
              amount_mutations,
              amount_mutations_alive,
              runtime,
              killtime,
              mutations_per_second
            )
          end

        private

          # Object being printed
          #
          # @return [Result::Env]
          def object
            super().payload
          end

          # Mutations processed per second
          #
          # @return [Float]
          #
          # @api private
          def mutations_per_second
            amount_mutation_results / runtime
          end
        end # StatusProgressive
      end # Printer
    end # CLI
  end # Reporter
end # Mutant

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mutant-0.9.8 lib/mutant/reporter/cli/printer/status_progressive.rb
mutant-0.9.7 lib/mutant/reporter/cli/printer/status_progressive.rb
mutant-0.9.6 lib/mutant/reporter/cli/printer/status_progressive.rb
mutant-0.9.5 lib/mutant/reporter/cli/printer/status_progressive.rb
mutant-0.9.4 lib/mutant/reporter/cli/printer/status_progressive.rb
mutant-0.9.3 lib/mutant/reporter/cli/printer/status_progressive.rb
mutant-0.9.2 lib/mutant/reporter/cli/printer/status_progressive.rb
mutant-0.9.1 lib/mutant/reporter/cli/printer/status_progressive.rb
mutant-0.9.0 lib/mutant/reporter/cli/printer/status_progressive.rb