Sha256: 6443b62093396f0bfbb1b2aabdefc269f42da4eb90e6b70fd5e5845f4a2d7d95

Contents?: true

Size: 692 Bytes

Versions: 23

Compression:

Stored size: 692 Bytes

Contents

require 'spec_helper'

describe 'Number#to_i' do
  it "should not change huge number" do
    1504642339053716000000.to_i.should == 1504642339053716000000
  end

  it "should not change negative huge number" do
    -1504642339053716000000.to_i.should == -1504642339053716000000
  end

  it "equals Number#truncate(0) with huge number" do
    1504642339053716000000.to_i.should == 1504642339053716000000.truncate(0)
  end

  it "should not change Infinity" do
    `Infinity`.to_i.should == `Infinity`
  end

  it "should not change -Infinity" do
    `-Infinity`.to_i.should == `-Infinity`
  end

  it "should not change NaN" do
    x = `NaN`.to_i
    `Number.isNaN(x)`.should be_true
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
opal-1.7.4 spec/opal/core/number/to_i_spec.rb
opal-1.7.3 spec/opal/core/number/to_i_spec.rb
opal-1.7.2 spec/opal/core/number/to_i_spec.rb
opal-1.7.1 spec/opal/core/number/to_i_spec.rb
opal-1.7.0 spec/opal/core/number/to_i_spec.rb
opal-1.7.0.rc1 spec/opal/core/number/to_i_spec.rb
opal-1.6.1 spec/opal/core/number/to_i_spec.rb
opal-1.6.0 spec/opal/core/number/to_i_spec.rb
opal-1.6.0.rc1 spec/opal/core/number/to_i_spec.rb
opal-1.6.0.alpha1 spec/opal/core/number/to_i_spec.rb
opal-1.5.1 spec/opal/core/number/to_i_spec.rb
opal-1.5.0 spec/opal/core/number/to_i_spec.rb
opal-1.5.0.rc1 spec/opal/core/number/to_i_spec.rb
opal-1.4.1 spec/opal/core/number/to_i_spec.rb
opal-1.4.0 spec/opal/core/number/to_i_spec.rb
opal-1.4.0.alpha1 spec/opal/core/number/to_i_spec.rb
opal-1.3.2 spec/opal/core/number/to_i_spec.rb
opal-1.3.1 spec/opal/core/number/to_i_spec.rb
opal-1.3.0 spec/opal/core/number/to_i_spec.rb
opal-1.3.0.rc1 spec/opal/core/number/to_i_spec.rb