gmp 0.6.47 → 0.7.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +21 -1
  3. data/README.markdown +29 -9
  4. data/ext/extconf.rb +8 -0
  5. data/ext/gmp.c +7 -7
  6. data/ext/gmpf.c +620 -139
  7. data/ext/gmpq.c +218 -90
  8. data/ext/gmprandstate.c +57 -53
  9. data/ext/gmpz.c +492 -440
  10. data/ext/mprnd.c +44 -35
  11. data/ext/ruby_gmp.h +6 -6
  12. data/manual.pdf +0 -0
  13. data/manual.tex +2 -2
  14. data/test/mpfr_thypot.rb +60 -0
  15. data/test/tc_cmp.rb +1 -1
  16. data/test/tc_constants.rb +1 -1
  17. data/test/tc_division.rb +1 -1
  18. data/test/tc_f_abs_neg.rb +1 -1
  19. data/test/tc_f_arithmetics_coersion.rb +1 -1
  20. data/test/tc_f_precision.rb +2 -1
  21. data/test/tc_f_to_s.rb +1 -1
  22. data/test/tc_hashes.rb +1 -4
  23. data/test/tc_mpfr_cmp.rb +1 -1
  24. data/test/tc_mpfr_constants.rb +1 -1
  25. data/test/tc_mpfr_functions.rb +43 -10
  26. data/test/tc_mpfr_inf_nan_zero.rb +1 -1
  27. data/test/tc_mpfr_integer.rb +1 -1
  28. data/test/tc_mpfr_new_rounding.rb +24 -1
  29. data/test/tc_mpfr_pow.rb +17 -0
  30. data/test/tc_mpfr_random.rb +1 -1
  31. data/test/tc_mpfr_rounding.rb +1 -1
  32. data/test/tc_q.rb +53 -32
  33. data/test/tc_q_basic.rb +1 -1
  34. data/test/{tc_floor_ceil_truncate.rb → tc_q_floor_ceil_truncate.rb} +2 -2
  35. data/test/tc_q_num_den.rb +18 -0
  36. data/test/tc_random.rb +1 -4
  37. data/test/tc_sgn_neg_abs.rb +1 -1
  38. data/test/tc_swap.rb +1 -1
  39. data/test/tc_z.rb +1 -1
  40. data/test/tc_z_addmul.rb +1 -1
  41. data/test/tc_z_basic.rb +3 -2
  42. data/test/tc_z_exponentiation.rb +5 -5
  43. data/test/tc_z_export_import.rb +1 -1
  44. data/test/{tc_fib_fac_nextprime.rb → tc_z_fib_fac_nextprime.rb} +1 -1
  45. data/test/tc_z_functional_mappings.rb +2 -2
  46. data/test/tc_z_gcd_lcm_invert.rb +1 -1
  47. data/test/tc_z_hamdist.rb +1 -1
  48. data/test/tc_z_io.rb +2 -1
  49. data/test/tc_z_jac_leg_rem.rb +1 -1
  50. data/test/tc_z_logic.rb +1 -1
  51. data/test/{tc_logical_roots.rb → tc_z_logical_roots.rb} +7 -7
  52. data/test/tc_z_shifts_last_bits.rb +2 -2
  53. data/test/tc_z_submul.rb +1 -1
  54. data/test/tc_z_to_dis.rb +1 -1
  55. data/test/{tc_zerodivisionexceptions.rb → tc_zero_division_exceptions.rb} +2 -2
  56. data/test/unit_tests.rb +30 -17
  57. metadata +16 -16
  58. data/INSTALL +0 -4
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
2
 
3
- class TC_MPFR_Integer < Test::Unit::TestCase
3
+ class TcMpfrInteger < Test::Unit::TestCase
4
4
  def test_mpfr_integer_positive
5
5
  assert(GMP::F(1.0).integer?, "MPFR should decide whether a number is an integer correctly.")
6
6
  assert(GMP::F(2.0).integer?, "MPFR should decide whether a number is an integer correctly.")
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
2
 
