Skip to content

Commit bdc1cc6

Browse files
committed
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.
1 parent 5823261 commit bdc1cc6

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

test/bigdecimal/test_bigdecimal.rb

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,16 +1519,17 @@ def test_power_with_prec
15191519
end
15201520

15211521
def test_limit
1522-
BigDecimal.limit(1)
1523-
x = BigDecimal("3")
1524-
assert_equal(90, x ** 4) # OK? must it be 80?
1525-
# 3 * 3 * 3 * 3 = 10 * 3 * 3 = 30 * 3 = 90 ???
1526-
assert_raise(ArgumentError) { BigDecimal.limit(-1) }
1527-
1528-
bug7458 = '[ruby-core:50269] [#7458]'
1529-
one = BigDecimal('1')
1530-
epsilon = BigDecimal('0.7E-18')
15311522
BigDecimal.save_limit do
1523+
BigDecimal.limit(1)
1524+
x = BigDecimal("3")
1525+
assert_equal(90, x ** 4) # OK? must it be 80?
1526+
# 3 * 3 * 3 * 3 = 10 * 3 * 3 = 30 * 3 = 90 ???
1527+
assert_raise(ArgumentError) { BigDecimal.limit(-1) }
1528+
1529+
bug7458 = '[ruby-core:50269] [#7458]'
1530+
one = BigDecimal('1')
1531+
epsilon = BigDecimal('0.7E-18')
1532+
15321533
BigDecimal.limit(0)
15331534
assert_equal(BigDecimal("1.0000000000000000007"), one + epsilon, "limit(0) #{bug7458}")
15341535

0 commit comments

Comments
 (0)