Class: Mutineer::AggregateResult
- Inherits:
-
Object
- Object
- Mutineer::AggregateResult
- Defined in:
- lib/mutineer/result.rb
Overview
Aggregates a flat list of Results into counts, the mutation score, and the surviving-mutant list. The score denominator is killed + survived ONLY (KTD-4): no-coverage, skipped (invalid), errored, and timeout are each excluded and surfaced separately. An empty denominator yields a nil score (rendered "N/A"), never 0.0 — distinguishing "no testable mutants" from "0% killed".
Instance Attribute Summary collapse
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
-
#covered_count ⇒ Object
The score denominator (also shown to the reader).
- #errored_count ⇒ Object
-
#initialize(results) ⇒ AggregateResult
constructor
A new instance of AggregateResult.
- #killed_count ⇒ Object
-
#mutation_score ⇒ Object
killed / (killed + survived) as a rounded percentage, or nil when nothing was testable.
- #no_coverage_count ⇒ Object
- #skipped_invalid_count ⇒ Object
- #survived_count ⇒ Object
- #surviving_mutants ⇒ Object
- #timeout_count ⇒ Object
-
#total ⇒ Object
Every generated, classified mutation.
Constructor Details
#initialize(results) ⇒ AggregateResult
Returns a new instance of AggregateResult.
45 46 47 48 |
# File 'lib/mutineer/result.rb', line 45 def initialize(results) @results = results @by_status = results.group_by(&:status) end |
Instance Attribute Details
#results ⇒ Object (readonly)
Returns the value of attribute results.
43 44 45 |
# File 'lib/mutineer/result.rb', line 43 def results @results end |
Instance Method Details
#covered_count ⇒ Object
The score denominator (also shown to the reader).
61 |
# File 'lib/mutineer/result.rb', line 61 def covered_count = killed_count + survived_count |
#errored_count ⇒ Object
54 |
# File 'lib/mutineer/result.rb', line 54 def errored_count = count(:error) |
#killed_count ⇒ Object
50 |
# File 'lib/mutineer/result.rb', line 50 def killed_count = count(:killed) |
#mutation_score ⇒ Object
killed / (killed + survived) as a rounded percentage, or nil when nothing was testable.
65 66 67 68 69 |
# File 'lib/mutineer/result.rb', line 65 def mutation_score return nil if covered_count.zero? (killed_count.to_f / covered_count * 100).round(1) end |
#no_coverage_count ⇒ Object
52 |
# File 'lib/mutineer/result.rb', line 52 def no_coverage_count = count(:no_coverage) |
#skipped_invalid_count ⇒ Object
53 |
# File 'lib/mutineer/result.rb', line 53 def skipped_invalid_count = count(:skipped) |
#survived_count ⇒ Object
51 |
# File 'lib/mutineer/result.rb', line 51 def survived_count = count(:survived) |
#surviving_mutants ⇒ Object
71 |
# File 'lib/mutineer/result.rb', line 71 def surviving_mutants = @results.select(&:survived?) |
#timeout_count ⇒ Object
55 |
# File 'lib/mutineer/result.rb', line 55 def timeout_count = count(:timeout) |
#total ⇒ Object
Every generated, classified mutation. NOT the score denominator.
58 |
# File 'lib/mutineer/result.rb', line 58 def total = @results.size |