summaryrefslogtreecommitdiff
path: root/spec/ruby/library/bigdecimal/to_r_spec.rb
diff options
context:
space:
mode:
authorBenoit Daloze <[email protected]>2022-08-29 15:36:29 +0200
committerBenoit Daloze <[email protected]>2022-08-29 15:36:29 +0200
commit4ee1a687768338a1928014fc6042c320a1a1af3e (patch)
tree37c1717dcd7a2a757e343a41b827fd096397fbca /spec/ruby/library/bigdecimal/to_r_spec.rb
parenta319d3cfdc1afef8497321fee7f690052b16739c (diff)
Update to ruby/spec@d01709f
Diffstat (limited to 'spec/ruby/library/bigdecimal/to_r_spec.rb')
-rw-r--r--spec/ruby/library/bigdecimal/to_r_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/ruby/library/bigdecimal/to_r_spec.rb b/spec/ruby/library/bigdecimal/to_r_spec.rb
index 91d2b33993..c350beff08 100644
--- a/spec/ruby/library/bigdecimal/to_r_spec.rb
+++ b/spec/ruby/library/bigdecimal/to_r_spec.rb
@@ -13,4 +13,16 @@ describe "BigDecimal#to_r" do
r.denominator.should eql(1000000000000000000000000)
end
+ it "returns a Rational from a BigDecimal with an exponent" do
+ r = BigDecimal("1E2").to_r
+ r.numerator.should eql(100)
+ r.denominator.should eql(1)
+ end
+
+ it "returns a Rational from a negative BigDecimal with an exponent" do
+ r = BigDecimal("-1E2").to_r
+ r.numerator.should eql(-100)
+ r.denominator.should eql(1)
+ end
+
end