3
- class TC_MPFR_New_Rounding < Test::Unit::TestCase
3
+ class TcMpfrNewRounding < Test::Unit::TestCase
4
4
  def test_new_fixnum
5
5
  ninety_six = GMP::F(96, 4)
6
6
  one_hundred_four = GMP::F(104, 4)
@@ -103,6 +103,29 @@ class TC_MPFR_New_Rounding < Test::Unit::TestCase
103
103
  assert_equal(a, oh107, "GMP::F.new should round with RNDU")
104
104
  end
105
105
 
106
+ def test_new_string
107
+ ohoh977 = GMP::F(0.977e-2, 4)
108
+ oh107 = GMP::F(0.107e-1, 4)
109
+
110
+ a = GMP::F("0.01", 4)
111
+ assert_equal(a, ohoh977, "GMP::F.new should default round with RNDN")
112
+
113
+ a = GMP::F("0.01", 4, 10)
114
+ assert_equal(a, ohoh977, "GMP::F.new should default round with RNDN")
115
+
116
+ a = GMP::F("0.01", 4, 10, GMP::GMP_RNDN)
117
+ assert_equal(a, ohoh977, "GMP::F.new should round with RNDN")
118
+
119
+ a = GMP::F("0.01", 4, 10, GMP::GMP_RNDD)
120
+ assert_equal(a, ohoh977, "GMP::F.new should round with RNDD")
121
+
122
+ a = GMP::F("0.01", 4, 10, GMP::GMP_RNDZ)
123
+ assert_equal(a, ohoh977, "GMP::F.new should round with RNDZ")
124
+
125
+ a = GMP::F("0.01", 4, 10, GMP::GMP_RNDU)
126
+ assert_equal(a, oh107, "GMP::F.new should round with RNDU")
127
+ end
128
+
106
129
  def test_new_mpfr
107
130
  ohoh977 = GMP::F(-0.977e-2, 4)
108
131
  oh107 = GMP::F(-0.107e-1, 4)
@@ -0,0 +1,17 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
+
3
+ class TcMpfrPow < Test::Unit::TestCase
4
+ def setup
5
+ @a = GMP::F(0.25)
6
+ end
7
+
8
+ def test_mpfr_pow
9
+ assert_equal(@a ** 2, 0.0625, "GMP::F#pow(x : Fixnum) calculates correctly.")
10
+ assert_equal(@a ** -2, 16, "GMP::F#pow(x : Fixnum) calculates correctly.")
11
+ assert_equal(@a ** 0, 1, "GMP::F#pow(x : Fixnum) calculates correctly.")
12
+ assert_equal(@a ** 0.5, 0.5, "GMP::F#pow(x : Float) calculates correctly.")
13
+ assert_equal(@a ** 0.0, 1, "GMP::F#pow(x : Float) calculates correctly.")
14
+ assert_equal(@a ** GMP::Z(2), 0.0625, "GMP::F#pow(x : GMP::Z) calculates correctly.")
15
+ assert_equal(@a ** GMP::Q(1, 2), 0.5, "GMP::F#pow(x : GMP::Q) calculates correctly.")
16
+ end
17
+ end
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
2
 
3
- class TC_MPFR_Random < Test::Unit::TestCase
3
+ class TcMpfrRandom < Test::Unit::TestCase
4
4
  def setup
5
5
  end
6
6
 
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
2
 
3
- class TC_MPFR_Rounding < Test::Unit::TestCase
3
+ class TcMpfrRounding < Test::Unit::TestCase
4
4
  def setup
5
5
  if GMP::MPFR_VERSION < "3.0.0"
6
6
  @prefix = "GMP"
@@ -1,18 +1,25 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
2
 
3
- class TC_Q < Test::Unit::TestCase
3
+ class TcRational < Test::Unit::TestCase
4
+ def setup
5
+ @z_1 = GMP::Z(1)
6
+ @z_2 = GMP::Z(2)
7
+ @z_neg_11 = GMP::Z(-11)
8
+
9
+ end
10
+
4
11
  def test_init_null
