Sha256: 929eda9d1a342c0cf621ca0e915cd2fff3e5d0caf8113079bc2bbaa332deca5d

Contents?: true

Size: 807 Bytes

Versions: 9

Compression:

Stored size: 807 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe Parsing::SegmentParser do
  parser = Parsing::SegmentParser.new

  cases = {
    "ints" => ["0...4",0...4],
    "plain floats" => ["0.0..4.0",0.0...4.0],
    "sci floats" => ["1.3e-10...5",1.3e-10...5],
    "int/float" => ["45..46.5",45...46.5],
    "float/int" => ["4.5...5",4.5...5],
    "rationals" => ["2/3..3/2",Rational(2,3)...Rational(3,2)],
    "float/rational" => ["3.5..10/6",3.5...Rational(10,6)]
  }.each do |descr,str_tgt|
    context descr do
      str,tgt = str_tgt
      res = parser.parse(str)
      it 'should parse' do
        res.should_not be nil
      end
      
      it 'should return node that converts to exclusive range via #to_range' do
        res.to_range.should eq tgt
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
music-transcription-0.21.0 spec/parsing/segment_parsing_spec.rb
music-transcription-0.20.0 spec/parsing/segment_parsing_spec.rb
music-transcription-0.19.0 spec/parsing/segment_parsing_spec.rb
music-transcription-0.17.1 spec/parsing/segment_parsing_spec.rb
music-transcription-0.17.0 spec/parsing/segment_parsing_spec.rb
music-transcription-0.16.0 spec/parsing/segment_parsing_spec.rb
music-transcription-0.15.0 spec/parsing/segment_parsing_spec.rb
music-transcription-0.14.0 spec/parsing/segment_parsing_spec.rb
music-transcription-0.13.0 spec/parsing/segment_parsing_spec.rb