Class: Mutant::Mutation
- Inherits:
-
Object
- Object
- Mutant::Mutation
- Includes:
- AbstractType, Adamantium::Flat
- Defined in:
- lib/mutant/mutation.rb,
lib/mutant/mutation/evil.rb,
lib/mutant/mutation/neutral.rb
Overview
Represent a mutated node with its subject
Defined Under Namespace
Constant Summary collapse
- CODE_DELIMITER =
"\0".freeze
- CODE_RANGE =
(0..4).freeze
Instance Method Summary collapse
-
#code ⇒ String
private
Return mutation code.
-
#identification ⇒ String
private
Return identification.
-
#insert ⇒ self
private
Insert mutated node.
-
#original_source ⇒ String
private
Return original source.
-
#root ⇒ Parser::AST::Node
private
Return mutated root node.
-
#should_fail? ⇒ Boolean
private
Test if test should fail under mutation.
-
#source ⇒ String
private
Return source.
-
#success? ⇒ true, false
private
Test if killer is successful.
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.
Return mutation code
70 71 72 |
# File 'lib/mutant/mutation.rb', line 70 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.
Return identification
59 60 61 |
# File 'lib/mutant/mutation.rb', line 59 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
FIXME: Cache subject visibility in a better way! Ideally dont mutate it
implicitly. Also subject.public? should NOT be a public interface it
is a detail of method mutations.
47 48 49 50 51 |
# File 'lib/mutant/mutation.rb', line 47 def insert subject.public? 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.
Return original source
92 93 94 |
# File 'lib/mutant/mutation.rb', line 92 def original_source subject.source end |
#root ⇒ Parser::AST::Node
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.
Return mutated root node
18 19 20 |
# File 'lib/mutant/mutation.rb', line 18 def root subject.root(node) end |
#should_fail? ⇒ 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 test should fail under mutation
102 103 104 |
# File 'lib/mutant/mutation.rb', line 102 def should_fail? self.class::SHOULD_FAIL 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.
Return source
81 82 83 |
# File 'lib/mutant/mutation.rb', line 81 def source Unparser.unparse(node) end |
#success? ⇒ true, false
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 killer is successful
35 |
# File 'lib/mutant/mutation.rb', line 35 abstract_method :success? |