Class: Evilution::Compare::Normalizer Private
- Inherits:
-
Object
- Object
- Evilution::Compare::Normalizer
- Defined in:
- lib/evilution/compare/normalizer.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- EVILUTION_BUCKETS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
%w[killed survived timed_out errors neutral equivalent unresolved unparseable].freeze
- EVILUTION_STATUS_MAP =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ "killed" => :killed, "survived" => :survived, "timeout" => :timeout, "error" => :error, "neutral" => :neutral, "equivalent" => :equivalent, "unresolved" => :unresolved, "unparseable" => :unparseable }.freeze
Instance Method Summary collapse
- #from_evilution(json) ⇒ Object private
- #from_mutant(json) ⇒ Object private
-
#initialize ⇒ Normalizer
constructor
private
A new instance of Normalizer.
Constructor Details
#initialize ⇒ Normalizer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Normalizer.
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/evilution/compare/normalizer.rb', line 23 def initialize line_normalizer = Evilution::Compare::LineNormalizer.new @evilution_fingerprint = Evilution::Compare::Fingerprint.new( extractor: Evilution::Compare::DiffExtractor::Evilution.new, normalizer: line_normalizer ) @mutant_fingerprint = Evilution::Compare::Fingerprint.new( extractor: Evilution::Compare::DiffExtractor::Mutant.new, normalizer: line_normalizer ) end |
Instance Method Details
#from_evilution(json) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 36 37 38 39 40 41 42 43 |
# File 'lib/evilution/compare/normalizer.rb', line 35 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
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/evilution/compare/normalizer.rb', line 45 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 |