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-3.2.2 spec/framework_spec/app/spec/shared/complex/numeric/arg.rb
rhodes-3.2.2.beta spec/framework_spec/app/spec/shared/complex/numeric/arg.rb
rhodes-3.2.1 spec/framework_spec/app/spec/shared/complex/numeric/arg.rb
rhodes-3.2.0 spec/framework_spec/app/spec/shared/complex/numeric/arg.rb
rhodes-3.2.0.beta.9 spec/framework_spec/app/spec/shared/complex/numeric/arg.rb
rhodes-3.2.0.beta.8 spec/framework_spec/app/spec/shared/complex/numeric/arg.rb
rhodes-3.2.0.beta.7 spec/framework_spec/app/spec/shared/complex/numeric/arg.rb
rhodes-3.2.0.beta.6 spec/framework_spec/app/spec/shared/complex/numeric/arg.rb
rhodes-3.2.0.beta.5 spec/framework_spec/app/spec/shared/complex/numeric/arg.rb
rhodes-3.2.0.beta.4 spec/framework_spec/app/spec/shared/complex/numeric/arg.rb
rhodes-3.2.0.beta.2 spec/framework_spec/app/spec/shared/complex/numeric/arg.rb
rhodes-3.2.0.beta.1 spec/framework_spec/app/spec/shared/complex/numeric/arg.rb