diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-07-24 20:37:31 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-07-24 20:37:31 +0000 |
commit | 7bfa1146e298acb72d9ee0301fcf37acb4699197 (patch) | |
tree | 549d1e9e4d0f59f01716cb30b139e6b283130d2d /test | |
parent | 8d3bb806b0fd301d5180a211dfe5880fd2ee2506 (diff) | |
download | ruby-7bfa1146e298acb72d9ee0301fcf37acb4699197.tar.gz |
* numeric.c (flo_cmp): honor the result of infinite? method of the
other. [ruby-core:31470]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_float.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_float.rb b/test/ruby/test_float.rb index 5f3e98a6fd..a8ce76edbc 100644 --- a/test/ruby/test_float.rb +++ b/test/ruby/test_float.rb @@ -242,6 +242,20 @@ class TestFloat < Test::Unit::TestCase assert_equal(-1, (Float::MAX.to_i*2) <=> inf) assert_equal(1, (-Float::MAX.to_i*2) <=> -inf) + bug3609 = '[ruby-core:31470]' + def (pinf = Object.new).infinite?; +1 end + def (ninf = Object.new).infinite?; -1 end + def (fin = Object.new).infinite?; nil end + nonum = Object.new + assert_equal(0, inf <=> pinf, bug3609) + assert_equal(1, inf <=> fin, bug3609) + assert_equal(1, inf <=> ninf, bug3609) + assert_nil(inf <=> nonum, bug3609) + assert_equal(-1, -inf <=> pinf, bug3609) + assert_equal(-1, -inf <=> fin, bug3609) + assert_equal(0, -inf <=> ninf, bug3609) + assert_nil(-inf <=> nonum, bug3609) + assert_raise(ArgumentError) { 1.0 > nil } assert_raise(ArgumentError) { 1.0 >= nil } assert_raise(ArgumentError) { 1.0 < nil } |