summaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authorocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-07-14 03:32:20 +0000
committerocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-07-14 03:32:20 +0000
commitf2035367ed481629b1c09d28abb52b5df7fcee12 (patch)
tree6851af8638874e33d8a8e2376d58ebc6080cb797 /test/ruby
parent94be0826342aca8f0c9766df865c4d98f23c1b94 (diff)
downloadruby-f2035367ed481629b1c09d28abb52b5df7fcee12.tar.gz
ruby-f2035367ed481629b1c09d28abb52b5df7fcee12.tar.xz
ruby-f2035367ed481629b1c09d28abb52b5df7fcee12.zip
* 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
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_float.rb23
1 files changed, 20 insertions, 3 deletions
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