5
12
  assert_equal(GMP::Q.new(), 0, "GMP::Q.new() should initialize to 0")
6
13
  end
7
14
 
8
15
  def test_init_fixnum
9
- assert_equal(GMP::Q.new(1), 1, "GMP::Q.new(x : Fixnum) should initialize to 0")
16
+ assert_equal(GMP::Q.new( 1), 1, "GMP::Q.new(x) should accept a Fixnum")
17
+ assert_equal(GMP::Q.new(-11), -11, "GMP::Q.new(x) should accept a negative Fixnum")
10
18
  end
11
19
 
12
- def test_init_fixnum2
13
- assert_equal(GMP::Q.new(1, 2).to_s, "1/2", "GMP::Q.new(num : Fixnum, den : Fixnum) should initialize to num/den")
14
- assert_equal(GMP::Q.new(1, 3).to_s, "1/3", "GMP::Q.new(num : Fixnum, den : Fixnum) should initialize to num/den")
15
- assert_equal(GMP::Q.new(2, 4).to_s, "1/2", "GMP::Q.new(num : Fixnum, den : Fixnum) should initialize to num/den")
20
+ def test_init_z
21
+ assert_equal(GMP::Q.new(@z_1), 1, "GMP::Q.new(x) should accept a GMP::Z")
22
+ assert_equal(GMP::Q.new(@z_neg_11), -11, "GMP::Q.new(x) should accept a negative GMP::Z")
16
23
  end
17
24
 
18
25
  def test_init_string
@@ -21,33 +28,47 @@ class TC_Q < Test::Unit::TestCase
21
28
  end
22
29
 
23
30
  def test_init_q
24
- a = GMP::Q.new(1,2)
31
+ a = GMP::Q.new(1, 2)
25
32
  assert_equal(GMP::Q.new(a), a, "GMP::Q.new(x : Q) should initialize to x")
26
33
  end
34
+
35
+ def test_init_pair
36
+ assert_equal(GMP::Q.new(1, 2).to_s, "1/2", "GMP::Q.new(n : Fixnum, d : Fixnum) initializes correctly")
37
+ assert_equal(GMP::Q.new(1, 3).to_s, "1/3", "GMP::Q.new(n : Fixnum, d : Fixnum) initializes correctly")
38
+ assert_equal(GMP::Q.new(2, 4).to_s, "1/2", "GMP::Q.new(n : Fixnum, d : Fixnum) initializes correctly")
39
+ assert_equal(GMP::Q.new(1, 2).to_s, "1/2", "GMP::Q.new(n : Fixnum, d : Fixnum) initializes correctly")
40
+
41
+ assert_equal(GMP::Q.new(@z_1, 2).to_s, "1/2", "GMP::Q.new(n : GMP::Z, d : Fixnum) initializes correctly")
42
+ assert_equal(GMP::Q.new(@z_1, @z_2).to_s, "1/2", "GMP::Q.new(n : GMP::Z, d : GMP::Z) initializes correctly")
43
+ end
44
+
45
+ def test_bad_init
46
+ assert_raise(ArgumentError) { GMP::Q.new(1, 2, 3) }
47
+ end
27
48
 
28
49
  def test_neg
29
- a = GMP::Q( 1,2)
30
- neg_a = GMP::Q(-1,2)
50
+ a = GMP::Q( 1, 2)
51
+ neg_a = GMP::Q(-1, 2)
31
52
  assert_equal(neg_a, -a, "GMP::Q#-@ should work.")
32
53
  assert_equal(neg_a, a.neg, "GMP::Q#neg should work.")
33
54
  a.neg!
34
55
  assert_equal(neg_a, a, "GMP::Q#neg! should work.")
35
56
 
36
- b = GMP::Q(-4,3)
37
- neg_b = GMP::Q( 4,3)
57
+ b = GMP::Q(-4, 3)
58
+ neg_b = GMP::Q( 4, 3)
38
59
  assert_equal(neg_b, -b, "GMP::Q#-@ should work.")
