Class: Mutant::Reporter::Stats

Inherits:
Object
  • Object
show all
Defined in:
lib/mutant/reporter/stats.rb

Overview

Stats gathered while reporter is running

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeundefined

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.

Initialize object



53
54
55
56
# File 'lib/mutant/reporter/stats.rb', line 53

def initialize
  @start = Time.now
  @noop_fails = @subjects = @mutations = @kills = @time = 0
end

Instance Attribute Details

#killsFixnum (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.

Return kill count

Returns:

  • (Fixnum)


37
38
39
# File 'lib/mutant/reporter/stats.rb', line 37

def kills
  @kills
end

#mutationsFixnum (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.

Return mutation count

Returns:

  • (Fixnum)


21
22
23
# File 'lib/mutant/reporter/stats.rb', line 21

def mutations
  @mutations
end

#noop_failsFixnum (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.

Return skip count

Returns:

  • (Fixnum)


29
30
31
# File 'lib/mutant/reporter/stats.rb', line 29

def noop_fails
  @noop_fails
end

#subjectsFixnum (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.

Return subject count

Returns:

  • (Fixnum)


13
14
15
# File 'lib/mutant/reporter/stats.rb', line 13

def subjects
  @subjects
end

#timeFloat (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.

Return mutation runtime

Returns:

  • (Float)


45
46
47
# File 'lib/mutant/reporter/stats.rb', line 45

def time
  @time
end

Instance Method Details

#aliveFixnum

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 number of mutants alive

Returns:

  • (Fixnum)


85
86
87
# File 'lib/mutant/reporter/stats.rb', line 85

def alive
  @mutations - @kills
end

#killer(killer) ⇒ 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.

Count killer

Parameters:

Returns:

  • (self)


111
112
113
114
115
116
# File 'lib/mutant/reporter/stats.rb', line 111

def killer(killer)
  @mutations +=1
  @kills +=1 unless killer.fail?
  @time += killer.runtime
  self
end

#noop_fail(killer) ⇒ 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.

Count noop mutation fail

Parameters:

Returns:

  • (self)


97
98
99
100
101
# File 'lib/mutant/reporter/stats.rb', line 97

def noop_fail(killer)
  @noop_fails += 1
  @time += killer.runtime
  self
end

#runtimeFloat

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 runtime in seconds

Returns:

  • (Float)


64
65
66
# File 'lib/mutant/reporter/stats.rb', line 64

def runtime
  Time.now - @start
end

#subjectself

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.

Count subject

Returns:

  • (self)


74
75
76
77
# File 'lib/mutant/reporter/stats.rb', line 74

def subject
  @subjects +=1
  self
end