Class: Mutant::Mutation
- Inherits:
-
Object
- Object
- Mutant::Mutation
- Includes:
- AbstractType, Adamantium::Flat
- Defined in:
- lib/mutant/mutation.rb
Overview
Represent a mutated node with its subject
Defined Under Namespace
Constant Summary collapse
- CODE_DELIMITER =
"\0".freeze
- CODE_RANGE =
(0..4).freeze
Class Method Summary collapse
-
.success?(test_result) ⇒ Boolean
private
Test if mutation is killed by test reports.
Instance Method Summary collapse
-
#code ⇒ String
private
Mutation code.
-
#identification ⇒ String
private
Identification string.
-
#insert ⇒ self
private
Insert mutated node.
-
#original_source ⇒ String
private
Normalized original source.
-
#source ⇒ String
private
Normalized mutation source.
Class Method Details
.success?(test_result) ⇒ Boolean
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.
Test if mutation is killed by test reports
56 57 58 |
# File 'lib/mutant/mutation.rb', line 56 def self.success?(test_result) self::TEST_PASS_SUCCESS.equal?(test_result.passed) end |
Instance Method Details
#code ⇒ String
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.
Mutation code
25 26 27 |
# File 'lib/mutant/mutation.rb', line 25 def code sha1[CODE_RANGE] end |
#identification ⇒ String
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.
Identification string
15 16 17 |
# File 'lib/mutant/mutation.rb', line 15 def identification "#{self.class::SYMBOL}:#{subject.identification}:#{code}" end |
#insert ⇒ 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.
Insert mutated node
65 66 67 68 69 |
# File 'lib/mutant/mutation.rb', line 65 def insert subject.prepare Loader::Eval.call(root, subject) self end |
#original_source ⇒ String
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.
Normalized original source
45 46 47 |
# File 'lib/mutant/mutation.rb', line 45 def original_source subject.source end |
#source ⇒ String
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.
Normalized mutation source
35 36 37 |
# File 'lib/mutant/mutation.rb', line 35 def source Unparser.unparse(node) end |