39
60
  assert_equal(neg_b, b.neg, "GMP::Q#neg should work.")
40
61
  b.neg!
41
62
  assert_equal(neg_b, b, "GMP::Q#neg! should work.")
42
63
 
43
- c = GMP::Q( "9753108642/2")
64
+ c = GMP::Q( "9753108642/2")
44
65
  neg_c = GMP::Q("-9753108642/2")
45
66
  assert_equal(neg_c, -c, "GMP::Q#-@ should work.")
46
67
  assert_equal(neg_c, c.neg, "GMP::Q#neg should work.")
47
68
  c.neg!
48
69
  assert_equal(neg_c, c, "GMP::Q#neg! should work.")
49
70
 
50
- d = GMP::Q(0)
71
+ d = GMP::Q(0)
51
72
  neg_d = GMP::Q(0)
52
73
  assert_equal(neg_d, -d, "GMP::Q#-@ should work.")
53
74
  assert_equal(neg_d, d.neg, "GMP::Q#neg should work.")
@@ -56,25 +77,25 @@ class TC_Q < Test::Unit::TestCase
56
77
  end
57
78
 
58
79
  def test_abs
59
- a = GMP::Q(1,2)
60
- abs_a = GMP::Q(1,2)
80
+ a = GMP::Q(1, 2)
81
+ abs_a = GMP::Q(1, 2)
61
82
  assert_equal(abs_a, a.abs, "GMP::Q#abs should work.")
62
83
  a.abs!
63
84
  assert_equal(abs_a, a, "GMP::Q#abs! should work.")
64
85
 
65
- b = GMP::Q(-4,3)
66
- abs_b = GMP::Q( 4,3)
86
+ b = GMP::Q(-4, 3)
87
+ abs_b = GMP::Q( 4, 3)
67
88
  assert_equal(abs_b, b.abs, "GMP::Q#abs should work.")
68
89
  b.abs!
69
90
  assert_equal(abs_b, b, "GMP::Q#abs! should work.")
70
91
 
71
- c = GMP::Q("9753108642/2")
92
+ c = GMP::Q("9753108642/2")
72
93
  abs_c = GMP::Q("9753108642/2")
73
94
  assert_equal(abs_c, c.abs, "GMP::Q#abs should work.")
74
95
  c.abs!
75
96
  assert_equal(abs_c, c, "GMP::Q#abs! should work.")
76
97
 
77
- d = GMP::Q(0)
98
+ d = GMP::Q(0)
78
99
  abs_d = GMP::Q(0)
79
100
  assert_equal(abs_d, d.abs, "GMP::Q#abs should work.")
80
101
  d.abs!
@@ -82,19 +103,19 @@ class TC_Q < Test::Unit::TestCase
82
103
  end
83
104
 
84
105
  def test_inv
85
- a = GMP::Q(1,2)
106
+ a = GMP::Q(1,2)
86
107
  inv_a = GMP::Q(2,1)
87
108
  assert_equal(inv_a, a.inv, "GMP::Q#inv should work.")
88
109
  a.inv!
89
110
  assert_equal(inv_a, a, "GMP::Q#inv! should work.")
90
111
 
91
- b = GMP::Q(-4,3)
112
+ b = GMP::Q(-4,3)
92
113
  inv_b = GMP::Q(-3,4)
93
114
  assert_equal(inv_b, b.inv, "GMP::Q#inv should work.")
94
115
  b.inv!
95
116
  assert_equal(inv_b, b, "GMP::Q#inv! should work.")
96
117
 
97
- c = GMP::Q("9753108642/2")
118
+ c = GMP::Q("9753108642/2")
98
119
  inv_c = GMP::Q("2/9753108642")
99
120
  assert_equal(inv_c, c.inv, "GMP::Q#inv should work.")
100
121
  c.inv!
@@ -106,16 +127,16 @@ class TC_Q < Test::Unit::TestCase
106
127
  end
