Sha256: e6e94a4cd00bf80624d1e514c32fef0c660c20fae107fa96e4ec7c22a14e8a51
Contents?: true
Size: 1.11 KB
Versions: 83
Compression:
Stored size: 1.11 KB
Contents
require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/../../spec_helper' describe "Fixnum#quo" do it "returns the result of self divided by the given Integer as a Float" do 2.quo(2.5).should == 0.8 5.quo(2).should == 2.5 45.quo(bignum_value).should be_close(1.04773789668636e-08, TOLERANCE) end conflicts_with :Rational do it "does not raise a ZeroDivisionError when the given Integer is 0" do 0.quo(0).to_s.should == "NaN" 10.quo(0).to_s.should == "Infinity" -10.quo(0).to_s.should == "-Infinity" end end it "does not raise a FloatDomainError when the given Integer is 0 and a Float" do 0.quo(0.0).to_s.should == "NaN" 10.quo(0.0).to_s.should == "Infinity" -10.quo(0.0).to_s.should == "-Infinity" end conflicts_with :Rational do it "raises a TypeError when given a non-Integer" do lambda { (obj = mock('x')).should_not_receive(:to_int) 13.quo(obj) }.should raise_error(TypeError) lambda { 13.quo("10") }.should raise_error(TypeError) lambda { 13.quo(:symbol) }.should raise_error(TypeError) end end end
Version data entries
83 entries across 83 versions & 1 rubygems