summaryrefslogtreecommitdiff
path: root/test/ruby/test_bignum.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_bignum.rb')
-rw-r--r--test/ruby/test_bignum.rb44
1 files changed, 22 insertions, 22 deletions
diff --git a/test/ruby/test_bignum.rb b/test/ruby/test_bignum.rb
index a240c8e..68c8461 100644
--- a/test/ruby/test_bignum.rb
+++ b/test/ruby/test_bignum.rb
@@ -19,19 +19,19 @@ class TestBignum < Test::Unit::TestCase
end
BIGNUM_MIN_BITS = n
- T_ZERO = 0.to_bignum
- T_ONE = 1.to_bignum
- T_MONE = (-1).to_bignum
- T31 = (2**31).to_bignum # 2147483648
- T31P = (T31 - 1).to_bignum # 2147483647
- T32 = (2**32).to_bignum # 4294967296
- T32P = (T32 - 1).to_bignum # 4294967295
- T64 = (2**64).to_bignum # 18446744073709551616
- T64P = (T64 - 1).to_bignum # 18446744073709551615
- T128 = (2**128).to_bignum
- T128P = (T128 - 1).to_bignum
- T1024 = (2**1024).to_bignum
- T1024P = (T1024 - 1).to_bignum
+ T_ZERO = Bug::Integer.to_bignum(0)
+ T_ONE = Bug::Integer.to_bignum(1)
+ T_MONE = Bug::Integer.to_bignum(-1)
+ T31 = Bug::Integer.to_bignum(2**31) # 2147483648
+ T31P = Bug::Integer.to_bignum(T31 - 1) # 2147483647
+ T32 = Bug::Integer.to_bignum(2**32) # 4294967296
+ T32P = Bug::Integer.to_bignum(T32 - 1) # 4294967295
+ T64 = Bug::Integer.to_bignum(2**64) # 18446744073709551616
+ T64P = Bug::Integer.to_bignum(T64 - 1) # 18446744073709551615
+ T128 = Bug::Integer.to_bignum(2**128)
+ T128P = Bug::Integer.to_bignum(T128 - 1)
+ T1024 = Bug::Integer.to_bignum(2**1024)
+ T1024P = Bug::Integer.to_bignum(T1024 - 1)
def setup
@verbose = $VERBOSE
@@ -682,7 +682,7 @@ class TestBignum < Test::Unit::TestCase
end
def test_too_big_to_s
- if (big = 2**31-1).fixnum?
+ if Bug::Integer.fixnum?(big = 2**31-1)
return
end
assert_raise_with_message(RangeError, /too big to convert/) {(1 << big).to_s}
@@ -765,7 +765,7 @@ class TestBignum < Test::Unit::TestCase
end
def test_digits
- assert_equal([90, 78, 56, 34, 12], 1234567890.to_bignum.digits(100))
+ assert_equal([90, 78, 56, 34, 12], Bug::Integer.to_bignum(1234567890).digits(100))
assert_equal([7215, 2413, 6242], T1024P.digits(10_000).first(3))
assert_equal([11], 11.digits(T1024P))
assert_equal([T1024P - 1, 1], (T1024P + T1024P - 1).digits(T1024P))
@@ -778,13 +778,13 @@ class TestBignum < Test::Unit::TestCase
end
def test_digits_for_invalid_base_numbers
- assert_raise(ArgumentError) { T1024P.to_bignum.digits(0) }
- assert_raise(ArgumentError) { T1024P.to_bignum.digits(-1) }
- assert_raise(ArgumentError) { T1024P.to_bignum.digits(0.to_bignum) }
- assert_raise(ArgumentError) { T1024P.to_bignum.digits(1.to_bignum) }
- assert_raise(ArgumentError) { T1024P.to_bignum.digits(-T1024P) }
- assert_raise(ArgumentError) { 10.digits(0.to_bignum) }
- assert_raise(ArgumentError) { 10.digits(1.to_bignum) }
+ assert_raise(ArgumentError) { Bug::Integer.to_bignum(T1024P).digits(0) }
+ assert_raise(ArgumentError) { Bug::Integer.to_bignum(T1024P).digits(-1) }
+ assert_raise(ArgumentError) { Bug::Integer.to_bignum(T1024P).digits(Bug::Integer.to_bignum(0)) }
+ assert_raise(ArgumentError) { Bug::Integer.to_bignum(T1024P).digits(Bug::Integer.to_bignum(1)) }
+ assert_raise(ArgumentError) { Bug::Integer.to_bignum(T1024P).digits(-T1024P) }
+ assert_raise(ArgumentError) { 10.digits(Bug::Integer.to_bignum(0)) }
+ assert_raise(ArgumentError) { 10.digits(Bug::Integer.to_bignum(1)) }
end
def test_digits_for_non_integral_base_numbers