Module: RangeArray::Etest

Defined in:
lib/vex/base/range_array.rb

Instance Method Summary collapse

Instance Method Details

#ra(*array) ⇒ Object



28
29
30
# File 'lib/vex/base/range_array.rb', line 28

def ra(*array)
  RangeArray.new array
end

#test_range_arrayObject



32
33
34
35
36
37
38
39
# File 'lib/vex/base/range_array.rb', line 32

def test_range_array
  assert_equal [1..3],                        ra(1, 2, 3)
  assert_equal [1..3, 5..6],                  ra(1, 2, 3, 5, 6)
  assert_equal [1..3, 5..6, 8],               ra(1, 2, 3, 5, 6, 8)
  assert_equal [1..2, 7, 3, 5..6, 8],         ra(1, 2, 7, 3, 5, 6, 8)
  assert_equal [1..2, 7, 3, 5..6, 8, 4],      ra(1, 2, 7, 3, 5, 6, 8, 4)
  assert_equal [1..2, 7, 3, 5..6, 8, 4, -3],  ra(1, 2, 7, 3, 5, 6, 8, 4, -3)
end