Class: Evilution::Compare::Normalizer
- Inherits:
-
Object
- Object
- Evilution::Compare::Normalizer
- Defined in:
- lib/evilution/compare/normalizer.rb
Constant Summary collapse
- EVILUTION_BUCKETS =
%w[killed survived timed_out errors neutral equivalent unresolved unparseable].freeze
- EVILUTION_STATUS_MAP =
{ "killed" => :killed, "survived" => :survived, "timeout" => :timeout, "error" => :error, "neutral" => :neutral, "equivalent" => :equivalent, "unresolved" => :unresolved, "unparseable" => :unparseable }.freeze
Instance Method Summary collapse
Instance Method Details
#from_evilution(json) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/evilution/compare/normalizer.rb', line 20 def from_evilution(json) records = [] EVILUTION_BUCKETS.each do |bucket| Array(json[bucket]).each do |entry| records << build_evilution_record(entry, index: records.size) end end records end |
#from_mutant(json) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/evilution/compare/normalizer.rb', line 30 def from_mutant(json) records = [] Array(json["subject_results"]).each do |subject| source_path = subject["source_path"] or raise Evilution::Compare::InvalidInput.new("missing 'source_path' on subject", index: records.size) Array(subject["coverage_results"]).each do |cov| records << build_mutant_record(cov, source_path: source_path, index: records.size) end end records end |