Class: TestInterval

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
test/test_util/interval.rb

Defined Under Namespace

Classes: Stub, StubSession

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



32
33
34
35
36
37
38
# File 'test/test_util/interval.rb', line 32

def setup
  @model = [
  'abc', 'def', 'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz0', '123',
  ]
  @session = StubSession.new
  @interval = Stub.new(@session, @model)
end

- (Object) test_default_interval1



49
50
51
52
# File 'test/test_util/interval.rb', line 49

def test_default_interval1
  ad = 'a-d'
  assert_equal(ad, @interval.default_interval)
end

- (Object) test_default_interval2



53
54
55
56
57
58
59
# File 'test/test_util/interval.rb', line 53

def test_default_interval2
  @interval.model = [
    'ghi', 'jkl', 'mno', 'pqr', 'stu', 'vwx', 'yz0', '123',
  ]
  eh = 'e-h'
  assert_equal(eh, @interval.default_interval)
end

- (Object) test_empty_range_patterns



60
61
62
63
# File 'test/test_util/interval.rb', line 60

def test_empty_range_patterns
  @interval.model = []
  assert_not_nil(@interval.default_interval)
end

- (Object) test_get_intervals



39
40
41
42
43
44
45
46
47
48
# File 'test/test_util/interval.rb', line 39

def test_get_intervals
  assert_equal(7, @interval.get_intervals.size)
  @interval.model = [ 'abc' ]
  assert_equal(1, @interval.get_intervals.size)
  ad = 'a-d'
  assert_equal(ad, @interval.get_intervals.first)
  @interval.model = [ 'abc', '123' ]
  assert_equal(2, @interval.get_intervals.size)
  assert_equal([ad, '|unknown'], @interval.get_intervals)
end