Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |