Sha256: f90d53da6d345fbe60c3b80a5c7642ad07659ec7c077b1bc1fe2ea98b1f76962

Contents?: true

Size: 828 Bytes

Versions: 52

Compression:

Stored size: 828 Bytes

Contents

require File.expand_path('../../../spec_helper', __FILE__)

ruby_version_is "1.9" do
  describe "Numeric#abs2" do
    before(:each) do
      @numbers = [
        0,
        0.0,
        1,
        20,
        bignum_value,
        278202.292871,
        72829,
        3.333333333333,
        0.1,
        1/0.0
      ].map { |n| [-n, n] }.flatten
    end
if System.get_property('platform') != 'APPLE'
    it "returns the square of the absolute value of self" do
      @numbers.each do |number|
        number.abs2.should eql(number.abs ** 2)
      end
    end
end
    it "calls #* on self" do
      number = mock_numeric('numeric')
      number.should_receive(:*).and_return(:result)
      number.abs2.should == :result
    end

    it "returns NaN when self is NaN" do
      (0/0.0).abs2.nan?.should be_true
    end
  end
end

Version data entries

52 entries across 52 versions & 2 rubygems

Version Path
rhodes-7.6.0 spec/framework_spec/app/spec/core/numeric/abs2_spec.rb
rhodes-7.5.1 spec/framework_spec/app/spec/core/numeric/abs2_spec.rb
rhodes-7.4.1 spec/framework_spec/app/spec/core/numeric/abs2_spec.rb
rhodes-7.1.17 spec/framework_spec/app/spec/core/numeric/abs2_spec.rb
rhodes-6.2.0 spec/framework_spec/app/spec/core/numeric/abs2_spec.rb
rhodes-6.0.11 spec/framework_spec/app/spec/core/numeric/abs2_spec.rb
rhodes-5.5.18 spec/framework_spec/app/spec/core/numeric/abs2_spec.rb
rhodes-5.5.17 spec/framework_spec/app/spec/core/numeric/abs2_spec.rb
rhodes-5.5.15 spec/framework_spec/app/spec/core/numeric/abs2_spec.rb
rhodes-5.5.0.22 spec/framework_spec/app/spec/core/numeric/abs2_spec.rb
rhodes-5.5.2 spec/framework_spec/app/spec/core/numeric/abs2_spec.rb
rhodes-5.5.0.7 spec/framework_spec/app/spec/core/numeric/abs2_spec.rb
rhodes-5.5.0.3 spec/framework_spec/app/spec/core/numeric/abs2_spec.rb
rhodes-5.5.0 spec/framework_spec/app/spec/core/numeric/abs2_spec.rb
tauplatform-1.0.3 spec/framework_spec/app/spec/core/numeric/abs2_spec.rb
tauplatform-1.0.2 spec/framework_spec/app/spec/core/numeric/abs2_spec.rb
tauplatform-1.0.1 spec/framework_spec/app/spec/core/numeric/abs2_spec.rb
rhodes-3.5.1.12 spec/framework_spec/app/spec/core/numeric/abs2_spec.rb
rhodes-3.3.5 spec/framework_spec/app/spec/core/numeric/abs2_spec.rb
rhodes-3.4.2 spec/framework_spec/app/spec/core/numeric/abs2_spec.rb