aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorKenta Murata <mrkn@mrkn.jp>2021-01-12 22:51:29 +0900
committerKenta Murata <mrkn@mrkn.jp>2021-01-13 01:58:23 +0900
commit2175c2c957a711f1c48f42d38db202bf52c8bc6f (patch)
treee7a867f43a15ef5fb92a050c5c2f98a8689459fb /test
parent6670de82c2d7a1449412bf6629aa01cc8ecb35e2 (diff)
downloadruby-2175c2c957a711f1c48f42d38db202bf52c8bc6f.tar.gz
[ruby/bigdecimal] Use pre-allocated objects for special values
https://github.com/ruby/bigdecimal/commit/95c201f2d3
Diffstat (limited to 'test')
-rw-r--r--test/bigdecimal/test_bigdecimal.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb
index b15b046f4c..e8fd85a526 100644
--- a/test/bigdecimal/test_bigdecimal.rb
+++ b/test/bigdecimal/test_bigdecimal.rb
@@ -150,17 +150,23 @@ class TestBigDecimal < Test::Unit::TestCase
assert_raise(ArgumentError) { BigDecimal(0.1, Float::DIG + 2) }
assert_nothing_raised { BigDecimal(0.1, Float::DIG + 1) }
+ assert_same(BigDecimal(0.0), BigDecimal(0.0))
+ assert_same(BigDecimal(-0.0), BigDecimal(-0.0))
+
bug9214 = '[ruby-core:58858]'
- assert_equal(BigDecimal(-0.0, Float::DIG).sign, -1, bug9214)
+ assert_equal(BigDecimal(-0.0).sign, -1, bug9214)
BigDecimal.save_exception_mode do
BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false)
assert_nan(BigDecimal(Float::NAN))
+ assert_same(BigDecimal(Float::NAN), BigDecimal(Float::NAN))
end
BigDecimal.save_exception_mode do
BigDecimal.mode(BigDecimal::EXCEPTION_INFINITY, false)
assert_positive_infinite(BigDecimal(Float::INFINITY))
+ assert_same(BigDecimal(Float::INFINITY), BigDecimal(Float::INFINITY))
assert_negative_infinite(BigDecimal(-Float::INFINITY))
+ assert_same(BigDecimal(-Float::INFINITY), BigDecimal(-Float::INFINITY))
end
end