mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
8f79c623f3
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
36 lines
688 B
Ruby
36 lines
688 B
Ruby
require 'test/unit'
|
|
|
|
class TestFixnum < Test::Unit::TestCase
|
|
def setup
|
|
@verbose = $VERBOSE
|
|
$VERBOSE = nil
|
|
end
|
|
|
|
def teardown
|
|
$VERBOSE = @verbose
|
|
end
|
|
|
|
def test_pow
|
|
[1, 2, 2**64, 2**63*3, 2**64*3].each do |y|
|
|
[1, 3].each do |x|
|
|
z1 = x**y
|
|
z2 = (-x)**y
|
|
if y % 2 == 1
|
|
assert_equal(z2, -z1)
|
|
else
|
|
assert_equal(z2, z1)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
def test_succ
|
|
assert_equal(0x40000000, 0x3fffffff.succ, "[ruby-dev:31189]")
|
|
assert_equal(0x4000000000000000, 0x3fffffffffffffff.succ, "[ruby-dev:31190]")
|
|
end
|
|
|
|
def test_plus
|
|
assert_equal(0x4000000000000000, 0x3fffffffffffffff+1)
|
|
end
|
|
|
|
end
|