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