Sha256: 5add2af9dee2283dcfd312aac21b3311b66c6950066699523257689fb415fb89
Contents?: true
Size: 1.34 KB
Versions: 6
Compression:
Stored size: 1.34 KB
Contents
require 'spec_helper' describe OData4::Properties::Float do describe 'double precision' do let(:subject) { OData4::Properties::Double.new('Float', '678.90325') } it { expect(subject.type).to eq('Edm.Double') } it { expect(subject.value).to eq(678.90325) } it { expect { subject.value = (1.7 * (10**308) * 2) }.to raise_error(ArgumentError) } it { expect { subject.value = (-1.7 * (10**308) * 2) }.to raise_error(ArgumentError) } it { expect(lambda { subject.value = '19.89043256' subject.value }.call).to eq(19.89043256) } it { expect(lambda { subject.value = 19.89043256 subject.value }.call).to eq(19.89043256) } end describe 'single precision' do let(:subject) { OData4::Properties::Single.new('Float', '678.90325') } it { expect(subject.type).to eq('Edm.Single') } it { expect(subject.value).to eq(678.90325) } it { expect(subject.url_value).to eq('678.90325F') } it { expect { subject.value = (3.4 * (10**38) * 2) }.to raise_error(ArgumentError) } it { expect { subject.value = (-3.4 * (10**38) * 2) }.to raise_error(ArgumentError) } it { expect(lambda { subject.value = '19.89043256' subject.value }.call).to eq(19.89043256) } it { expect(lambda { subject.value = 19.89043256 subject.value }.call).to eq(19.89043256) } end end
Version data entries
6 entries across 6 versions & 1 rubygems