Sha256: 4c1588e43cba2c6de6b8902b61ccdf1feea95463445e5587ea3903f1b9115e61
Contents?: true
Size: 766 Bytes
Versions: 3
Compression:
Stored size: 766 Bytes
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Parsing::PositiveFloatParser do parser = Parsing::PositiveFloatParser.new ["2e2","1.0","0.50","05.003e-10","1.555e+2","3.443214","0.001","0000.0030000"].each do |str| res = parser.parse(str) f = str.to_f it "should parse '#{str}'" do res.should_not be nil end it 'should return node that is convertible to float using #to_f method' do res.to_f.should eq(f) end it 'should return node that is convertible to float using #to_num method' do res.to_num.should eq(f) end end ["-2.0","-1.55e-2","0.0","0e1"].each do |str| it "should not parse '#{str}'" do parser.should_not parse(str) end end end
Version data entries
3 entries across 3 versions & 1 rubygems