mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	envutil.rb defines Integer::{FIXNUM_MIN,FIXNUM_MAX}.
* test/lib/envutil.rb: Define Integer::{FIXNUM_MIN,FIXNUM_MAX}.
* test/ruby/test_bignum.rb: Use Integer::{FIXNUM_MIN,FIXNUM_MAX}.
* test/ruby/test_bignum.rb: Ditto.
* test/ruby/test_integer_comb.rb: Ditto.
* test/ruby/test_marshal.rb: Ditto.
* test/ruby/test_optimization.rb: Ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
			
			
This commit is contained in:
		
							parent
							
								
									f98c9a0aa6
								
							
						
					
					
						commit
						de2f7416d2
					
				
					 7 changed files with 32 additions and 33 deletions
				
			
		
							
								
								
									
										14
									
								
								ChangeLog
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								ChangeLog
									
										
									
									
									
								
							|  | @ -1,3 +1,17 @@ | |||
| Mon May  2 00:06:04 2016  Tanaka Akira  <akr@fsij.org> | ||||
| 
 | ||||
| 	* test/lib/envutil.rb: Define Integer::{FIXNUM_MIN,FIXNUM_MAX}. | ||||
| 
 | ||||
| 	* test/ruby/test_bignum.rb: Use Integer::{FIXNUM_MIN,FIXNUM_MAX}. | ||||
| 
 | ||||
| 	* test/ruby/test_bignum.rb: Ditto. | ||||
| 
 | ||||
| 	* test/ruby/test_integer_comb.rb: Ditto. | ||||
| 
 | ||||
| 	* test/ruby/test_marshal.rb: Ditto. | ||||
| 
 | ||||
| 	* test/ruby/test_optimization.rb: Ditto. | ||||
| 
 | ||||
| Sun May  1 23:59:59 2016  Kenta Murata  <mrkn@mrkn.jp> | ||||
| 
 | ||||
| 	* array.c (rb_ary_sum): fix for mathn | ||||
|  |  | |||
|  | @ -3,6 +3,12 @@ | |||
| require "open3" | ||||
| require "timeout" | ||||
| require_relative "find_executable" | ||||
| require "rbconfig/sizeof" | ||||
| 
 | ||||
| class Integer | ||||
|   FIXNUM_MIN = -(1 << (8 * RbConfig::SIZEOF['long'] - 2)) | ||||
|   FIXNUM_MAX = (1 << (8 * RbConfig::SIZEOF['long'] - 2)) - 1 | ||||
| end | ||||
| 
 | ||||
| module EnvUtil | ||||
|   def rubybin | ||||
|  |  | |||
|  | @ -2,16 +2,13 @@ | |||
| require 'test/unit' | ||||
| 
 | ||||
| class TestBignum < Test::Unit::TestCase | ||||
|   b = 2**64 | ||||
|   b *= b until Bignum === b | ||||
|   FIXNUM_MIN = Integer::FIXNUM_MIN | ||||
|   FIXNUM_MAX = Integer::FIXNUM_MAX | ||||
| 
 | ||||
|   f = b | ||||
|   while Bignum === f-1 | ||||
|     f >>= 1 | ||||
|   end | ||||
|   BIGNUM_MIN = f | ||||
|   FIXNUM_MAX = f-1 | ||||
|   BIGNUM_MIN = FIXNUM_MAX + 1 | ||||
|   b = BIGNUM_MIN | ||||
| 
 | ||||
|   f = BIGNUM_MIN | ||||
|   n = 0 | ||||
|   until f == 0 | ||||
|     f >>= 1 | ||||
|  |  | |||
|  | @ -2,7 +2,6 @@ | |||
| require 'test/unit' | ||||
| EnvUtil.suppress_warning {require 'continuation'} | ||||
| require 'stringio' | ||||
| require "rbconfig/sizeof" | ||||
| 
 | ||||
