summaryrefslogtreecommitdiff
path: root/test/bigdecimal
diff options
context:
space:
mode:
Diffstat (limited to 'test/bigdecimal')
-rw-r--r--test/bigdecimal/test_bigdecimal_util.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/bigdecimal/test_bigdecimal_util.rb b/test/bigdecimal/test_bigdecimal_util.rb
index c3a45b2eee..3a3772c449 100644
--- a/test/bigdecimal/test_bigdecimal_util.rb
+++ b/test/bigdecimal/test_bigdecimal_util.rb
@@ -48,4 +48,13 @@ class TestBigDecimalUtil < Test::Unit::TestCase
def test_Rational_to_d_with_negative_precision
assert_raise(ArgumentError) { 355.quo(113).to_d(-42) }
end
+
+ def test_String_to_d
+ assert_equal("2.5".to_d, BigDecimal.new('2.5'))
+ end
+
+ def test_invalid_String_to_d
+ assert_equal("invalid".to_d, BigDecimal.new('0.0'))
+ end
+
end