107
128
 
108
129
  def test_to_s
109
- assert_equal("1/2", GMP::Q(1,2).to_s, "GMP::Q should to_s properly.")
110
- assert_equal("1/4294967296", GMP::Q(1,2**32).to_s, "GMP::Q should to_s properly.")
111
- assert_equal("1/4294967296", GMP::Q(1,2**32).to_s, "GMP::Q should to_s properly.")
112
- assert_equal("-22/7", GMP::Q(-22,7).to_s, "GMP::Q should to_s properly.")
113
- assert_equal("-22/7", GMP::Q(22,-7).to_s, "GMP::Q should to_s properly.")
114
- assert_equal("22/7", GMP::Q(-22,-7).to_s, "GMP::Q should to_s properly.")
115
- assert_equal("0", GMP::Q(0,1).to_s, "GMP::Q should to_s properly.")
116
- assert_equal("0", GMP::Q(0,2000).to_s, "GMP::Q should to_s properly.")
117
- assert_equal("0", GMP::Q(0,-2000).to_s, "GMP::Q should to_s properly.")
130
+ assert_equal("1/2", GMP::Q(1, 2).to_s, "GMP::Q should to_s properly.")
131
+ assert_equal("1/4294967296", GMP::Q(1, 2**32).to_s, "GMP::Q should to_s properly.")
132
+ assert_equal("1/4294967296", GMP::Q(1, 2**32).to_s, "GMP::Q should to_s properly.")
133
+ assert_equal("-22/7", GMP::Q(-22, 7).to_s, "GMP::Q should to_s properly.")
134
+ assert_equal("-22/7", GMP::Q(22, -7).to_s, "GMP::Q should to_s properly.")
135
+ assert_equal("22/7", GMP::Q(-22, -7).to_s, "GMP::Q should to_s properly.")
136
+ assert_equal("0", GMP::Q(0, 1).to_s, "GMP::Q should to_s properly.")
137
+ assert_equal("0", GMP::Q(0, 2000).to_s, "GMP::Q should to_s properly.")
138
+ assert_equal("0", GMP::Q(0, -2000).to_s, "GMP::Q should to_s properly.")
118
139
 
119
- assert_equal("1/2", GMP::Q(1,2).inspect, "GMP::Q should inspect properly.")
140
+ assert_equal("1/2", GMP::Q(1, 2).inspect, "GMP::Q should inspect properly.")
120
141
  end
121
142
  end
@@ -1,7 +1,7 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
2
 
3
3
  # [Q op Q, Q op Z, Z op Q, Q op FixNum, Q op BigNum, FixNum op Q, BigNum op Q]
4
- class TC_Q_Basic < Test::Unit::TestCase
4
+ class TcRationalBasic < Test::Unit::TestCase
5
5
  def setup
6
6
  @a=GMP::Q.new(100,11)
7
7
  @b=GMP::Q.new(200,17)
@@ -1,12 +1,12 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
2
 
3
- class TC_floor_ceil_truncate < Test::Unit::TestCase
3
+ class TcRationalFloorCeilTruncate < Test::Unit::TestCase
4
4
  def setup
5
5
  @a = GMP::Q.new(200,11)
6
6
  @b = -@a
7
7
  @c = GMP::Q.new(70,10)
8
8
  end
9
-
9
+
10
10
  def test_floor_ceil_truncate
11
11
  assert_equal(@a.floor, 18, "GMP::Q should floor.")
12
12
  assert_equal(@a.ceil, 19, "GMP::Q should ceil.")
@@ -0,0 +1,18 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
+
3
+ class TcRationalDenNum < Test::Unit::TestCase
4
+ def setup
5
+ @p = GMP::Q.new(22, 7)
6
+ @q = GMP::Q.new(-0.625)
7
+ end
8
+
9
+ def test_num
10
+ assert_equal(@p.num, 22, "GMP::Q#num returns the numerator")
11
+ assert_equal(@q.num, -5, "GMP::Q#num returns the numerator")
12
+ end
13
+
14
+ def test_den
15
+ assert_equal(@p.den, 7, "GMP::Q#den returns the denominator")
16
+ assert_equal(@q.den, 8, "GMP::Q#den returns the denominator")
17
+ end
18
+ end
@@ -1,9 +1,6 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
2
 
