aboutsummaryrefslogtreecommitdiffstats
path: root/test/-ext-/num2int
Commit message (Collapse)AuthorAgeFilesLines
* [Feature #12005] Unify Fixnum and Bignum into Integerakr2016-05-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * [Feature #12005] Unify Fixnum and Bignum into Integer * include/ruby/ruby.h (rb_class_of): Return rb_cInteger for fixnums. * insns.def (INTEGER_REDEFINED_OP_FLAG): Unified from FIXNUM_REDEFINED_OP_FLAG and BIGNUM_REDEFINED_OP_FLAG. * vm_core.h: Ditto. * vm_insnhelper.c (opt_eq_func): Use INTEGER_REDEFINED_OP_FLAG instead of FIXNUM_REDEFINED_OP_FLAG. * vm.c (vm_redefinition_check_flag): Use rb_cInteger instead of rb_cFixnum and rb_cBignum. (C): Use Integer instead of Fixnum and Bignum. * numeric.c (fix_succ): Removed. (Init_Numeric): Define Fixnum as Integer. * bignum.c (bignew): Use rb_cInteger instead of Rb_cBignum. (rb_int_coerce): replaced from rb_big_coerce and return fixnums as-is. (Init_Bignum): Define Bignum as Integer. Don't define ===. * error.c (builtin_class_name): Return "Integer" for fixnums. * sprintf.c (ruby__sfvextra): Use rb_cInteger instead of rb_cFixnum. * ext/-test-/testutil: New directory to test. Currently it provides utilities for fixnum and bignum. * ext/json/generator/generator.c: Define mInteger_to_json. * lib/mathn.rb (Fixnum#/): Redefinition removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/-test-: reduce feature namesnobu2016-01-101-1/+1
| | | | | | | * ext/-test-/**/extconf.rb: bring up extension libraries which have same name as the parent directory to reduce feature names. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add frozen_string_literal: false for all filesnaruse2015-12-161-0/+1
| | | | | | When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* More tests.akr2013-04-221-0/+19
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/-test-/num2int/num2int.c: Define utility methodsakr2013-04-021-6/+6
| | | | | | | | | | 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
* Unused module removed.akr2013-04-011-4/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* conditional test fixed.akr2013-04-011-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* more tests.akr2013-04-011-8/+18
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/-test-/num2int/num2int.c: Rename utility methodsakr2013-04-011-8/+4
| | | | | | | | | | 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
* * test/-ext-/num2int/test_num2int.rb: Test small bignums.akr2013-04-011-0/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/-test-/num2int/num2int.c: Return string for result, instead ofakr2013-04-011-12/+10
| | | | | | | | | | printing. * test/-ext-/num2int/test_num2int.rb: updated to follow above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (FIX2ULONG): Make it consistent with NUM2ULONG.akr2013-03-311-0/+74
| | | | | | | | | | * ext/-test-/num2int/num2int.c: Add utility methods for FIX2XXX tests. * test/-ext-/num2int/test_num2int.rb: Add tests for FIX2XXX. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* more tests.akr2013-03-311-10/+17
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (rb_num2ulong_internal): New function similart toakr2013-03-311-0/+11
| | | | | | | | | | | | rb_num2ulong but integer wrap around flag is also returned. (rb_num2ulong): Use rb_num2ulong_internal. (rb_num2uint): Use rb_num2ulong_internal and the wrap around flag is used instead of negative_int_p(val). (rb_num2ushort): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/-ext-/num2int/test_num2int.rb: extractakr2013-03-281-17/+24
| | | | | | | | assert_num2i_success_internal and assert_num2i_error_internal and provide assertion messages as "NUM2XXX(NNN)". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix typoskazu2013-03-271-58/+58
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (LONG_MIN_MINUS_ONE_IS_LESS_THAN): New macro.akr2013-03-271-0/+10
| | | | | | | | | | | | | | | | | (LLONG_MIN_MINUS_ONE_IS_LESS_THAN): Ditto. (rb_num2long): Use LONG_MIN_MINUS_ONE_IS_LESS_THAN. (rb_num2ulong): Ditto. (rb_num2ll): Use LLONG_MIN_MINUS_ONE_IS_LESS_THAN. (rb_num2ull): Ditto. * test/-ext-/num2int/test_num2int.rb (asert_num2i_success): Test the value converted into a Float if Float can represent the value exactly. (asert_num2i_error): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/-ext-/num2int/test_num2int.rb (asert_num2i_success): Newakr2013-03-271-166/+71
| | | | | | | | | utility method. (asert_num2i_error): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/-ext-/num2int/test_num2int.rb (test_num2ll): test LLONG_MIN,akr2013-03-271-2/+2
| | | | | | | | not LONG_MIN. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* num2ll and num2ullnobu2012-03-181-2/+2
| | | | | | | | * ext/-test-/num2int/num2int.c (print_num2ll, print_num2ull): define only if long long is available, and use long long printf modifier checked by configure. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big2ull): fix 32bit platform breakage. we mustkosaki2011-11-141-6/+4
| | | | | | | | | | not assume sizeof(VALUE) == sizeof(LONG_LONG). * test/-ext-/num2int/test_num2int.rb (class TestNum2int): fix false assumption on 32bit platform. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h: add NUM2SHORT(), NUM2USHORT() macros.kosaki2011-11-141-0/+40
| | | | | | | | | | | * numeric.c: ditto. * test/-ext-/num2int/test_num2int.rb: add testcases for NUM2SHORT(). * ext/-test-/num2int/num2int.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big2ull): fix off-by-twice bug of NUM2ULL.kosaki2011-11-141-12/+3
| | | | | | | | | * test/-ext-/num2int/test_num2int.rb (class TestNum2int): fix a testcase too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/-ext-/num2int/test_num2int.rb (class TestNum2int):kosaki2011-11-141-0/+53
| | | | | | | | add FIXNUM tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (check_uint): fix off-by-one bug of NUM2UINT.kosaki2011-11-141-0/+145
* bignum.c (rb_big2ulong): fix off-by-one bug of NUM2ULONG. * test/-ext-/num2int/test_num2int.rb: add a testcase for NUM2INT() NUM2UINT(), NUM2LONG(), NUM2ULONG(), NUM2LL and NUM2ULL(). * ext/-test-/num2int/depend: ditto. * ext/-test-/num2int/extconf.rb: ditto. * ext/-test-/num2int/num2int.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e