From f2035367ed481629b1c09d28abb52b5df7fcee12 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: http://svn.ruby-lang.org/repos/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 92c206294..741093fa6 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