ruby-changes:27968
From: akr <ko1@a...>
Date: Sun, 31 Mar 2013 16:53:57 +0900 (JST)
Subject: [ruby-changes:27968] akr:r40020 (trunk): more tests.
akr 2013-03-31 16:51:35 +0900 (Sun, 31 Mar 2013) New Revision: 40020 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40020 Log: more tests. Modified files: trunk/test/-ext-/num2int/test_num2int.rb Index: test/-ext-/num2int/test_num2int.rb =================================================================== --- test/-ext-/num2int/test_num2int.rb (revision 40019) +++ test/-ext-/num2int/test_num2int.rb (revision 40020) @@ -48,16 +48,14 @@ class TestNum2int < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/-ext-/num2int/test_num2int.rb#L48 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 https://github.com/ruby/ruby/blob/trunk/test/-ext-/num2int/test_num2int.rb#L72 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/