Sha256: efc71b18f2c9294d46fa276bc486af28e4995e271e93868eb6680c5f81b37ff4

Contents?: true

Size: 1.6 KB

Versions: 8

Compression:

Stored size: 1.6 KB

Contents

module Mutant
  class Reporter
    class CLI
      class Printer
        # Reporter for subject progress
        class SubjectProgress < self
          FORMAT = '(%02d/%02d) %3d%% - killtime: %0.02fs runtime: %0.02fs overhead: %0.02fs'.freeze

          delegate(
            :tests,
            :subject,
            :coverage,
            :runtime,
            :amount_mutations_killed,
            :amount_mutations,
            :amount_mutation_results,
            :killtime,
            :overhead
          )

          # Run printer
          #
          # @return [undefined]
          def run
            puts("#{subject.identification} mutations: #{amount_mutations}")
            print_mutation_results
            print_progress_bar_finish
            print_stats
          end

        private

          # Print stats
          #
          # @return [undefined]
          def print_stats
            status(
              FORMAT,
              amount_mutations_killed,
              amount_mutations,
              coverage * 100,
              killtime,
              runtime,
              overhead
            )
          end

          # Print progress bar finish
          #
          # @return [undefined]
          def print_progress_bar_finish
            puts(nil) unless amount_mutation_results.zero?
          end

          # Print mutation results
          #
          # @return [undefined]
          def print_mutation_results
            visit_collection(MutationProgressResult, object.mutation_results)
          end
        end # SubjectProgress
      end # Printer
    end # CLI
  end # Reporter
end # Mutant

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mutant-0.8.16 lib/mutant/reporter/cli/printer/subject_progress.rb
mutant-0.8.15 lib/mutant/reporter/cli/printer/subject_progress.rb
mutant-0.8.14 lib/mutant/reporter/cli/printer/subject_progress.rb
mutant-0.8.13 lib/mutant/reporter/cli/printer/subject_progress.rb
mutant-0.8.12 lib/mutant/reporter/cli/printer/subject_progress.rb
mutant-0.8.11 lib/mutant/reporter/cli/printer/subject_progress.rb
mutant-0.8.10 lib/mutant/reporter/cli/printer/subject_progress.rb
mutant-0.8.9 lib/mutant/reporter/cli/printer/subject_progress.rb