| class TestEnumerable < Test::Unit::TestCase | ||||
|   def setup | ||||
|  | @ -185,8 +184,8 @@ class TestEnumerable < Test::Unit::TestCase | |||
|     assert_equal(nil, @empty.inject() {9}) | ||||
|   end | ||||
| 
 | ||||
|   FIXNUM_MIN = -(1 << (8 * RbConfig::SIZEOF['long'] - 2)) | ||||
|   FIXNUM_MAX = (1 << (8 * RbConfig::SIZEOF['long'] - 2)) - 1 | ||||
|   FIXNUM_MIN = Integer::FIXNUM_MIN | ||||
|   FIXNUM_MAX = Integer::FIXNUM_MAX | ||||
| 
 | ||||
|   def test_inject_array_mul | ||||
|     assert_equal(nil, [].inject(:*)) | ||||
|  |  | |||
|  | @ -110,12 +110,8 @@ class TestIntegerComb < Test::Unit::TestCase | |||
|   #VS.concat VS.find_all {|v| Fixnum === v }.map {|v| 0x4000000000000000.coerce(v)[0] } | ||||
|   #VS.sort! {|a, b| a.abs <=> b.abs } | ||||
| 
 | ||||
|   min = -1 | ||||
|   min *= 2 while min.class == Fixnum | ||||
|   FIXNUM_MIN = min/2 | ||||
|   max = 1 | ||||
|   max *= 2 while (max-1).class == Fixnum | ||||
|   FIXNUM_MAX = max/2-1 | ||||
|   FIXNUM_MIN = Integer::FIXNUM_MIN | ||||
|   FIXNUM_MAX = Integer::FIXNUM_MAX | ||||
| 
 | ||||
|   def test_fixnum_range | ||||
|     assert_instance_of(Bignum, FIXNUM_MIN-1) | ||||
|  |  | |||
|  | @ -622,8 +622,7 @@ class TestMarshal < Test::Unit::TestCase | |||
| 
 | ||||
|   def test_untainted_numeric | ||||
|     bug8945 = '[ruby-core:57346] [Bug #8945] Numerics never be tainted' | ||||
|     b = 1 << 32 | ||||
|     b *= b until Bignum === b | ||||
|     b = Integer::FIXNUM_MAX + 1 | ||||
|     tainted = [0, 1.0, 1.72723e-77, b].select do |x| | ||||
|       Marshal.load(Marshal.dump(x).taint).tainted? | ||||
|     end | ||||
|  |  | |||
|  | @ -3,20 +3,8 @@ require 'test/unit' | |||
| require 'objspace' | ||||
| 
 | ||||
| class TestRubyOptimization < Test::Unit::TestCase | ||||
| 
 | ||||
|   BIGNUM_POS_MIN_32 = 1073741824      # 2 ** 30 | ||||
|   if BIGNUM_POS_MIN_32.kind_of?(Fixnum) | ||||
|     FIXNUM_MAX = 4611686018427387903  # 2 ** 62 - 1 | ||||
|   else | ||||
|     FIXNUM_MAX = 1073741823           # 2 ** 30 - 1 | ||||
|   end | ||||
| 
 | ||||
|   BIGNUM_NEG_MAX_32 = -1073741825     # -2 ** 30 - 1 | ||||
|   if BIGNUM_NEG_MAX_32.kind_of?(Fixnum) | ||||
|     FIXNUM_MIN = -4611686018427387904 # -2 ** 62 | ||||
|   else | ||||
|     FIXNUM_MIN = -1073741824          # -2 ** 30 | ||||
|   end | ||||
|   FIXNUM_MAX = Integer::FIXNUM_MAX | ||||
|   FIXNUM_MIN = Integer::FIXNUM_MIN | ||||
| 
 | ||||
|   def assert_redefine_method(klass, method, code, msg = nil) | ||||
|     assert_separately([], <<-"end;")#    do | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 akr
						akr