Sha256: f40926246313227f02767fea06c141865822cfa07b322bb538ec699619688d91

Contents?: true

Size: 1.02 KB

Versions: 52

Compression:

Stored size: 1.02 KB

Contents

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

describe :numeric_arg, :shared => true do
  before(:each) do
    @numbers = [
      20,             # Integer
      398.72,         # Float
      Rational(3, 4), # Rational
      99999999**99, # Bignum
      Float::MAX * 2, # Infinity
    ]
  end

  it "returns 0 if positive" do
    @numbers.each do |number|
      number.send(@method).should == 0
    end
  end

  ruby_bug "#1715", "1.8.6.369" do
    it "returns NaN if self is NaN" do
      (-nan_value).send(@method).nan?.should be_true
      nan_value.send(@method).nan?.should be_true
    end
  end

  it "returns Pi if negative" do
    @numbers.each do |number|
      (0-number).send(@method).should == Math::PI
    end
  end

  # This was established in r23960
  it "returns Pi if -0.0" do
    (-0.0).send(@method).should == Math::PI
  end

  it "raises an ArgumentError if given any arguments" do
   @numbers.each do |number|
     lambda { number.send(@method, number) }.should raise_error(ArgumentError)
   end
  end
end

Version data entries

52 entries across 52 versions & 2 rubygems

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