Sha256: a000146d77472ced3db013d28aa77cb78675a3e0ce03d2aab47ad36b070f9651

Contents?: true

Size: 1.66 KB

Versions: 11

Compression:

Stored size: 1.66 KB

Contents

# frozen_string_literal: true

module Mutant
  class Reporter
    class CLI
      class Printer
        # Env progress printer
        class EnvProgress < self
          delegate(
            :amount_mutation_results,
            :amount_mutations_alive,
            :amount_mutations_killed,
            :coverage,
            :env,
            :killtime,
            :overhead,
            :runtime
          )

          FORMATS = IceNine.deep_freeze([
            [:info,   'Results:         %s',      :amount_mutation_results],
            [:info,   'Kills:           %s',      :amount_mutations_killed],
            [:info,   'Alive:           %s',      :amount_mutations_alive ],
            [:info,   'Runtime:         %0.2fs',  :runtime                ],
            [:info,   'Killtime:        %0.2fs',  :killtime               ],
            [:info,   'Overhead:        %0.2f%%', :overhead_percent       ],
            [:info,   'Mutations/s:     %0.2f',   :mutations_per_second   ],
            [:status, 'Coverage:        %0.2f%%', :coverage_percent       ]
          ])

          # Run printer
          #
          # @return [undefined]
          def run
            visit(Env, env)
            FORMATS.each do |report, format, value|
              __send__(report, format, __send__(value))
            end
          end

        private

          def mutations_per_second
            amount_mutation_results / runtime
          end

          def coverage_percent
            coverage * 100
          end

          def overhead_percent
            (overhead / killtime) * 100
          end
        end # EnvProgress
      end # Printer
    end # CLI
  end # Reporter
end # Mutant

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mutant-0.10.6 lib/mutant/reporter/cli/printer/env_progress.rb
mutant-0.10.5 lib/mutant/reporter/cli/printer/env_progress.rb
mutant-0.10.4 lib/mutant/reporter/cli/printer/env_progress.rb
mutant-0.10.1 lib/mutant/reporter/cli/printer/env_progress.rb
mutant-0.10.0 lib/mutant/reporter/cli/printer/env_progress.rb
mutant-0.9.14 lib/mutant/reporter/cli/printer/env_progress.rb
mutant-0.9.13 lib/mutant/reporter/cli/printer/env_progress.rb
mutant-0.9.12 lib/mutant/reporter/cli/printer/env_progress.rb
mutant-0.9.11 lib/mutant/reporter/cli/printer/env_progress.rb
mutant-0.9.10 lib/mutant/reporter/cli/printer/env_progress.rb
mutant-0.9.9 lib/mutant/reporter/cli/printer/env_progress.rb