Class: Evilution::Result::MutationResult Private

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/result/mutation_result.rb

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.

Constant Summary collapse

STATUSES =

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.

%i[killed survived timeout error neutral equivalent unresolved unparseable].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mutation:, status:, duration: 0.0, killing_test: nil, test_command: nil, memory: nil, error: nil) ⇒ MutationResult

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.

Returns a new instance of MutationResult.

Raises:

  • (ArgumentError)


12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/evilution/result/mutation_result.rb', line 12

def initialize(mutation:, status:, duration: 0.0, killing_test: nil,
               test_command: nil, memory: nil, error: nil)
  raise ArgumentError, "invalid status: #{status}" unless STATUSES.include?(status)

  @mutation = mutation
  @status = status
  @duration = duration
  @killing_test = killing_test
  @test_command = test_command
  @memory = memory
  @error = error
  freeze
end

Instance Attribute Details

#durationObject (readonly)

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.



10
11
12
# File 'lib/evilution/result/mutation_result.rb', line 10

def duration
  @duration
end

#errorObject (readonly)

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.



10
11
12
# File 'lib/evilution/result/mutation_result.rb', line 10

def error
  @error
end

#killing_testObject (readonly)

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.



10
11
12
# File 'lib/evilution/result/mutation_result.rb', line 10

def killing_test
  @killing_test
end

#memoryObject (readonly)

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.



10
11
12
# File 'lib/evilution/result/mutation_result.rb', line 10

def memory
  @memory
end

#mutationObject (readonly)

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.



10
11
12
# File 'lib/evilution/result/mutation_result.rb', line 10

def mutation
  @mutation
end

#statusObject (readonly)

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.



10
11
12
# File 'lib/evilution/result/mutation_result.rb', line 10

def status
  @status
end

#test_commandObject (readonly)

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.



10
11
12
# File 'lib/evilution/result/mutation_result.rb', line 10

def test_command
  @test_command
end

Instance Method Details

#child_rss_kbObject

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.

Positive type checks, not nil checks. EV-s5br / GH #1174: the nil_replacement mutator can swap a nil default into false (or some other non-typed value), and nil? then returns false, sending a missing method to the wrong receiver and crashing the parent worker. Asking the field explicitly whether it is the expected struct keeps the parent process alive and lets the mutation count as a measured (errored) result.



32
33
34
# File 'lib/evilution/result/mutation_result.rb', line 32

def child_rss_kb
  @memory.is_a?(Evilution::Result::MemoryStats) ? @memory.child_rss_kb : nil
end

#equivalent?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.

Returns:

  • (Boolean)


76
77
78
# File 'lib/evilution/result/mutation_result.rb', line 76

def equivalent?
  status == :equivalent
end

#error?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.

Returns:

  • (Boolean)


68
69
70
# File 'lib/evilution/result/mutation_result.rb', line 68

def error?
  status == :error
end

#error_backtraceObject

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.



52
53
54
# File 'lib/evilution/result/mutation_result.rb', line 52

def error_backtrace
  @error.is_a?(Evilution::Result::ErrorInfo) ? @error.backtrace : nil
end

#error_classObject

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.



48
49
50
# File 'lib/evilution/result/mutation_result.rb', line 48

def error_class
  @error.is_a?(Evilution::Result::ErrorInfo) ? @error.klass : nil
end

#error_messageObject

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.



44
45
46
# File 'lib/evilution/result/mutation_result.rb', line 44

def error_message
  @error.is_a?(Evilution::Result::ErrorInfo) ? @error.message : nil
end

#killed?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.

Returns:

  • (Boolean)


56
57
58
# File 'lib/evilution/result/mutation_result.rb', line 56

def killed?
  status == :killed
end

#memory_delta_kbObject

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.



36
37
38
# File 'lib/evilution/result/mutation_result.rb', line 36

def memory_delta_kb
  @memory.is_a?(Evilution::Result::MemoryStats) ? @memory.memory_delta_kb : nil
end

#neutral?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.

Returns:

  • (Boolean)


72
73
74
# File 'lib/evilution/result/mutation_result.rb', line 72

def neutral?
  status == :neutral
end

#parent_rss_kbObject

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.



40
41
42
# File 'lib/evilution/result/mutation_result.rb', line 40

def parent_rss_kb
  @memory.is_a?(Evilution::Result::MemoryStats) ? @memory.parent_rss_kb : nil
end

#survived?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.

Returns:

  • (Boolean)


60
61
62
# File 'lib/evilution/result/mutation_result.rb', line 60

def survived?
  status == :survived
end

#timeout?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.

Returns:

  • (Boolean)


64
65
66
# File 'lib/evilution/result/mutation_result.rb', line 64

def timeout?
  status == :timeout
end

#unparseable?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.

Returns:

  • (Boolean)


84
85
86
# File 'lib/evilution/result/mutation_result.rb', line 84

def unparseable?
  status == :unparseable
end

#unresolved?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.

Returns:

  • (Boolean)


80
81
82
# File 'lib/evilution/result/mutation_result.rb', line 80

def unresolved?
  status == :unresolved
end