From 956b1f9c82d1e4b50b2af7fe2a20a3dc22204360 Mon Sep 17 00:00:00 2001 From: ocean Date: Wed, 14 Jul 2004 03:32:20 +0000 Subject: * util.c (ruby_strtod): should not convert string in the form of "-I.FE-X" which both "I" and "F" are ommitted. [ruby-dev:23883] * test/ruby/test_float.rb (test_strtod): add test for bug fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_float.rb | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'test/ruby') diff --git a/test/ruby/test_float.rb b/test/ruby/test_float.rb index 92c2062948..741093fa61 100644 --- a/test/ruby/test_float.rb +++ b/test/ruby/test_float.rb @@ -61,12 +61,29 @@ class TestFloat < Test::Unit::TestCase assert(a.abs < Float::EPSILON) a = Float("-0.0") assert(a.abs < Float::EPSILON) - a = Float("0." + "00" * Float::DIG + "1") + a = Float("0.0000000000000000001") assert(a != 0.0) - a = Float("+0." + "00" * Float::DIG + "1") + a = Float("+0.0000000000000000001") assert(a != 0.0) - a = Float("-0." + "00" * Float::DIG + "1") + a = Float("-0.0000000000000000001") assert(a != 0.0) + a = Float(".0") + assert(a.abs < Float::EPSILON) + a = Float("+.0") + assert(a.abs < Float::EPSILON) + a = Float("-.0") + assert(a.abs < Float::EPSILON) + a = Float("0.") + assert(a.abs < Float::EPSILON) + a = Float("+0.") + assert(a.abs < Float::EPSILON) + a = Float("-0.") + assert(a.abs < Float::EPSILON) + assert_raise(ArgumentError){Float(".")} + assert_raise(ArgumentError){Float("+")} + assert_raise(ArgumentError){Float("+.")} + assert_raise(ArgumentError){Float("-")} + assert_raise(ArgumentError){Float("-.")} # add expected behaviour here. end end -- cgit v1.2.3