diff options
author | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-07-14 03:32:20 +0000 |
---|---|---|
committer | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-07-14 03:32:20 +0000 |
commit | b9bfdbb13eebe43e9610092ab0de6117e745d85e (patch) | |
tree | 0c0adcab2b32e4c7788d70f2771b58b6905c968c /test | |
parent | b956b4a45048365fb96caf86a53271ccbe1e1bad (diff) | |
download | ruby-b9bfdbb13eebe43e9610092ab0de6117e745d85e.tar.gz |
* 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/trunk@6625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_float.rb | 23 |
1 files changed, 20 insertions, 3 deletions
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 |