gmp 0.5.41 → 0.5.47
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +21 -0
- data/FEATURES.html +37 -38
- data/README.html +511 -0
- data/README.markdown +494 -0
- data/benchmark/divide +0 -0
- data/benchmark/gcd +0 -0
- data/benchmark/multiply +0 -0
- data/benchmark/multiply.fnl +0 -0
- data/benchmark/multiply.gc +0 -0
- data/benchmark/pi +0 -0
- data/benchmark/rsa +0 -0
- data/benchmark/runbench +0 -0
- data/benchmark/srb.sh +0 -0
- data/ext/gmp.c +0 -42
- data/ext/gmpf.c +64 -33
- data/ext/gmpq.c +88 -1
- data/ext/gmpz.c +151 -19
- data/ext/ruby_gmp.h +16 -10
- data/manual.pdf +0 -0
- data/manual.tex +50 -14
- data/test/gmp_tgcd.rb +18 -18
- data/test/mpfr_tcbrt.rb +1 -1
- data/test/mpfr_tconst_euler.rb +10 -7
- data/test/mpfr_tisnan.rb +1 -1
- data/test/mpfr_trec_sqrt.rb +1 -1
- data/test/mpfr_tsqrt.rb +1 -1
- data/test/tc_cmp.rb +7 -2
- data/test/tc_constants.rb +1 -1
- data/test/tc_division.rb +1 -1
- data/test/tc_f_arithmetics_coersion.rb +1 -1
- data/test/tc_f_precision.rb +1 -1
- data/test/tc_fib_fac_nextprime.rb +1 -1
- data/test/tc_floor_ceil_truncate.rb +1 -1
- data/test/tc_hashes.rb +26 -1
- data/test/tc_logical_roots.rb +1 -1
- data/test/tc_mpfr_constants.rb +1 -1
- data/test/tc_mpfr_functions.rb +1 -1
- data/test/tc_mpfr_random.rb +1 -1
- data/test/tc_mpfr_rounding.rb +3 -3
- data/test/tc_q.rb +1 -1
- data/test/tc_q_basic.rb +1 -1
- data/test/tc_random.rb +1 -1
- data/test/tc_sgn_neg_abs.rb +1 -1
- data/test/tc_swap.rb +1 -1
- data/test/tc_z.rb +34 -1
- data/test/tc_z_addmul.rb +1 -1
- data/test/tc_z_basic.rb +1 -1
- data/test/tc_z_exponentiation.rb +1 -1
- data/test/tc_z_functional_mappings.rb +42 -6
- data/test/tc_z_gcd_lcm_invert.rb +1 -1
- data/test/tc_z_jac_leg_rem.rb +1 -1
- data/test/tc_z_logic.rb +1 -1
- data/test/tc_z_shifts_last_bits.rb +1 -1
- data/test/tc_z_submul.rb +1 -1
- data/test/tc_z_to_dis.rb +1 -1
- data/test/tc_zerodivisionexceptions.rb +1 -1
- data/test/test_helper.rb +2 -1
- data/test/unit_tests.rb +1 -1
- metadata +70 -89
- data/README.rdoc +0 -450
data/test/gmp_tgcd.rb
CHANGED
@@ -1,64 +1,64 @@
|
|
1
|
-
require '
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
|
2
2
|
|
3
3
|
class GMP_TGCD < Test::Unit::TestCase
|
4
4
|
def setup
|
5
5
|
@rand_state = GMP::RandState.new
|
6
6
|
@min_operand_bitsize = 1
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
def one_test(op1, op2, ref, i)
|
10
10
|
g1, s, t = op1.gcdext(op2)
|
11
|
-
|
11
|
+
|
12
12
|
if ref# and ref != g1
|
13
13
|
assert_true(ref == g1, "GMP::Z#gcdext should work...")
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
gcdext_valid_p(op1, op2, g1, s)
|
17
|
-
|
17
|
+
|
18
18
|
g2 = op1.gcd(op2)
|
19
19
|
assert_equal(g1, g2, "gcd and gcdext should produce the same gcd.")
|
20
|
-
|
20
|
+
|
21
21
|
g2, temp1, temp2 = op1.gcdext(op2)
|
22
22
|
temp1 *= op1
|
23
23
|
temp2 *= op2
|
24
24
|
temp1 += temp2
|
25
25
|
assert_true(g1 == g2 || g2 == temp1, "gcdext should work...")
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
def gcdext_valid_p(a, b, g, s)
|
29
29
|
assert_true(g >= 0, "When [g, s, t] = a.gcdext(b), g must > 0 (g=#{g}, s=#{s}, a=#{a}, b=#{b})")
|
30
|
-
|
30
|
+
|
31
31
|
if a.sgn == 0
|
32
32
|
assert_true(g.cmpabs(b) == 0, "When [g, s, t] = a.gcdext(b), if a == 0, g must == |b|")
|
33
33
|
assert_true(s == 0, "When [g, s, t] = a.gcdext(b), if a == 0, s should == 0")
|
34
34
|
return
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
if b.sgn == 0
|
38
38
|
assert_true(g.cmpabs(a) == 0, "When [g, s, t] = a.gcdext(b), if b == 0, g must == |a|")
|
39
39
|
assert_true(s == a.sgn, "When [g, s, t] = a.gcdext(b), if a == 0, s should == a.sgn")
|
40
40
|
return
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
assert_false(g.sgn <= 0, "When [g, s, t] = a.gcdext(b), if neither a == 0 nor b == 0, g must > 0")
|
44
|
-
|
44
|
+
|
45
45
|
temp1 = a.tdiv(g)
|
46
46
|
temp3 = a.tmod(g)
|
47
47
|
assert_true(temp3.sgn == 0, "When [g, s, t] = a.gcdext(b), g must divide a.")
|
48
48
|
temp2 = b.tdiv(g)
|
49
49
|
temp3 = b.tmod(g)
|
50
50
|
assert_true(temp3.sgn == 0, "When [g, s, t] = a.gcdext(b), g must divide b.")
|
51
|
-
|
51
|
+
|
52
52
|
if GMP::GMP_VERSION > "4.3.1"
|
53
53
|
assert_true(s.cmpabs(GMP::Z(1)) == 0 || (s*2).abs.cmpabs(temp2) <= 0, "GMP::Z#gcdext should work: #{s}.cmpabs(1)==0 or (#{s*2}.abs.cmpabs(#{temp2})<=0")
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
temp2 = s * a
|
57
57
|
temp2 = g - temp2
|
58
58
|
temp3 = temp2.tmod(b)
|
59
59
|
temp2 = temp2.tdiv(b)
|
60
60
|
assert_true(temp3.sgn == 0, "When [g, s, t] = a.gcdext(b), g must divide a.")
|
61
|
-
|
61
|
+
|
62
62
|
if GMP::GMP_VERSION > "4.3.1"
|
63
63
|
assert_true(temp2.cmpabs(GMP::Z(1)) == 0 || (temp2*2).abs.cmpabs(temp1) <= 0, "GMP::Z#gcdext should work...")
|
64
64
|
end
|
@@ -67,13 +67,13 @@ class GMP_TGCD < Test::Unit::TestCase
|
|
67
67
|
def test_gcdext
|
68
68
|
reps = 200
|
69
69
|
#check_data
|
70
|
-
|
70
|
+
|
71
71
|
op2 = GMP::Z(GMP::GMP_NUMB_MAX)
|
72
72
|
op1 = op2 << 100
|
73
73
|
op1 += op2
|
74
74
|
op2 *= 2
|
75
75
|
one_test(op1, op2, nil, -1)
|
76
|
-
|
76
|
+
|
77
77
|
(0...reps).each do |i|
|
78
78
|
bs = @rand_state.urandomb(32)
|
79
79
|
size_range = bs.to_i % 17 + 2
|
@@ -81,10 +81,10 @@ class GMP_TGCD < Test::Unit::TestCase
|
|
81
81
|
op1 = @rand_state.urandomb(bs.to_i + @min_operand_bitsize)
|
82
82
|
bs = @rand_state.urandomb(size_range)
|
83
83
|
op2 = @rand_state.urandomb(bs.to_i + @min_operand_bitsize)
|
84
|
-
|
84
|
+
|
85
85
|
bs = @rand_state.urandomb(8)
|
86
86
|
bsi = bs.to_i
|
87
|
-
|
87
|
+
|
88
88
|
if bsi & 0x3c == 4
|
89
89
|
op1 *= op2
|
90
90
|
elsif bsi & 0x3c == 8
|
data/test/mpfr_tcbrt.rb
CHANGED
data/test/mpfr_tconst_euler.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
|
-
require '
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
|
2
2
|
|
3
3
|
class MPFR_TCONST_EULER < Test::Unit::TestCase
|
4
4
|
def setup
|
5
5
|
@rand_state = GMP::RandState.new
|
6
6
|
|
7
7
|
if GMP::MPFR_VERSION >= "3.0.0"
|
8
|
+
@rnd_modes = [GMP::MPFR_RNDN, GMP::MPFR_RNDZ, GMP::MPFR_RNDU, GMP::MPFR_RNDD, GMP::MPFR_RNDA]
|
8
9
|
@mpfr_rnd_max = 5
|
9
10
|
else
|
11
|
+
@rnd_modes = [GMP::GMP_RNDN, GMP::GMP_RNDZ, GMP::GMP_RNDU, GMP::GMP_RNDD]
|
10
12
|
@mpfr_rnd_max = 4
|
11
13
|
end
|
12
14
|
end
|
@@ -23,13 +25,14 @@ class MPFR_TCONST_EULER < Test::Unit::TestCase
|
|
23
25
|
t = GMP::F(0, p)
|
24
26
|
yprec = p+10
|
25
27
|
|
26
|
-
(0...@mpfr_rnd_max).each do |rnd|
|
28
|
+
#(0...@mpfr_rnd_max).each do |rnd| # Can i emulate this?
|
29
|
+
(@rnd_modes).each do |rnd|
|
27
30
|
y.prec = yprec
|
28
|
-
GMP::F.const_euler(y, rnd)
|
29
|
-
err = rnd == GMP::GMP_RNDN ? yprec+1 : yprec
|
30
|
-
if y.can_round?(err, rnd, rnd, p)
|
31
|
-
|
32
|
-
end
|
31
|
+
#GMP::F.const_euler(y, rnd)
|
32
|
+
#err = rnd == GMP::GMP_RNDN ? yprec+1 : yprec
|
33
|
+
#if y.can_round?(err, rnd, rnd, p)
|
34
|
+
#
|
35
|
+
#end
|
33
36
|
end
|
34
37
|
end
|
35
38
|
end
|
data/test/mpfr_tisnan.rb
CHANGED
data/test/mpfr_trec_sqrt.rb
CHANGED
data/test/mpfr_tsqrt.rb
CHANGED
data/test/tc_cmp.rb
CHANGED
@@ -1,12 +1,17 @@
|
|
1
|
-
require '
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
|
2
2
|
|
3
3
|
class TC_Cmp < Test::Unit::TestCase
|
4
4
|
def setup
|
5
|
+
@_64bit = 1_000_000_000_000.is_a? Fixnum
|
5
6
|
@a=GMP::Z.new(180)
|
6
7
|
@c=GMP::Q.new(2000,11) # ~181.82
|
7
8
|
@d=GMP::Q.new(3000,17) # ~176.47
|
8
9
|
@e=700
|
9
|
-
@
|
10
|
+
if @_64bit
|
11
|
+
@f=2**64
|
12
|
+
else
|
13
|
+
@f=2**32
|
14
|
+
end
|
10
15
|
@g=GMP::Q(360,2)
|
11
16
|
end
|
12
17
|
|
data/test/tc_constants.rb
CHANGED
data/test/tc_division.rb
CHANGED
data/test/tc_f_precision.rb
CHANGED
data/test/tc_hashes.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
|
2
2
|
|
3
3
|
class TC_Hashes < Test::Unit::TestCase
|
4
4
|
def setup
|
@@ -27,4 +27,29 @@ class TC_Hashes < Test::Unit::TestCase
|
|
27
27
|
assert(h[GMP::Z(127)] == "GMP::Z")
|
28
28
|
assert(h["127"] == "String")
|
29
29
|
end
|
30
|
+
|
31
|
+
def test_q_hashes
|
32
|
+
h = {}
|
33
|
+
h[GMP::Q(1,4)] = [GMP::Q(16,64), GMP::Q(166,664)]
|
34
|
+
assert(h[GMP::Q(1,4)] != nil, "Newly created GMP::Zs should hash equally if they are equal.")
|
35
|
+
assert(h[GMP::Q(233,144)].nil?, "Newly created GMP::Zs should hash differently if they are different.")
|
36
|
+
10.times do
|
37
|
+
assert(GMP::Q(11,13).hash == GMP::Q(11,13).hash)
|
38
|
+
end
|
39
|
+
|
40
|
+
100.times do |i|
|
41
|
+
assert(GMP::Q(1,1).hash != GMP::Q(i,101).hash)
|
42
|
+
end
|
43
|
+
|
44
|
+
# GMP::Q(5,1) and "5" might (I think, 'do') hash the same, but should not be equal
|
45
|
+
assert(! GMP::Q(101,1).eql?("101"))
|
46
|
+
|
47
|
+
h["22/7"] = "String"
|
48
|
+
h[GMP::Q(22,7)] = "GMP::Z"
|
49
|
+
assert(h["22/7"] != "GMP::Z")
|
50
|
+
#assert(h[GMP::Q(22/7)] != "String") # caused segfaults, i swear!
|
51
|
+
assert(h[GMP::Q(22,7)] != "String")
|
52
|
+
assert(h[GMP::Q(22,7)] == "GMP::Z")
|
53
|
+
assert(h["22/7"] == "String")
|
54
|
+
end
|
30
55
|
end
|
data/test/tc_logical_roots.rb
CHANGED
data/test/tc_mpfr_constants.rb
CHANGED
data/test/tc_mpfr_functions.rb
CHANGED
data/test/tc_mpfr_random.rb
CHANGED
data/test/tc_mpfr_rounding.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
|
2
2
|
|
3
3
|
class TC_MPFR_Rounding < Test::Unit::TestCase
|
4
4
|
def setup
|
@@ -15,14 +15,14 @@ class TC_MPFR_Rounding < Test::Unit::TestCase
|
|
15
15
|
assert_equal(2, GMP::GMP_RNDU.mode, "GMP::Rnd.mode should be correct.")
|
16
16
|
assert_equal(3, GMP::GMP_RNDD.mode, "GMP::Rnd.mode should be correct.")
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
def test_rounding_name
|
20
20
|
assert_equal(@prefix+"_RNDN", GMP::GMP_RNDN.name, "GMP::Rnd.name should be correct.")
|
21
21
|
assert_equal(@prefix+"_RNDZ", GMP::GMP_RNDZ.name, "GMP::Rnd.name should be correct.")
|
22
22
|
assert_equal(@prefix+"_RNDU", GMP::GMP_RNDU.name, "GMP::Rnd.name should be correct.")
|
23
23
|
assert_equal(@prefix+"_RNDD", GMP::GMP_RNDD.name, "GMP::Rnd.name should be correct.")
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
def test_rounding_ieee754
|
27
27
|
assert_equal("roundTiesToEven", GMP::GMP_RNDN.ieee754, "GMP::Rnd.ieee754 should be correct.")
|
28
28
|
assert_equal("roundTowardZero", GMP::GMP_RNDZ.ieee754, "GMP::Rnd.ieee754 should be correct.")
|
data/test/tc_q.rb
CHANGED
data/test/tc_q_basic.rb
CHANGED
data/test/tc_random.rb
CHANGED
data/test/tc_sgn_neg_abs.rb
CHANGED
data/test/tc_swap.rb
CHANGED
data/test/tc_z.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
|
2
2
|
|
3
3
|
class TC_Z < Test::Unit::TestCase
|
4
4
|
def test_init_null
|
@@ -16,6 +16,39 @@ class TC_Z < Test::Unit::TestCase
|
|
16
16
|
|
17
17
|
def test_init_string
|
18
18
|
assert_equal(GMP::Z.new("1"), 1, "GMP::Z.new(x : String) should initialize to x")
|
19
|
+
assert_equal(GMP::Z.new("5000000000"), 5_000_000_000, "GMP::Z.new(x : String) bigger than 32-bit should initialize to x")
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_init_string_base
|
23
|
+
assert_equal( 42, GMP::Z.new("42", 0), "GMP::Z.new(x : String, 0) should initialize to x")
|
24
|
+
assert_equal( 42, GMP::Z.new("42", 10), "GMP::Z.new(x : String, 10) should initialize to x")
|
25
|
+
assert_equal( 32, GMP::Z.new("20", 16), "GMP::Z.new(x : String, 16) should initialize to x")
|
26
|
+
assert_equal(255, GMP::Z.new("FF", 16), "GMP::Z.new(x : String, 16), with uppercase A-F should initialize to x")
|
27
|
+
assert_equal(255, GMP::Z.new("ff", 16), "GMP::Z.new(x : String, 16), with lowercase a-f should initialize to x")
|
28
|
+
assert_equal(255, GMP::Z.new("7v", 32), "GMP::Z.new(x : String, 32), with lowercase a-v should initialize to x")
|
29
|
+
assert_equal(511, GMP::Z.new("fv", 32), "GMP::Z.new(x : String, 32), with lowercase a-v should initialize to x")
|
30
|
+
assert_equal( 71, GMP::Z.new("1Z", 36), "GMP::Z.new(x : String, 36), with uppercase A-Z should initialize to x")
|
31
|
+
assert_equal(512, GMP::Z.new("e8", 36), "GMP::Z.new(x : String, 36), with lowercase a-z should initialize to x")
|
32
|
+
assert_equal(523, GMP::Z.new("ej", 36), "GMP::Z.new(x : String, 36), with lowercase a-z should initialize to x")
|
33
|
+
assert_equal( 77, GMP::Z.new("1Z", 42), "GMP::Z.new(x : String, 42), with A-Z,a-f should initialize to x")
|
34
|
+
assert_equal( 78, GMP::Z.new("1a", 42), "GMP::Z.new(x : String, 42), with A-Z,a-f should initialize to x")
|
35
|
+
assert_equal( 83, GMP::Z.new("1f", 42), "GMP::Z.new(x : String, 42), with A-Z,a-f should initialize to x")
|
36
|
+
assert_equal( 84, GMP::Z.new("20", 42), "GMP::Z.new(x : String, 42), with A-Z,a-f should initialize to x")
|
37
|
+
assert_equal(115, GMP::Z.new("1v", 58), "GMP::Z.new(x : String, 58), with A-Z,a-v should initialize to x")
|
38
|
+
assert_equal(116, GMP::Z.new("20", 58), "GMP::Z.new(x : String, 58), with A-Z,a-v should initialize to x")
|
39
|
+
assert_equal(126, GMP::Z.new("2A", 58), "GMP::Z.new(x : String, 58), with A-Z,a-v should initialize to x")
|
40
|
+
assert_equal(151, GMP::Z.new("2Z", 58), "GMP::Z.new(x : String, 58), with A-Z,a-v should initialize to x")
|
41
|
+
assert_equal(152, GMP::Z.new("2a", 58), "GMP::Z.new(x : String, 58), with A-Z,a-v should initialize to x")
|
42
|
+
assert_equal(161, GMP::Z.new("2j", 58), "GMP::Z.new(x : String, 58), with A-Z,a-v should initialize to x")
|
43
|
+
assert_equal(171, GMP::Z.new("2t", 58), "GMP::Z.new(x : String, 58), with A-Z,a-v should initialize to x")
|
44
|
+
assert_equal(123, GMP::Z.new("1z", 62), "GMP::Z.new(x : String, 62), with A-Z,a-z should initialize to x")
|
45
|
+
assert_equal(124, GMP::Z.new("20", 62), "GMP::Z.new(x : String, 62), with A-Z,a-z should initialize to x")
|
46
|
+
assert_equal(134, GMP::Z.new("2A", 62), "GMP::Z.new(x : String, 62), with A-Z,a-z should initialize to x")
|
47
|
+
assert_equal(160, GMP::Z.new("2a", 62), "GMP::Z.new(x : String, 62), with A-Z,a-z should initialize to x")
|
48
|
+
assert_equal(169, GMP::Z.new("2j", 62), "GMP::Z.new(x : String, 62), with A-Z,a-z should initialize to x")
|
49
|
+
assert_equal(179, GMP::Z.new("2t", 62), "GMP::Z.new(x : String, 62), with A-Z,a-z should initialize to x")
|
50
|
+
assert_equal(185, GMP::Z.new("2z", 62), "GMP::Z.new(x : String, 62), with A-Z,a-z should initialize to x")
|
51
|
+
assert_equal(186, GMP::Z.new("30", 62), "GMP::Z.new(x : String, 62), with A-Z,a-z should initialize to x")
|
19
52
|
end
|
20
53
|
|
21
54
|
def test_init_bignum
|
data/test/tc_z_addmul.rb
CHANGED
data/test/tc_z_basic.rb
CHANGED
data/test/tc_z_exponentiation.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
require '
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
|
2
2
|
|
3
3
|
class TC_Z_Functional_Mappings < 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
8
|
@xn1 = -5
|
8
9
|
@b1 = 2**70
|
9
10
|
# TODO: Add edge cases along Fixnum/Bignum border!!
|
@@ -15,7 +16,7 @@ class TC_Z_Functional_Mappings < Test::Unit::TestCase
|
|
15
16
|
functions = [:add, :addmul, :submul, :divexact, :lcm]
|
16
17
|
rop = GMP::Z(0)
|
17
18
|
op1s = [@z1]
|
18
|
-
op2s = [@xp1, @xn1, @b1, @z1]
|
19
|
+
op2s = [@xp1, @xp2, @xn1, @b1, @z1]
|
19
20
|
functions.each do |f|
|
20
21
|
op1s.each do |op1|
|
21
22
|
op2s.each do |op2|
|
@@ -31,8 +32,8 @@ class TC_Z_Functional_Mappings < Test::Unit::TestCase
|
|
31
32
|
def test_FUNC_MAP__ZUI_ZUI__TO__Z__RETURNS__VOID
|
32
33
|
functions = [:sub]
|
33
34
|
rop = GMP::Z(0)
|
34
|
-
op1s = [@xp1, @xn1, @b1, @z1]
|
35
|
-
op2s = [@xp1, @xn1, @b1, @z1]
|
35
|
+
op1s = [@xp1, @xp2, @xn1, @b1, @z1]
|
36
|
+
op2s = [@xp1, @xp2, @xn1, @b1, @z1]
|
36
37
|
functions.each do |f|
|
37
38
|
op1s.each do |op1|
|
38
39
|
op2s.each do |op2|
|
@@ -49,7 +50,7 @@ class TC_Z_Functional_Mappings < Test::Unit::TestCase
|
|
49
50
|
functions = [:mul]
|
50
51
|
rop = GMP::Z(0)
|
51
52
|
op1s = [@z1]
|
52
|
-
op2s = [@xp1, @xn1, @b1, @z1]
|
53
|
+
op2s = [@xp1, @xp2, @xn1, @b1, @z1]
|
53
54
|
functions.each do |f|
|
54
55
|
op1s.each do |op1|
|
55
56
|
op2s.each do |op2|
|
@@ -68,7 +69,7 @@ class TC_Z_Functional_Mappings < Test::Unit::TestCase
|
|
68
69
|
op1s = [@z1]
|
69
70
|
functions.each do |f|
|
70
71
|
op1s.each do |op1|
|
71
|
-
op2s = [@xp1]
|
72
|
+
op2s = [@xp1, @xp2]
|
72
73
|
op2s.each do |op2|
|
73
74
|
assert_nothing_raised("GMP::Z.#{f.to_s} should not raise when passed (#{rop.class}, #{op1.class}, #{op2.class})") {
|
74
75
|
GMP::Z.send(f, rop, op1, op2)
|
@@ -97,4 +98,39 @@ class TC_Z_Functional_Mappings < Test::Unit::TestCase
|
|
97
98
|
end
|
98
99
|
end
|
99
100
|
end
|
101
|
+
|
102
|
+
# 09 mpz_t__mpz_t_or_ui__to__none__returns__int
|
103
|
+
def test_FUNC_MAP__Z_Z__TO__VOID__RETURNS__BOOL
|
104
|
+
functions = [:divisible?]
|
105
|
+
op1s = [@z1]
|
106
|
+
functions.each do |f|
|
107
|
+
op1s.each do |op1|
|
108
|
+
op2s = [@xp1, @xp2, @xn1, @b1, @z1]
|
109
|
+
op2s.each do |op2|
|
110
|
+
assert_nothing_raised("GMP::Z.#{f.to_s} should not raise when passed (#{op1.class}, #{op2.class})") {
|
111
|
+
GMP::Z.send(f, op1, op2)
|
112
|
+
}
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
# 11 mpz_t__mpz_t_or_ui__mpz_t_or_ui__to__none__returns__int
|
119
|
+
def test_FUNC_MAP__Z_ZXB_ZXB__TO__VOID__RETURNS__BOOL
|
120
|
+
functions = [:congruent?]
|
121
|
+
op1s = [@z1]
|
122
|
+
functions.each do |f|
|
123
|
+
op1s.each do |op1|
|
124
|
+
op2s = [@xp1, @xp2, @xn1, @b1, @z1]
|
125
|
+
op2s.each do |op2|
|
126
|
+
op3s = [@xp1, @xp2, @xn1, @b1, @z1]
|
127
|
+
op3s.each do |op3|
|
128
|
+
assert_nothing_raised("GMP::Z.#{f.to_s} should not raise when passed (#{op1.class}, #{op2.class}, #{op3.class})") {
|
129
|
+
GMP::Z.send(f, op1, op2, op3)
|
130
|
+
}
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
100
136
|
end
|