mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@e81b3cd
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0f64776745
commit
a28aa80c73
53 changed files with 932 additions and 106 deletions
|
@ -13,6 +13,8 @@ describe "BigDecimal#sub" do
|
|||
@one_minus = BigDecimal("-1")
|
||||
@frac_1 = BigDecimal("1E-99999")
|
||||
@frac_2 = BigDecimal("0.9E-99999")
|
||||
@frac_3 = BigDecimal("12345E10")
|
||||
@frac_4 = BigDecimal("98765E10")
|
||||
end
|
||||
|
||||
it "returns a - b with given precision" do
|
||||
|
@ -32,6 +34,14 @@ describe "BigDecimal#sub" do
|
|||
@frac_1.sub(@frac_1, 1000000).should == @zero
|
||||
end
|
||||
|
||||
describe "with Object" do
|
||||
it "tries to coerce the other operand to self" do
|
||||
object = mock("Object")
|
||||
object.should_receive(:coerce).with(@frac_3).and_return([@frac_3, @frac_4])
|
||||
@frac_3.sub(object, 1).should == BigDecimal("-0.9E15")
|
||||
end
|
||||
end
|
||||
|
||||
it "returns NaN if NaN is involved" do
|
||||
@one.sub(@nan, 1).nan?.should == true
|
||||
@nan.sub(@one, 1).nan?.should == true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue