[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
This commit is contained in:
Kenta Murata 2021-01-02 00:27:46 +09:00
Родитель 7156248137
Коммит 5ee6830abe
1 изменённых файлов: 10 добавлений и 9 удалений

Просмотреть файл

@ -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}")