Implement correctly the logic to get the not killed mutants

Signed-off-by: 's avatarHenrique Varella Ehrenfried <hve13@inf.ufpr.br>
parent c393e135
require 'csv'
# ARGV[0] = Caminho do arquivo
all_lines = Array.new
results = Array.new
test_cases_failure = Array.new
ARGV[0] = file_analyze
ARGV[1] = source_matrix
file_analyze = ARGV[0]
source_matrix = ARGV[1]
File.readlines(file_analyze).each do |line|
all_lines << line
......@@ -14,30 +16,43 @@ end
# Index 101~200 = 20%
# Index 201~300 = 50%
matrix = CSV.new(source_matrix,{:col_sep => ";"}).to_a
matrix = CSV.read(source_matrix,{:col_sep => ";"}).to_a
matrix_no_header = matrix
matrix_no_header.shift
matrix_t = matrix_no_header.transpose
matriz_size = matrix.size
matrix_size = matrix.size
matrix_numbers = matrix_t
matrix_numbers.shift
matrix_numbers.pop(3)
i = 0
limit = matrix_numbers.size
i = 1
limit = matrix_no_header.size
# This loop finds out which mutants are not killed by each test case
while i < limit do
temp_array = Array.new
matrix_t[i].each_with_index do |mt, ind|
if mt.to_i == 0
temp_array << ind
matrix_numbers[i].each_with_index do |test_case, mutant|
if test_case.to_i == 0
temp_array << mutant
end
end
test_cases_failure[i] = temp_array
test_cases_failure << temp_array
i+=1
end
# This loop return the alive mutants based in the lines of the file passed as ARGV[0]
mutants_not_killed = Array.new
all_lines.each do |al|
temp_array = Array.new
split_line = al.split(" ")
split_line.each do |sl|
mutants_not_killed << test_cases_failure[sl.split("_").last]
temp_array << test_cases_failure[sl.split("_").last.to_i-1]
end
mutants_not_killed << temp_array.map{ |x| x }.reduce(&:|).uniq
end
# TODO: Implement logic to count how many mutatans are alive using the mutants_not_killed
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment