Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add tests for mpz_sub, mpz_sub_ui, and mpz_ui_sub
currently mpz_sub fails
  • Loading branch information
bubaflub committed Jun 15, 2011
1 parent ba972a3 commit 9967a90
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions t/integer/sub.t
@@ -0,0 +1,40 @@
$load "rosella/test.pbc";
$load "src/GMP/Integer.pbc";

namespace GMP {
class Integer;
}

class Test_GMP_Sub {
function test_mpz_sub() {
var x = new GMP.Integer();
var y = new GMP.Integer(30);
var z = new GMP.Integer(34);
mpz_sub(x, y, z);
int i = mpz_get_si(x);
self.assert.equal(i, -4);
}

function test_mpz_sub_ui() {
var x = new GMP.Integer();
var y = new GMP.Integer(30);
int z = 34;
mpz_sub_ui(x, y, z);
int i = mpz_get_si(x);
self.assert.equal(i, -4);
}

function test_mpz_ui_sub() {
var x = new GMP.Integer();
var y = new GMP.Integer(30);
int z = 34;
mpz_ui_sub(x, z, y);
int i = mpz_get_si(x);
self.assert.equal(i, 4);
}
}

function main[main]() {
using Rosella.Test.test;
test(class Test_GMP_Sub);
}

0 comments on commit 9967a90

Please sign in to comment.