Class: Ibex::GrammarTests::ProductionCoverage

Inherits:
Struct
  • Object
show all
Defined in:
lib/ibex/grammar_tests.rb,
lib/ibex/grammar_tests.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#covered_idsObject

Returns the value of attribute covered_ids

Returns:

  • (Object)

    the current value of covered_ids



30
31
32
# File 'lib/ibex/grammar_tests.rb', line 30

def covered_ids
  @covered_ids
end

#missing_idsObject

Returns the value of attribute missing_ids

Returns:

  • (Object)

    the current value of missing_ids



30
31
32
# File 'lib/ibex/grammar_tests.rb', line 30

def missing_ids
  @missing_ids
end

#production_countObject

Returns the value of attribute production_count

Returns:

  • (Object)

    the current value of production_count



30
31
32
# File 'lib/ibex/grammar_tests.rb', line 30

def production_count
  @production_count
end

Instance Method Details

#complete?Boolean

Returns:

  • (Boolean)


51
# File 'lib/ibex/grammar_tests.rb', line 51

def complete? = missing_ids.empty?

#meets?(minimum) ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/ibex/grammar_tests.rb', line 46

def meets?(minimum)
  covered_ids.length * 100 >= production_count * minimum
end

#percentageObject



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