Sha256: 35dfcd36245d7845b11fd44abf2762978898935f63706871b8e6c6b07ceea017

Contents?: true

Size: 917 Bytes

Versions: 8

Compression:

Stored size: 917 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require "crude-mutant"

test_command = ARGV[0]
file_to_mutate = ARGV[1]

if !file_to_mutate || !test_command
  puts "Usage: crude-mutant [test command] [file to mutate]"
  puts ""
  puts "Example:"
  puts "  crude-mutant \"bundle exec rspec\" app/models/post.rb"
  exit(1)
end

CrudeMutant.start(file_to_mutate, test_command) do |progress|
  clear_string = ' ' * CrudeMutant::TerminalCalculator.new.calculate_length
  $stdout.print clear_string
  $stdout.print "\r"

  completed = "Completed #{progress.run_results.size}/#{progress.total_runs_to_perform}"
  average = "Average time per run: #{progress.avg_time.round(2)} second(s)"
  eta_time = (progress.total_runs_to_perform - progress.run_results.size) * progress.avg_time
  eta = "Estimated time of completion: #{eta_time.round(2)} seconds"
  $stdout.print "#{completed} #{average} #{eta}\r"
  $stdout.flush
end

Version data entries

8 entries across 4 versions & 1 rubygems

Version Path
crude-mutant-0.2.3 exe/cm
crude-mutant-0.2.3 exe/crude-mutant
crude-mutant-0.2.2 exe/cm
crude-mutant-0.2.2 exe/crude-mutant
crude-mutant-0.2.1 exe/cm
crude-mutant-0.2.1 exe/crude-mutant
crude-mutant-0.2.0 exe/cm
crude-mutant-0.2.0 exe/crude-mutant