3
- class TC_Random < Test::Unit::TestCase
4
- def setup
5
- end
6
-
3
+ class TcRandom < Test::Unit::TestCase
7
4
  def test_urandomb
8
5
  @a = GMP::RandState.new
9
6
  @a.seed(13579)
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
2
 
3
- class TC_sgn_neg_abs < Test::Unit::TestCase
3
+ class TcSgnNegAbs < Test::Unit::TestCase
4
4
  def setup
5
5
  @a=GMP::Z.new(10)
6
6
  @b=GMP::Z.new()
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
2
 
3
- class TC_swap < Test::Unit::TestCase
3
+ class TcSwap < Test::Unit::TestCase
4
4
  def setup
5
5
  @a=GMP::Z.new(100)
6
6
  @b=GMP::Z.new(200)
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
2
 
3
- class TC_Z < Test::Unit::TestCase
3
+ class TcInteger < Test::Unit::TestCase
4
4
  def test_init_null
5
5
  assert_equal(GMP::Z.new(), 0, "GMP::Z.new() should initialize to 0")
6
6
  end
@@ -4,7 +4,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
4
4
  # Z op (Fixnum,Z), Z op (Fixnum,Fixnum), Z op (Fixnum,Bignum)
5
5
  # Z op (Bignum,Z), Z op (Bignum,Bignum), Z op (Bignum,Fixnum)]
6
6
  # Things are tested both ways because the implementation is asymetrical
7
- class TC_Z_Addmul < Test::Unit::TestCase
7
+ class TcIntegerAddmul < Test::Unit::TestCase
8
8
  def setup
9
9
  @_64bit = 1_000_000_000_000.is_a? Fixnum
10
10
  end
@@ -2,7 +2,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
2
 
3
3
  # Tested: [Z op Z, Z op FixNum, Z op BigNum, FixNum op Z, BigNum op Z]
4
4
  # Things are tested both ways because the implementation is asymetrical
5
- class TC_Z_Basic < Test::Unit::TestCase
5
+ class TcIntegerBasic < Test::Unit::TestCase
6
6
  def setup
7
7
  @a=GMP::Z.new(100)
8
8
  @b=GMP::Z.new(200)
@@ -27,7 +27,8 @@ class TC_Z_Basic < Test::Unit::TestCase
27
27
 
28
28
  def test_mul
29
29
  assert_equal(@a * @b, 100 * 200, "GMP::Z should multiply correctly")
30
- assert_equal(@a * 2, 100 * 2, "GMP::Z should multiply correctly")
30
+ assert_equal(@a * 2, 100 * 2, "GMP::Z should multiply correctly")
31
+ assert_equal(@a * -2, 100 * -2, "GMP::Z should multiply correctly")
31
32
  assert_equal(@a * @c, 100 * 2**32, "GMP::Z should multiply correctly")
32
33
  assert_equal( 2 * @a, 2 * 100, "GMP::Z should multiply correctly")
33
34
  assert_equal(@c * @a, 2**32 * 100, "GMP::Z should multiply correctly")
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
2
 
3
- class TC_Z_Exponentiation < Test::Unit::TestCase
3
+ class TcIntegerExponentiation < Test::Unit::TestCase
4
4
  def setup
5
5
  @a = GMP::Z.new(100)
6
6
  @b = GMP::Z.new(16)
@@ -14,9 +14,9 @@ class TC_Z_Exponentiation < Test::Unit::TestCase
14
14
  end
15
15
 
16
16
  def test_powmod
