Sha256: edf51f7f1d8db9fd7c2108181d7e4ed4b0010b13b6d3e72b211dc06f66cb79b4

Contents?: true

Size: 721 Bytes

Versions: 6

Compression:

Stored size: 721 Bytes

Contents

# backtick_javascript: true

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

6 entries across 6 versions & 1 rubygems

Version Path
opal-1.8.3.rc1 spec/opal/core/number/to_i_spec.rb
opal-1.8.2 spec/opal/core/number/to_i_spec.rb
opal-1.8.1 spec/opal/core/number/to_i_spec.rb
opal-1.8.0 spec/opal/core/number/to_i_spec.rb
opal-1.8.0.beta1 spec/opal/core/number/to_i_spec.rb
opal-1.8.0.alpha1 spec/opal/core/number/to_i_spec.rb