aboutsummaryrefslogtreecommitdiffstats
path: root/bootstraptest
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-30 10:12:18 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-30 10:12:18 +0000
commit89c862faff2f0b87bd37b8ece9339705e2f893ac (patch)
tree5952761bd69f8b1c17462aca1bf582b040d13df2 /bootstraptest
parentb5a6739adffc87b9d296ef4c3704bf3b74c750c2 (diff)
downloadruby-89c862faff2f0b87bd37b8ece9339705e2f893ac.tar.gz
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 bafa5e85a1..2001e2c0ef 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' }, ],