mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
add test for [ruby-dev:31210].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0b0b62e9a4
commit
c393603f94
1 changed files with 34 additions and 2 deletions
|
@ -29,8 +29,40 @@ class TestFixnum < Test::Unit::TestCase
|
||||||
assert_equal(0x4000000000000000, 0x3fffffffffffffff.succ, "[ruby-dev:31190]")
|
assert_equal(0x4000000000000000, 0x3fffffffffffffff.succ, "[ruby-dev:31190]")
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_plus
|
def test_pred
|
||||||
assert_equal(0x4000000000000000, 0x3fffffffffffffff+1)
|
assert_equal(-0x40000001, (-0x40000000).pred)
|
||||||
|
assert_equal(-0x4000000000000001, (-0x4000000000000000).pred)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_plus
|
||||||
|
assert_equal(0x40000000, 0x3fffffff+1)
|
||||||
|
assert_equal(0x4000000000000000, 0x3fffffffffffffff+1)
|
||||||
|
assert_equal(-0x40000001, (-0x40000000)+(-1))
|
||||||
|
assert_equal(-0x4000000000000001, (-0x4000000000000000)+(-1))
|
||||||
|
assert_equal(-0x80000000, (-0x40000000)+(-0x40000000))
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_sub
|
||||||
|
assert_equal(0x40000000, 0x3fffffff-(-1))
|
||||||
|
assert_equal(0x4000000000000000, 0x3fffffffffffffff-(-1))
|
||||||
|
assert_equal(-0x40000001, (-0x40000000)-1)
|
||||||
|
assert_equal(-0x4000000000000001, (-0x4000000000000000)-1)
|
||||||
|
assert_equal(-0x80000000, (-0x40000000)-0x40000000)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_mult
|
||||||
|
assert_equal(0x40000000, 0x20000000*2)
|
||||||
|
assert_equal(0x4000000000000000, 0x2000000000000000*2)
|
||||||
|
assert_equal(-0x40000001, 33025*(-32513))
|
||||||
|
assert_equal(-0x4000000000000001, 1380655685*(-3340214413))
|
||||||
|
assert_equal(0x40000000, (-0x40000000)*(-1))
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_div
|
||||||
|
assert_equal(0x40000000, 0xc0000000/3)
|
||||||
|
assert_equal(0x4000000000000000, 0xc000000000000000/3)
|
||||||
|
assert_equal(-0x40000001, 0xc0000003/(-3))
|
||||||
|
assert_equal(-0x4000000000000001, 0xc000000000000003/(-3))
|
||||||
|
assert_equal(0x40000000, (-0x40000000)/(-1), "[ruby-dev:31210]")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue