Class: Henitai::Mutant
- Inherits:
-
Object
- Object
- Henitai::Mutant
- Defined in:
- lib/henitai/mutant.rb,
lib/henitai/mutant/activator.rb
Overview
Represents a single syntactic mutation applied to a Subject.
A Mutant holds:
- the original and mutated AST nodes
- the operator that generated it
- the source location of the mutation
- its current status in the pipeline
Statuses follow the Stryker mutation-testing-report-schema vocabulary:
:pending, :killed, :survived, :timeout, :compile_error, :runtime_error,
:ignored, :no_coverage
Defined Under Namespace
Classes: Activator
Constant Summary collapse
- STATUSES =
Status-Vokabular folgt dem Stryker mutation-testing-report-schema. :equivalent ist ein Henitai-interner Status (wird im JSON als “Ignored” serialisiert, aber in der Scoring-Berechnung separat behandelt: confirmed equivalent mutants werden aus dem Nenner der MS-Berechnung herausgenommen).
%i[ pending killed survived timeout compile_error runtime_error ignored no_coverage equivalent ].freeze
Instance Attribute Summary collapse
-
#covered_by ⇒ Object
Returns the value of attribute covered_by.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#killing_test ⇒ Object
Returns the value of attribute killing_test.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#mutated_node ⇒ Object
readonly
Returns the value of attribute mutated_node.
-
#mutation_type ⇒ Object
readonly
Returns the value of attribute mutation_type.
-
#operator ⇒ Object
readonly
Returns the value of attribute operator.
-
#original_node ⇒ Object
readonly
Returns the value of attribute original_node.
-
#status ⇒ Object
Returns the value of attribute status.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
-
#tests_completed ⇒ Object
Returns the value of attribute tests_completed.
Instance Method Summary collapse
- #equivalent? ⇒ Boolean
- #ignored? ⇒ Boolean
-
#initialize(subject:, operator:, nodes:, description:, location:) ⇒ Mutant
constructor
A new instance of Mutant.
- #killed? ⇒ Boolean
- #pending? ⇒ Boolean
- #survived? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(subject:, operator:, nodes:, description:, location:) ⇒ Mutant
Returns a new instance of Mutant.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/henitai/mutant.rb', line 45 def initialize(subject:, operator:, nodes:, description:, location:) @id = SecureRandom.uuid @subject = subject @operator = operator @original_node = nodes.fetch(:original) @mutated_node = nodes.fetch(:mutated) @description = description @location = location @status = :pending @killing_test = nil @duration = nil @covered_by = nil @tests_completed = nil end |
Instance Attribute Details
#covered_by ⇒ Object
Returns the value of attribute covered_by.
38 39 40 |
# File 'lib/henitai/mutant.rb', line 38 def covered_by @covered_by end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
36 37 38 |
# File 'lib/henitai/mutant.rb', line 36 def description @description end |
#duration ⇒ Object
Returns the value of attribute duration.
38 39 40 |
# File 'lib/henitai/mutant.rb', line 38 def duration @duration end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
36 37 38 |
# File 'lib/henitai/mutant.rb', line 36 def id @id end |
#killing_test ⇒ Object
Returns the value of attribute killing_test.
38 39 40 |
# File 'lib/henitai/mutant.rb', line 38 def killing_test @killing_test end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
36 37 38 |
# File 'lib/henitai/mutant.rb', line 36 def location @location end |
#mutated_node ⇒ Object (readonly)
Returns the value of attribute mutated_node.
36 37 38 |
# File 'lib/henitai/mutant.rb', line 36 def mutated_node @mutated_node end |
#mutation_type ⇒ Object (readonly)
Returns the value of attribute mutation_type.
36 37 38 |
# File 'lib/henitai/mutant.rb', line 36 def mutation_type @mutation_type end |
#operator ⇒ Object (readonly)
Returns the value of attribute operator.
36 37 38 |
# File 'lib/henitai/mutant.rb', line 36 def operator @operator end |
#original_node ⇒ Object (readonly)
Returns the value of attribute original_node.
36 37 38 |
# File 'lib/henitai/mutant.rb', line 36 def original_node @original_node end |
#status ⇒ Object
Returns the value of attribute status.
38 39 40 |
# File 'lib/henitai/mutant.rb', line 38 def status @status end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
36 37 38 |
# File 'lib/henitai/mutant.rb', line 36 def subject @subject end |
#tests_completed ⇒ Object
Returns the value of attribute tests_completed.
38 39 40 |
# File 'lib/henitai/mutant.rb', line 38 def tests_completed @tests_completed end |
Instance Method Details
#equivalent? ⇒ Boolean
64 |
# File 'lib/henitai/mutant.rb', line 64 def equivalent? = @status == :equivalent |
#ignored? ⇒ Boolean
63 |
# File 'lib/henitai/mutant.rb', line 63 def ignored? = @status == :ignored |
#killed? ⇒ Boolean
60 |
# File 'lib/henitai/mutant.rb', line 60 def killed? = @status == :killed |
#pending? ⇒ Boolean
62 |
# File 'lib/henitai/mutant.rb', line 62 def pending? = @status == :pending |
#survived? ⇒ Boolean
61 |
# File 'lib/henitai/mutant.rb', line 61 def survived? = @status == :survived |
#to_s ⇒ Object
66 67 68 |
# File 'lib/henitai/mutant.rb', line 66 def to_s "#{operator}@#{location[:file]}:#{location[:start_line]} — #{description}" end |