summaryrefslogtreecommitdiff
path: root/spec/ruby/library/bigdecimal/core_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/bigdecimal/core_spec.rb')
-rw-r--r--spec/ruby/library/bigdecimal/core_spec.rb17
1 files changed, 10 insertions, 7 deletions
diff --git a/spec/ruby/library/bigdecimal/core_spec.rb b/spec/ruby/library/bigdecimal/core_spec.rb
index acee4dcf56..8f64fdf388 100644
--- a/spec/ruby/library/bigdecimal/core_spec.rb
+++ b/spec/ruby/library/bigdecimal/core_spec.rb
@@ -20,9 +20,12 @@ describe "Core extension by bigdecimal" do
describe "BigDecimal#log" do
it "handles high-precision Rational arguments" do
- result = BigDecimal('0.22314354220170971436137296411949880462556361100856391620766259404746040597133837784E0')
+ # log(BigDecimal(r, 50), 50)
+ result1 = BigDecimal('0.22314354220170971436137296411949880462556361100856e0')
+ # log(BigDecimal(r, 1000), 50)
+ result2 = BigDecimal('0.22314354220170971436137296411949880462556361100853e0')
r = Rational(1_234_567_890, 987_654_321)
- BigMath.log(r, 50).should == result
+ [result1, result2].should.include?(BigMath.log(r, 50).mult(1, 50))
end
end
@@ -30,15 +33,15 @@ describe "Core extension by bigdecimal" do
it "returns the passed argument, self as Float, when given a Float" do
result = Rational(3, 4).coerce(1.0)
result.should == [1.0, 0.75]
- result.first.is_a?(Float).should be_true
- result.last.is_a?(Float).should be_true
+ result.first.is_a?(Float).should == true
+ result.last.is_a?(Float).should == true
end
it "returns the passed argument, self as Rational, when given an Integer" do
result = Rational(3, 4).coerce(10)
result.should == [Rational(10, 1), Rational(3, 4)]
- result.first.is_a?(Rational).should be_true
- result.last.is_a?(Rational).should be_true
+ result.first.is_a?(Rational).should == true
+ result.last.is_a?(Rational).should == true
end
it "coerces to Rational, when given a Complex" do
@@ -53,7 +56,7 @@ describe "Core extension by bigdecimal" do
it "raises an error when passed a BigDecimal" do
-> {
Rational(500, 3).coerce(BigDecimal('166.666666666'))
- }.should raise_error(TypeError, /BigDecimal can't be coerced into Rational/)
+ }.should.raise(TypeError, /BigDecimal can't be coerced into Rational/)
end
end
end