Class: TestDiff::TestInfo

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/test_diff/test_info.rb

Overview

class used to hold infomation about the test

Constant Summary collapse

FIXNUM_MAX =
(2**(0.size * 8 - 2) - 1)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(f, et) ⇒ TestInfo

Returns a new instance of TestInfo.



9
10
11
12
# File 'lib/test_diff/test_info.rb', line 9

def initialize(f, et)
  @filename = f
  @execution_time = et
end

Instance Attribute Details

#execution_timeObject (readonly)

Returns the value of attribute execution_time.



6
7
8
# File 'lib/test_diff/test_info.rb', line 6

def execution_time
  @execution_time
end

#filenameObject (readonly)

Returns the value of attribute filename.



6
7
8
# File 'lib/test_diff/test_info.rb', line 6

def filename
  @filename
end

Instance Method Details

#<=>(other) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/test_diff/test_info.rb', line 18

def <=>(other)
  if compare_execution_time == other.compare_execution_time
    filename <=> other.filename
  else
    compare_execution_time <=> other.compare_execution_time
  end
end

#compare_execution_timeObject



14
15
16
# File 'lib/test_diff/test_info.rb', line 14

def compare_execution_time
  @execution_time || FIXNUM_MAX
end