diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-31 07:51:35 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-31 07:51:35 +0000 |
commit | 31af17963d6dd30c88360d79f70505af916e3272 (patch) | |
tree | 9756a4ef19542d9b002ea47ae42a85232b0a96fd | |
parent | 8825a084eb57893b7e1951e76ce299bd41535c24 (diff) |
more tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | test/-ext-/num2int/test_num2int.rb | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/test/-ext-/num2int/test_num2int.rb b/test/-ext-/num2int/test_num2int.rb index deeb33ef78..df1c302ecb 100644 --- a/test/-ext-/num2int/test_num2int.rb +++ b/test/-ext-/num2int/test_num2int.rb @@ -48,16 +48,14 @@ class TestNum2int < Test::Unit::TestCase if num.to_f.to_i == num assert_num2i_success_internal(result.to_s, func, num.to_f) end - if num == result - # The conversion functions such as NUM2INT uses to_int (conceptually). - arg = num.to_f + 0.5 - if arg != num.to_f && arg.to_int == num - assert_num2i_success_internal(result.to_s, func, arg) - end - arg = num.to_f - 0.5 - if arg != num.to_f && arg.to_int == num - assert_num2i_success_internal(result.to_s, func, arg) - end + # The conversion functions such as NUM2INT uses (conceptually) to_int. + arg = num.to_f + 0.5 + if arg != num.to_f && arg.to_int == num + assert_num2i_success_internal(result.to_s, func, arg) + end + arg = num.to_f - 0.5 + if arg != num.to_f && arg.to_int == num + assert_num2i_success_internal(result.to_s, func, arg) end end @@ -74,6 +72,15 @@ class TestNum2int < Test::Unit::TestCase if num.to_f.to_i == num assert_num2i_error_internal(func, num.to_f) end + # The conversion functions such as NUM2INT uses (conceptually) to_int. + arg = num.to_f + 0.5 + if arg != num.to_f && arg.to_int == num + assert_num2i_error_internal(func, arg) + end + arg = num.to_f - 0.5 + if arg != num.to_f && arg.to_int == num + assert_num2i_error_internal(func, arg) + end end def test_num2short |