Class: Bparity::Adequacy::Analyzer
- Inherits:
-
Object
- Object
- Bparity::Adequacy::Analyzer
- Defined in:
- lib/bparity/adequacy.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(bundle:, results:, mutation: nil) ⇒ Analyzer
constructor
A new instance of Analyzer.
Constructor Details
#initialize(bundle:, results:, mutation: nil) ⇒ Analyzer
Returns a new instance of Analyzer.
38 39 40 41 42 |
# File 'lib/bparity/adequacy.rb', line 38 def initialize(bundle:, results:, mutation: nil) @bundle = bundle @results = results @mutation = mutation || { "status" => "skipped", "reason" => "not requested" } end |
Instance Method Details
#call ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/bparity/adequacy.rb', line 44 def call examples = @bundle.fetch("subjects").flat_map { |subject| subject.fetch("operations") } .flat_map { |operation| operation.fetch("examples") } evaluated = @results.length { "specification_coverage" => ratio(evaluated, examples.length), "recorded_examples" => examples.length, "generated_checks" => generated_checks, "formal_assurance" => Reporting::AssuranceMatrix.new(@bundle).to_h, "constraint_strength" => @mutation, "residual_risks" => CoverageReconciler.call(gaps: @bundle.fetch("gaps", []), surviving_mutants: mutation_risks), "waiver_count" => @results.count { |result| result.status == :waived } } end |