summaryrefslogtreecommitdiff
path: root/test/ruby/test_float.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_float.rb')
-rw-r--r--test/ruby/test_float.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/ruby/test_float.rb b/test/ruby/test_float.rb
index 1146b58..961596b 100644
--- a/test/ruby/test_float.rb
+++ b/test/ruby/test_float.rb
@@ -94,7 +94,6 @@ class TestFloat < Test::Unit::TestCase
assert_equal([ 0.0].pack('G'), [Float(" 0x0p+0").to_f].pack('G'))
assert_equal([-0.0].pack('G'), [Float("-0x0p+0").to_f].pack('G'))
assert_equal(255.0, Float("0Xff"))
- assert_equal(255.5, Float("0Xff.8"))
assert_equal(1.0, Float("0X1.P+0"))
assert_equal(1024.0, Float("0x1p10"))
assert_equal(1024.0, Float("0x1p+10"))
@@ -448,6 +447,13 @@ class TestFloat < Test::Unit::TestCase
assert_raise(ArgumentError) { Float("1.0\x001") }
assert_equal(15.9375, Float('0xf.fp0'))
assert_raise(ArgumentError) { Float('0x') }
+ assert_equal(15, Float('0xf'))
+ assert_equal(15, Float('0xfp0'))
+ assert_raise(ArgumentError) { Float('0xfp') }
+ assert_raise(ArgumentError) { Float('0xf.') }
+ assert_raise(ArgumentError) { Float('0xf.p') }
+ assert_equal(15, Float('0xf.p0'))
+ assert_raise(ArgumentError) { Float('0xf.f') }
assert_raise(ArgumentError) { Float('0xf.fp') }
assert_equal(Float::INFINITY, Float('0xf.fp1000000000000000'))
assert_equal(1, suppress_warning {Float("1e10_00")}.infinite?)