mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
b956b4a450
commit
b9bfdbb13e
3 changed files with 40 additions and 9 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue