summaryrefslogtreecommitdiff
path: root/test/bigdecimal/test_bigdecimal.rb
diff options
context:
space:
mode:
authorKenta Murata <mrkn@mrkn.jp>2021-01-02 00:27:46 +0900
committerKenta Murata <mrkn@mrkn.jp>2021-01-02 00:30:57 +0900
commit5ee6830abe7d99cd95c9c7a6f252a3692b57c5bc (patch)
tree0686d79816ac81994f8ea74c951aecbfd9d51d54 /test/bigdecimal/test_bigdecimal.rb
parent715624813794db603f679cf995844f6a7b7010fa (diff)
[ruby/bigdecimal] Fix test_limit
Keep the default value of BigDecimal.limit by BigDecimal.save_limit to avoid failures of the other test methods due to the unexpected limit. https://github.com/ruby/bigdecimal/commit/bdc1cc6585
Diffstat (limited to 'test/bigdecimal/test_bigdecimal.rb')
-rw-r--r--test/bigdecimal/test_bigdecimal.rb19
1 files changed, 10 insertions, 9 deletions
diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb
index 16f5505..91cf728 100644
--- a/test/bigdecimal/test_bigdecimal.rb
+++ b/test/bigdecimal/test_bigdecimal.rb
@@ -1495,16 +1495,17 @@ class TestBigDecimal < Test::Unit::TestCase
end
def test_limit
- BigDecimal.limit(1)
- x = BigDecimal("3")
- assert_equal(90, x ** 4) # OK? must it be 80?
- # 3 * 3 * 3 * 3 = 10 * 3 * 3 = 30 * 3 = 90 ???
- assert_raise(ArgumentError) { BigDecimal.limit(-1) }
-
- bug7458 = '[ruby-core:50269] [#7458]'
- one = BigDecimal('1')
- epsilon = BigDecimal('0.7E-18')
BigDecimal.save_limit do
+ BigDecimal.limit(1)
+ x = BigDecimal("3")
+ assert_equal(90, x ** 4) # OK? must it be 80?
+ # 3 * 3 * 3 * 3 = 10 * 3 * 3 = 30 * 3 = 90 ???
+ assert_raise(ArgumentError) { BigDecimal.limit(-1) }
+
+ bug7458 = '[ruby-core:50269] [#7458]'
+ one = BigDecimal('1')
+ epsilon = BigDecimal('0.7E-18')
+
BigDecimal.limit(0)
assert_equal(BigDecimal("1.0000000000000000007"), one + epsilon, "limit(0) #{bug7458}")