aboutsummaryrefslogtreecommitdiff
path: root/test/tc_mauve_configuration.rb
blob: bbc19014e8ecbb5a0870fe53497a1c553afe78c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
$:.unshift "../lib/"

require 'th_mauve'
require 'mauve/configuration'

class TcMauveConfiguration < Mauve::UnitTest
  include Mauve

  def setup
    setup_logger
  end

  def teardown
    teardown_logger
  end

  def test_do_parse_range
    [
      [[1.0...2.0], 1],
      [[1.0...3.0], 1..2],
      [[1.0...2.0], 1...2],
      [[1.0...2.0, 4.0...7.0],  [1, 4..6]],
      [[1.0..1.0], 1.0],
      [[1.0..2.0], 1.0..2.0],
      [[1.0...2.0], 1.0...2.0],
      [[1.0..1.0, 4.0..6.0],  [1.0, 4.0..6.0]],
      [[7.0...24.0, 0.0...7.0], 7..6],
      [[6.0...7.0, 0.0...1.0], 6..0, 0...7],
      [["x".."z", "a".."c"], "x".."c", "a".."z"]
    ].each do |output, *input|
      c = Configuration.new
      assert_equal(output, c.__send__("do_parse_range",*input))
    end
  end

end