Class: Ibex::GrammarTests::ProductionCoverage
- Inherits:
-
Struct
- Object
- Struct
- Ibex::GrammarTests::ProductionCoverage
- Defined in:
- lib/ibex/grammar_tests.rb,
lib/ibex/grammar_tests.rb,
sig/ibex/grammar_tests.rbs,
sig/ibex/grammar_tests.rbs
Instance Attribute Summary collapse
-
#covered_ids ⇒ Object
Returns the value of attribute covered_ids.
-
#missing_ids ⇒ Object
Returns the value of attribute missing_ids.
-
#production_count ⇒ Object
Returns the value of attribute production_count.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#covered_ids ⇒ Object
Returns the value of attribute covered_ids
30 31 32 |
# File 'lib/ibex/grammar_tests.rb', line 30 def covered_ids @covered_ids end |
#missing_ids ⇒ Object
Returns the value of attribute missing_ids
30 31 32 |
# File 'lib/ibex/grammar_tests.rb', line 30 def missing_ids @missing_ids end |
#production_count ⇒ Object
Returns the value of attribute production_count
30 31 32 |
# File 'lib/ibex/grammar_tests.rb', line 30 def production_count @production_count end |
Class Method Details
.new(covered_ids:, missing_ids:, production_count:) ⇒ instance .new(arg0) ⇒ instance
39 40 |
# File 'sig/ibex/grammar_tests.rbs', line 39
def self.new: (?covered_ids: Array[Integer], ?missing_ids: Array[Integer], ?production_count: Integer) -> instance
| ({ ?covered_ids: Array[Integer], ?missing_ids: Array[Integer], ?production_count: Integer }) -> instance
|
Instance Method Details
#complete? ⇒ Boolean
51 |
# File 'lib/ibex/grammar_tests.rb', line 51 def complete? = missing_ids.empty? |
#meets?(minimum) ⇒ Boolean
46 47 48 |
# File 'lib/ibex/grammar_tests.rb', line 46 def meets?(minimum) covered_ids.length * 100 >= production_count * minimum end |
#percentage ⇒ Float
39 40 41 42 43 |
# File 'lib/ibex/grammar_tests.rb', line 39 def percentage return 100.0 if production_count.zero? covered_ids.length.fdiv(production_count) * 100 end |