* ext/-test-/num2int/num2int.c: Rename utility methods

to global functions to ease manual experiments.

* test/-ext-/num2int/test_num2int.rb: Follow the above change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2013-04-01 21:49:55 +00:00
Родитель 7d3db3cc81
Коммит d40335aa36
3 изменённых файлов: 24 добавлений и 23 удалений

Просмотреть файл

@ -1,3 +1,10 @@
Tue Apr 2 06:46:59 2013 Tanaka Akira <akr@fsij.org>
* ext/-test-/num2int/num2int.c: Rename utility methods
to global functions to ease manual experiments.
* test/-ext-/num2int/test_num2int.rb: Follow the above change.
Mon Apr 1 22:26:17 2013 Tanaka Akira <akr@fsij.org> Mon Apr 1 22:26:17 2013 Tanaka Akira <akr@fsij.org>
* ext/zlib/zlib.c (rb_gzfile_set_mtime): Use NUM2UINT. * ext/zlib/zlib.c (rb_gzfile_set_mtime): Use NUM2UINT.

Просмотреть файл

@ -109,28 +109,26 @@ test_fix2ulong(VALUE obj, VALUE num)
void void
Init_num2int(void) Init_num2int(void)
{ {
VALUE cNum2int = rb_path2class("TestNum2int::Num2int"); rb_define_global_function("NUM2SHORT", test_num2short, 1);
rb_define_global_function("NUM2USHORT", test_num2ushort, 1);
rb_define_singleton_method(cNum2int, "rb_num2short", test_num2short, 1); rb_define_global_function("NUM2INT", test_num2int, 1);
rb_define_singleton_method(cNum2int, "rb_num2ushort", test_num2ushort, 1); rb_define_global_function("NUM2UINT", test_num2uint, 1);
rb_define_singleton_method(cNum2int, "rb_num2int", test_num2int, 1); rb_define_global_function("NUM2LONG", test_num2long, 1);
rb_define_singleton_method(cNum2int, "rb_num2uint", test_num2uint, 1); rb_define_global_function("NUM2ULONG", test_num2ulong, 1);
rb_define_singleton_method(cNum2int, "rb_num2long", test_num2long, 1);
rb_define_singleton_method(cNum2int, "rb_num2ulong", test_num2ulong, 1);
#ifdef HAVE_LONG_LONG #ifdef HAVE_LONG_LONG
rb_define_singleton_method(cNum2int, "rb_num2ll", test_num2ll, 1); rb_define_global_function("NUM2LL", test_num2ll, 1);
rb_define_singleton_method(cNum2int, "rb_num2ull", test_num2ull, 1); rb_define_global_function("NUM2ULL", test_num2ull, 1);
#endif #endif
rb_define_singleton_method(cNum2int, "rb_fix2short", test_fix2short, 1); rb_define_global_function("FIX2SHORT", test_fix2short, 1);
rb_define_singleton_method(cNum2int, "rb_fix2int", test_fix2int, 1); rb_define_global_function("FIX2INT", test_fix2int, 1);
rb_define_singleton_method(cNum2int, "rb_fix2uint", test_fix2uint, 1); rb_define_global_function("FIX2UINT", test_fix2uint, 1);
rb_define_singleton_method(cNum2int, "rb_fix2long", test_fix2long, 1); rb_define_global_function("FIX2LONG", test_fix2long, 1);
rb_define_singleton_method(cNum2int, "rb_fix2ulong", test_fix2ulong, 1); rb_define_global_function("FIX2ULONG", test_fix2ulong, 1);
} }

Просмотреть файл

@ -37,10 +37,9 @@ class TestNum2int < Test::Unit::TestCase
def assert_num2i_success_internal(exp, func, arg) def assert_num2i_success_internal(exp, func, arg)
mesg = "#{func}(#{arg.inspect})" mesg = "#{func}(#{arg.inspect})"
method = "rb_#{func}".downcase
out = nil out = nil
assert_nothing_raised(mesg) { assert_nothing_raised(mesg) {
out = Num2int.send(method, arg) out = Kernel.send(func, arg)
} }
assert_equal(exp, out, mesg) assert_equal(exp, out, mesg)
end end
@ -64,9 +63,8 @@ class TestNum2int < Test::Unit::TestCase
end end
def assert_num2i_error_internal(func, arg) def assert_num2i_error_internal(func, arg)
method = "rb_#{func}".downcase
assert_raise(RangeError, "#{func}(#{arg.inspect})") { assert_raise(RangeError, "#{func}(#{arg.inspect})") {
Num2int.send(method, arg) Kernel.send(func, arg)
} }
end end
@ -90,10 +88,9 @@ class TestNum2int < Test::Unit::TestCase
def assert_fix2i_success_internal(exp, func, arg) def assert_fix2i_success_internal(exp, func, arg)
mesg = "#{func}(#{arg.inspect})" mesg = "#{func}(#{arg.inspect})"
method = "rb_#{func}".downcase
out = nil out = nil
assert_nothing_raised(mesg) { assert_nothing_raised(mesg) {
out = Num2int.send(method, arg) out = Kernel.send(func, arg)
} }
assert_equal(exp, out, mesg) assert_equal(exp, out, mesg)
end end
@ -105,9 +102,8 @@ class TestNum2int < Test::Unit::TestCase
end end
def assert_fix2i_error_internal(func, arg) def assert_fix2i_error_internal(func, arg)
method = "rb_#{func}".downcase
assert_raise(RangeError, "#{func}(#{arg.inspect})") { assert_raise(RangeError, "#{func}(#{arg.inspect})") {
Num2int.send(method, arg) Kernel.send(func, arg)
} }
end end