mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* bignum.c (rb_big2ull): fix off-by-twice bug of NUM2ULL.
* test/-ext-/num2int/test_num2int.rb (class TestNum2int): fix a testcase too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
11137bed53
commit
d3437b7c1a
3 changed files with 17 additions and 14 deletions
|
@ -162,20 +162,11 @@ class TestNum2int < Test::Unit::TestCase
|
|||
assert_output(ULLONG_MAX.to_s) do
|
||||
Num2int.print_num2ull(-1)
|
||||
end
|
||||
assert_output((LLONG_MAX+2).to_s) do
|
||||
Num2int.print_num2ull(LLONG_MIN+1)
|
||||
end
|
||||
|
||||
# maybe bug
|
||||
assert_output((LLONG_MAX).to_s) do
|
||||
Num2int.print_num2ull(LLONG_MIN-1)
|
||||
end
|
||||
# maybe bug
|
||||
assert_output(1.to_s) do
|
||||
Num2int.print_num2ull(LLONG_MIN*2+1)
|
||||
assert_output((LLONG_MAX+1).to_s) do
|
||||
Num2int.print_num2ull(LLONG_MIN)
|
||||
end
|
||||
assert_raise(RangeError) do
|
||||
Num2int.print_num2ull(LLONG_MIN*2)
|
||||
Num2int.print_num2ull(LLONG_MIN-1)
|
||||
end
|
||||
assert_raise(RangeError) do
|
||||
Num2int.print_num2ull(ULLONG_MAX+1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue