From 5ee6830abe7d99cd95c9c7a6f252a3692b57c5bc Mon Sep 17 00:00:00 2001 From: Kenta Murata Date: Sat, 2 Jan 2021 00:27:46 +0900 Subject: [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 --- test/bigdecimal/test_bigdecimal.rb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'test/bigdecimal') diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb index 16f5505706..91cf7288e9 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}") -- cgit v1.2.3