17
- assert_equal(GMP::Z(16), @a.powmod(2,256), "(a : GMP::Z).powmod((b : Fixnum), (c : Fixnum)) should work correctly")
18
- assert_equal(GMP::Z(76), @b.powmod(10,@a), "(a : GMP::Z).powmod((b : Fixnum), (c : GMP::Z)) should work correctly")
19
- assert_equal(GMP::Z(0), @a.powmod(@b,256), "(a : GMP::Z).powmod((b : GMP::Z), (c : Fixnum)) should work correctly")
20
- assert_equal(GMP::Z(0), @a.powmod(@b,@c), "(a : GMP::Z).powmod((b : GMP::Z), (c : GMP::Z)) should work correctly")
17
+ assert_equal(GMP::Z(16), @a.powmod(2,256), "GMP::Z#powmod((b : Fixnum), (c : Fixnum)) should work correctly")
18
+ assert_equal(GMP::Z(76), @b.powmod(10,@a), "GMP::Z#powmod((b : Fixnum), (c : GMP::Z)) should work correctly")
19
+ assert_equal(GMP::Z(0), @a.powmod(@b,256), "GMP::Z#powmod((b : GMP::Z), (c : Fixnum)) should work correctly")
20
+ assert_equal(GMP::Z(0), @a.powmod(@b,@c), "GMP::Z#powmod((b : GMP::Z), (c : GMP::Z)) should work correctly")
21
21
  end
22
22
  end
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
2
 
3
- class TC_Z_ExportImport < Test::Unit::TestCase
3
+ class TcIntegerExportImport < Test::Unit::TestCase
4
4
  def setup
5
5
  @a = GMP::Z.new(3)**40
6
6
  end
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
2
 
3
- class TC_fib_fac_nextprime < Test::Unit::TestCase
3
+ class TcFibFacNextprime < Test::Unit::TestCase
4
4
  def setup
5
5
  @z0 = GMP::Z.new( 0)
6
6
  @z1 = GMP::Z.new( 1)
@@ -1,10 +1,10 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
2
 
3
- class TC_Z_Functional_Mappings < Test::Unit::TestCase
3
+ class TcIntegerFunctionalMappings < Test::Unit::TestCase
4
4
  def setup
5
5
  @_64bit = 1_000_000_000_000.is_a? Fixnum
6
6
  @xp1 = 7
7
- @xp2 = 2**30 -1
7
+ @xp2 = 2**30 - 1
8
8
  @xn1 = -5
9
9
  @b1 = 2**70
10
10
  # TODO: Add edge cases along Fixnum/Bignum border!!
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
2
 
3
- class TC_Z_GCD_LCM_Invert < Test::Unit::TestCase
3
+ class TcIntegerGcdLcmInvert < Test::Unit::TestCase
4
4
  def setup
5
5
  @a = GMP::Z( 24) # 2^3 * 3
6
6
  @b = GMP::Z( 8) # 2^3
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
2
 
3
- class TC_Z_Hamdist < Test::Unit::TestCase
3
+ class TcIntegerHamdist < Test::Unit::TestCase
4
4
  def setup
5
5
  @z32 = GMP::Z(32) # 100000
6
6
  @z33 = GMP::Z(33) # 100001
@@ -5,7 +5,8 @@ if (RUBY_DESCRIPTION =~ /rubinius/i and RUBY_VERSION =~ /^1.8/) ||
5
5
  (RUBY_DESCRIPTION =~ /jruby/i)
6
6
  # Sorry charlie
7
7
  else
8
- class TC_Z_IO < Test::Unit::TestCase
8
+
9
+ class TcIntegerIo < Test::Unit::TestCase
9
10
  def setup
10
11
  @two_pow_100 = GMP::Z.pow(GMP::Z(2), 100)
11
12
  @three_pow_100 = GMP::Z.pow(GMP::Z(3), 100)
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
2
 
3
- class TC_Z_Jacobi_Legendre_Remove < Test::Unit::TestCase
3
+ class TcIntegerJacobiLegendreRemove < Test::Unit::TestCase
4
4
  def setup
5
5
  @one = GMP::Z(1)
6
6
  @two = GMP::Z(2)