Class: Mutant::Env Private
- Inherits:
-
Object
- Object
- Mutant::Env
- Includes:
- Adamantium::Flat
- Defined in:
- lib/mutant/env.rb
Overview
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.
Abstract base class for mutant environments
Constant Summary collapse
- SEMANTICS_MESSAGE =
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.
"Fix your lib to follow normal ruby semantics!\n" \ '{Module,Class}#name should return resolvable constant name as String or nil'
Class Method Summary collapse
-
.empty(world, config) ⇒ Env
private
Construct minimal empty env.
Instance Method Summary collapse
-
#amount_mutations ⇒ Integer
private
Amount of mutations.
-
#amount_selected_tests ⇒ Integer
private
Amount of selected tests.
-
#amount_subjects ⇒ Integer
private
Amount of selected subjects.
-
#amount_total_tests ⇒ Integer
private
Amount of tests reachable by integration.
-
#kill(mutation) ⇒ Result::Mutation
private
Kill mutation.
-
#selected_tests ⇒ Set<Test>
private
Selected tests.
-
#selections ⇒ Object
private
The test selections.
-
#test_subject_ratio ⇒ Rational
private
Ratio between selected tests and subjects.
-
#warn(message) ⇒ self
private
Emit warning.
Class Method Details
.empty(world, config) ⇒ Env
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.
Construct minimal empty env
rubocop:disable Metrics/MethodLength
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/mutant/env.rb', line 29 def self.empty(world, config) new( config: config, integration: Integration::Null.new( expression_parser: config.expression_parser, timer: world.timer ), matchable_scopes: EMPTY_ARRAY, mutations: EMPTY_ARRAY, parser: Parser.new, selector: Selector::Null.new, subjects: EMPTY_ARRAY, world: world ) end |
Instance Method Details
#amount_mutations ⇒ Integer
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.
Amount of mutations
94 95 96 |
# File 'lib/mutant/env.rb', line 94 def amount_mutations mutations.length end |
#amount_selected_tests ⇒ Integer
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.
Amount of selected tests
118 119 120 |
# File 'lib/mutant/env.rb', line 118 def amount_selected_tests selected_tests.length end |
#amount_subjects ⇒ Integer
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.
Amount of selected subjects
110 111 112 |
# File 'lib/mutant/env.rb', line 110 def amount_subjects subjects.length end |
#amount_total_tests ⇒ Integer
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.
Amount of tests reachable by integration
102 103 104 |
# File 'lib/mutant/env.rb', line 102 def amount_total_tests integration.all_tests.length end |
#kill(mutation) ⇒ Result::Mutation
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.
Kill mutation
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/mutant/env.rb', line 51 def kill(mutation) start = timer.now tests = selections.fetch(mutation.subject) Result::Mutation.new( isolation_result: run_mutation_tests(mutation, tests), mutation: mutation, runtime: timer.now - start ) end |
#selected_tests ⇒ Set<Test>
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.
Selected tests
86 87 88 |
# File 'lib/mutant/env.rb', line 86 def selected_tests selections.values.flatten.to_set end |
#selections ⇒ 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.
The test selections
66 67 68 69 70 |
# File 'lib/mutant/env.rb', line 66 def selections subjects.map do |subject| [subject, selector.call(subject)] end.to_h end |
#test_subject_ratio ⇒ Rational
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.
Ratio between selected tests and subjects
126 127 128 129 130 |
# File 'lib/mutant/env.rb', line 126 def test_subject_ratio return Rational(0) if amount_subjects.zero? Rational(amount_selected_tests, amount_subjects) end |
#warn(message) ⇒ self
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.
Emit warning
78 79 80 81 |
# File 'lib/mutant/env.rb', line 78 def warn() config.reporter.warn() self end |