From 4a574f7ad985d7e5d1d1596b7632e4db8620e65b Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 23 May 2016 03:30:30 +0000 Subject: bigdecimal.c: fix FloatDomainError * ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): consider non-finite float values not to raise FloatDomainError. [ruby-core:75682] [Bug #12414] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/bigdecimal/test_bigdecimal.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test') diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb index f10c50b47a..4296b50c59 100644 --- a/test/bigdecimal/test_bigdecimal.rb +++ b/test/bigdecimal/test_bigdecimal.rb @@ -459,6 +459,18 @@ class TestBigDecimal < Test::Unit::TestCase assert_equal(false, BigDecimal.new("NaN") > n1) end + def test_cmp_float_nan + assert_equal(nil, BigDecimal.new("1") <=> Float::NAN) + end + + def test_cmp_float_pos_inf + assert_equal(-1, BigDecimal.new("1") <=> Float::INFINITY) + end + + def test_cmp_float_neg_inf + assert_equal(+1, BigDecimal.new("1") <=> -Float::INFINITY) + end + def test_cmp_failing_coercion n1 = BigDecimal.new("1") assert_equal(nil, n1 <=> nil) -- cgit v1.2.3