[Gmp-commit] /var/hg/gmp: 2 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Fri Jan 18 11:55:01 CET 2013
details: /var/hg/gmp/rev/2e2435ca9fdf
changeset: 15291:2e2435ca9fdf
user: Torbjorn Granlund <tege at gmplib.org>
date: Fri Jan 18 11:54:30 2013 +0100
description:
Test mpz_divisible_p and mpz_divisible_ui_p.
details: /var/hg/gmp/rev/6898230ae9ba
changeset: 15292:6898230ae9ba
user: Torbjorn Granlund <tege at gmplib.org>
date: Fri Jan 18 11:54:53 2013 +0100
description:
ChangeLog
diffstat:
ChangeLog | 2 ++
mini-gmp/tests/t-div.c | 24 +++++++++++++++++++++++-
2 files changed, 25 insertions(+), 1 deletions(-)
diffs (65 lines):
diff -r 98225d7857b8 -r 6898230ae9ba ChangeLog
--- a/ChangeLog Fri Jan 18 10:44:43 2013 +0100
+++ b/ChangeLog Fri Jan 18 11:54:53 2013 +0100
@@ -1,5 +1,7 @@
2013-01-18 Torbjorn Granlund <tege at gmplib.org>
+ * mini-gmp/tests/t-div.c: Test mpz_divisible_p and mpz_divisible_ui_p.
+
* tests/tests.h (TESTS_REPS): Fix printf argument type clashes.
2013-01-16 Marco Bodrato <bodrato at mail.dm.unipi.it>
diff -r 98225d7857b8 -r 6898230ae9ba mini-gmp/tests/t-div.c
--- a/mini-gmp/tests/t-div.c Fri Jan 18 10:44:43 2013 +0100
+++ b/mini-gmp/tests/t-div.c Fri Jan 18 11:54:53 2013 +0100
@@ -1,6 +1,6 @@
/*
-Copyright 2012, Free Software Foundation, Inc.
+Copyright 2012, 2013 Free Software Foundation, Inc.
This file is part of the GNU MP Library test suite.
@@ -45,6 +45,7 @@
{
unsigned i;
mpz_t a, b, q, r, rq, rr;
+ int div_p;
hex_random_init ();
@@ -126,6 +127,17 @@
dump ("rref", rr);
abort ();
}
+
+ div_p = mpz_divisible_p (a, b);
+ if ((mpz_sgn (r) == 0) ^ (div_p != 0))
+ {
+ fprintf (stderr, "mpz_divisible_p failed:\n");
+ dump ("a", a);
+ dump ("b", b);
+ dump ("r ", r);
+ abort ();
+ }
+
if (mpz_fits_ulong_p (b))
{
mp_limb_t rl;
@@ -182,6 +194,16 @@
dump ("rref", rr);
abort ();
}
+
+ div_p = mpz_divisible_ui_p (a, mpz_get_ui (b));
+ if ((mpz_sgn (r) == 0) ^ (div_p != 0))
+ {
+ fprintf (stderr, "mpz_divisible_ui_p failed:\n");
+ dump ("a", a);
+ dump ("b", b);
+ dump ("r ", r);
+ abort ();
+ }
}
}
}
More information about the gmp-commit
mailing list