mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/-test-/num2int/num2int.c: Define utility methods
as module methods of Num2int. * test/-ext-/num2int/test_num2int.rb: Follow the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
817a96a45d
commit
6d0c59f156
3 changed files with 28 additions and 19 deletions
|
@ -1,3 +1,10 @@
|
|||
Tue Apr 2 19:24:26 2013 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/-test-/num2int/num2int.c: Define utility methods
|
||||
as module methods of Num2int.
|
||||
|
||||
* test/-ext-/num2int/test_num2int.rb: Follow the above change.
|
||||
|
||||
Tue Apr 2 18:49:01 2013 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* lib/securerandom.rb: Don't use Array#to_s.
|
||||
|
|
|
@ -109,26 +109,28 @@ test_fix2ulong(VALUE obj, VALUE num)
|
|||
void
|
||||
Init_num2int(void)
|
||||
{
|
||||
rb_define_global_function("NUM2SHORT", test_num2short, 1);
|
||||
rb_define_global_function("NUM2USHORT", test_num2ushort, 1);
|
||||
VALUE mNum2int = rb_define_module("Num2int");
|
||||
|
||||
rb_define_global_function("NUM2INT", test_num2int, 1);
|
||||
rb_define_global_function("NUM2UINT", test_num2uint, 1);
|
||||
rb_define_module_function(mNum2int, "NUM2SHORT", test_num2short, 1);
|
||||
rb_define_module_function(mNum2int, "NUM2USHORT", test_num2ushort, 1);
|
||||
|
||||
rb_define_global_function("NUM2LONG", test_num2long, 1);
|
||||
rb_define_global_function("NUM2ULONG", test_num2ulong, 1);
|
||||
rb_define_module_function(mNum2int, "NUM2INT", test_num2int, 1);
|
||||
rb_define_module_function(mNum2int, "NUM2UINT", test_num2uint, 1);
|
||||
|
||||
rb_define_module_function(mNum2int, "NUM2LONG", test_num2long, 1);
|
||||
rb_define_module_function(mNum2int, "NUM2ULONG", test_num2ulong, 1);
|
||||
|
||||
#ifdef HAVE_LONG_LONG
|
||||
rb_define_global_function("NUM2LL", test_num2ll, 1);
|
||||
rb_define_global_function("NUM2ULL", test_num2ull, 1);
|
||||
rb_define_module_function(mNum2int, "NUM2LL", test_num2ll, 1);
|
||||
rb_define_module_function(mNum2int, "NUM2ULL", test_num2ull, 1);
|
||||
#endif
|
||||
|
||||
rb_define_global_function("FIX2SHORT", test_fix2short, 1);
|
||||
rb_define_module_function(mNum2int, "FIX2SHORT", test_fix2short, 1);
|
||||
|
||||
rb_define_global_function("FIX2INT", test_fix2int, 1);
|
||||
rb_define_global_function("FIX2UINT", test_fix2uint, 1);
|
||||
rb_define_module_function(mNum2int, "FIX2INT", test_fix2int, 1);
|
||||
rb_define_module_function(mNum2int, "FIX2UINT", test_fix2uint, 1);
|
||||
|
||||
rb_define_global_function("FIX2LONG", test_fix2long, 1);
|
||||
rb_define_global_function("FIX2ULONG", test_fix2ulong, 1);
|
||||
rb_define_module_function(mNum2int, "FIX2LONG", test_fix2long, 1);
|
||||
rb_define_module_function(mNum2int, "FIX2ULONG", test_fix2ulong, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class TestNum2int < Test::Unit::TestCase
|
|||
mesg = "#{func}(#{arg.inspect})"
|
||||
out = nil
|
||||
assert_nothing_raised(mesg) {
|
||||
out = Kernel.send(func, arg)
|
||||
out = Num2int.send(func, arg)
|
||||
}
|
||||
assert_equal(exp, out, mesg)
|
||||
end
|
||||
|
@ -66,7 +66,7 @@ class TestNum2int < Test::Unit::TestCase
|
|||
|
||||
def assert_num2i_error_internal(func, arg)
|
||||
assert_raise(RangeError, "#{func}(#{arg.inspect})") {
|
||||
Kernel.send(func, arg)
|
||||
Num2int.send(func, arg)
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -97,7 +97,7 @@ class TestNum2int < Test::Unit::TestCase
|
|||
mesg = "#{func}(#{arg.inspect})"
|
||||
out = nil
|
||||
assert_nothing_raised(mesg) {
|
||||
out = Kernel.send(func, arg)
|
||||
out = Num2int.send(func, arg)
|
||||
}
|
||||
assert_equal(exp, out, mesg)
|
||||
end
|
||||
|
@ -110,7 +110,7 @@ class TestNum2int < Test::Unit::TestCase
|
|||
|
||||
def assert_fix2i_error_internal(func, arg)
|
||||
assert_raise(RangeError, "#{func}(#{arg.inspect})") {
|
||||
Kernel.send(func, arg)
|
||||
Num2int.send(func, arg)
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -185,7 +185,7 @@ class TestNum2int < Test::Unit::TestCase
|
|||
assert_num2i_success(:ll, FIXNUM_MIN-1)
|
||||
assert_num2i_success(:ll, FIXNUM_MAX)
|
||||
assert_num2i_success(:ll, FIXNUM_MAX+1)
|
||||
end if defined?(Kernel.NUM2LL)
|
||||
end if defined?(Num2int.NUM2LL)
|
||||
|
||||
def test_num2ull
|
||||
assert_num2i_success(:ull, 0)
|
||||
|
@ -198,7 +198,7 @@ class TestNum2int < Test::Unit::TestCase
|
|||
assert_num2i_success(:ull, FIXNUM_MIN-1, ULLONG_MAX-FIXNUM_MAX-1)
|
||||
assert_num2i_success(:ull, FIXNUM_MAX)
|
||||
assert_num2i_success(:ull, FIXNUM_MAX+1)
|
||||
end if defined?(Kernel.NUM2ULL)
|
||||
end if defined?(Num2int.NUM2ULL)
|
||||
|
||||
def test_fix2short
|
||||
assert_fix2i_success(:short, 0)
|
||||
|
|
Loading…
Add table
Reference in a new issue