summaryrefslogtreecommitdiff
path: root/tests/mpz
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2016-11-25 14:08:18 +0100
committerMarc Glisse <marc.glisse@inria.fr>2016-11-25 14:08:18 +0100
commitf3fe1c1cce81fe6d841a028ee5f0a7b1ee1de478 (patch)
tree31b96be936ac6b76dfd9e73f48707c3a8e6ff7fc /tests/mpz
parent1163607ba5713976c331ab99b03cfa30ca926ca7 (diff)
downloadgmp-f3fe1c1cce81fe6d841a028ee5f0a7b1ee1de478.tar.gz
Allow mpz_gcdext (NULL, ...)
Diffstat (limited to 'tests/mpz')
-rw-r--r--tests/mpz/t-gcd.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/mpz/t-gcd.c b/tests/mpz/t-gcd.c
index ffc5f9863..cd42ab7c9 100644
--- a/tests/mpz/t-gcd.c
+++ b/tests/mpz/t-gcd.c
@@ -287,6 +287,17 @@ main (int argc, char **argv)
one_test (op1, op2, ref, i);
}
+ /* Check that we can use NULL as first argument of mpz_gcdext. */
+ mpz_set_si (op1, -10);
+ mpz_set_si (op2, 0);
+ mpz_gcdext (NULL, temp1, temp2, op1, op2);
+ ASSERT_ALWAYS (mpz_cmp_si (temp1, -1) == 0);
+ ASSERT_ALWAYS (mpz_cmp_si (temp2, 0) == 0);
+ mpz_set_si (op2, 6);
+ mpz_gcdext (NULL, temp1, temp2, op1, op2);
+ ASSERT_ALWAYS (mpz_cmp_si (temp1, 1) == 0);
+ ASSERT_ALWAYS (mpz_cmp_si (temp2, 2) == 0);
+
mpz_clears (bs, op1, op2, ref, gcd1, gcd2, temp1, temp2, temp3, s, NULL);
tests_end ();