summaryrefslogtreecommitdiff
path: root/bootstraptest
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-30 10:12:18 (GMT)
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-30 10:12:18 (GMT)
commit8ad74296447f628fef2110516f5c332f8c0a31fe (patch)
tree5952761bd69f8b1c17462aca1bf582b040d13df2 /bootstraptest
parentf7015c968c19b198ad54c31e755e87385f8b65d3 (diff)
make FIXNUM_MAX visible from Ruby
Because our tests now have several places where FIXNUM_MAX is needed, we decided to provide it along with several other constants. * template/limits.c.tmpl: new file, defining RbConfig::Limits * ext/rbconfig/sizeof/depend (limits.c): rule to generate limits.c * test/-ext-/num2int/test_num2int.rb: use RbConfig::Limits * bootstraptest/test_insns.rb: ditto. * .gitignore: ignore new generated file. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bootstraptest')
-rw-r--r--bootstraptest/test_insns.rb13
1 files changed, 5 insertions, 8 deletions
diff --git a/bootstraptest/test_insns.rb b/bootstraptest/test_insns.rb
index bafa5e8..2001e2c 100644
--- a/bootstraptest/test_insns.rb
+++ b/bootstraptest/test_insns.rb
@@ -10,11 +10,8 @@ begin
rescue LoadError
# OK, just skip
else
- bits = 8 * RbConfig::SIZEOF['long']
- $LONG_MAX = (1 << (bits - 1)) - 1
- $LONG_MIN = -1 * $LONG_MAX - 1
- $FIXNUM_MAX = $LONG_MAX >> 1
- $FIXNUM_MIN = $LONG_MIN >> 1
+ $FIXNUM_MAX = RbConfig::Limits["FIXNUM_MAX"]
+ $FIXNUM_MIN = RbConfig::Limits["FIXNUM_MIN"]
end
fsl = { frozen_string_literal: true } # used later
@@ -272,7 +269,7 @@ tests = [
[ 'opt_case_dispatch', %q{ case 1.0 when 1.1 then false else true end }, ],
[ 'opt_plus', %q{ 1 + 1 == 2 }, ],
- if defined? $LONG_MAX then
+ if defined? $FIXNUM_MAX then
[ 'opt_plus', %Q{ #{ $FIXNUM_MAX } + 1 == #{ $FIXNUM_MAX + 1 } }, ]
end,
[ 'opt_plus', %q{ 1.0 + 1.0 == 2.0 }, ],
@@ -281,7 +278,7 @@ tests = [
[ 'opt_plus', %q{ ( ['t'] + ['r', ['u', ['e'], ], ] ).join }, ],
[ 'opt_plus', %q{ Time.at(1) + 1 == Time.at(2) }, ],
[ 'opt_minus', %q{ 1 - 1 == 0 }, ],
- if defined? $LONG_MAX then
+ if defined? $FIXNUM_MIN then
[ 'opt_minus', %Q{ #{ $FIXNUM_MIN } - 1 == #{ $FIXNUM_MIN - 1 } }, ]
end,
[ 'opt_minus', %q{ 1.0 - 1.0 == 0.0 }, ],
@@ -364,7 +361,7 @@ tests = [
[ 'opt_empty_p', %q{ Queue.new.empty? }, ],
[ 'opt_succ', %q{ 1.succ == 2 }, ],
- if defined? $LONG_MAX then
+ if defined? $FIXNUM_MAX then
[ 'opt_succ',%Q{ #{ $FIXNUM_MAX }.succ == #{ $FIXNUM_MAX + 1 } }, ]
end,
[ 'opt_succ', %q{ '1'.succ == '2' }, ],