[Gmp-commit] /var/hg/gmp: tests: slightly wider coverage.
mercurial at gmplib.org
mercurial at gmplib.org
Thu May 17 15:21:07 CEST 2012
details: /var/hg/gmp/rev/dcc3d46fa395
changeset: 14977:dcc3d46fa395
user: Marco Bodrato <bodrato at mail.dm.unipi.it>
date: Thu May 17 14:54:04 2012 +0200
description:
tests: slightly wider coverage.
diffstat:
ChangeLog | 3 +++
tests/cxx/t-ops.cc | 1 +
tests/mpf/t-set.c | 4 +++-
tests/mpq/t-equal.c | 3 +++
4 files changed, 10 insertions(+), 1 deletions(-)
diffs (55 lines):
diff -r ad63ba1421f3 -r dcc3d46fa395 ChangeLog
--- a/ChangeLog Thu May 17 13:07:32 2012 +0200
+++ b/ChangeLog Thu May 17 14:54:04 2012 +0200
@@ -6,6 +6,9 @@
* tests/mpf/t-set_ui.c (check_data): LONG_HIGHBIT -> ULONG_HIGHBIT.
* tests/mpf/t-set.c (check_random): New check, both set and init_set.
+ * tests/cxx/t-ops.cc (check_mpq): Check squaring.
+ * tests/mpq/t-equal.c (check_various): Check different den-size.
+
2012-05-16 Torbjorn Granlund <tege at gmplib.org>
* tests/mpf/t-eq.c (check_random): New function, meat from old main().
diff -r ad63ba1421f3 -r dcc3d46fa395 tests/cxx/t-ops.cc
--- a/tests/cxx/t-ops.cc Thu May 17 13:07:32 2012 +0200
+++ b/tests/cxx/t-ops.cc Thu May 17 14:54:04 2012 +0200
@@ -494,6 +494,7 @@
mpq_class a(1, 3), b(3, 4);
mpq_class c;
c = a * b; ASSERT_ALWAYS(c == 0.25);
+ c = b * b; ASSERT_ALWAYS(c == 0.5625);
}
// operator/
diff -r ad63ba1421f3 -r dcc3d46fa395 tests/mpf/t-set.c
--- a/tests/mpf/t-set.c Thu May 17 13:07:32 2012 +0200
+++ b/tests/mpf/t-set.c Thu May 17 14:54:04 2012 +0200
@@ -58,11 +58,13 @@
for (test = 0; test < reps; test++)
{
- mpz_urandomb (z, rands, PRECBITS);
+ mpz_urandomb (z, rands, PRECBITS + 1);
precbits = mpz_get_ui (z) + 1;
mpz_urandomb (z, rands, precbits);
mpz_setbit (z, precbits - 1); /* make sure msb is set */
mpf_set_z (a, z);
+ if (precbits & 1)
+ mpf_neg (a, a);
mpz_urandomb (z, rands, PRECBITS);
mpf_div_2exp (a, a, mpz_get_ui (z) + 1);
mpz_urandomb (z, rands, PRECBITS);
diff -r ad63ba1421f3 -r dcc3d46fa395 tests/mpq/t-equal.c
--- a/tests/mpq/t-equal.c Thu May 17 13:07:32 2012 +0200
+++ b/tests/mpq/t-equal.c Thu May 17 14:54:04 2012 +0200
@@ -125,6 +125,9 @@
SET4 (x, 1,1,2,3,4, 3,88,5,6,7);
SET4 (y, 4,1,2,3,4, 3,99,5,6,7);
check_all (x, y, 0);
+ SET4 (x, 4,1,2,3,4, 3,88,5,6,7);
+ SET4 (y, 4,1,2,3,4, 2,99,5,6,7);
+ check_all (x, y, 0);
mpq_clear (x);
mpq_clear (y);
More information about the gmp-commit
mailing list