[Gmp-commit] /var/hg/gmp: mini-gmp/tests/t-limbs.c: Deeper testing.

mercurial at gmplib.org mercurial at gmplib.org
Mon Feb 10 07:55:25 UTC 2014


details:   /var/hg/gmp/rev/133eee634d4a
changeset: 16292:133eee634d4a
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Mon Feb 10 08:55:20 2014 +0100
description:
mini-gmp/tests/t-limbs.c: Deeper testing.

diffstat:

 mini-gmp/tests/t-limbs.c |  20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diffs (30 lines):

diff -r 8e41c39c9392 -r 133eee634d4a mini-gmp/tests/t-limbs.c
--- a/mini-gmp/tests/t-limbs.c	Mon Feb 10 08:29:49 2014 +0100
+++ b/mini-gmp/tests/t-limbs.c	Mon Feb 10 08:55:20 2014 +0100
@@ -83,6 +83,26 @@
 	  dump ("ref", ref);
 	  abort ();
 	}
+      if (mpz_getlimbn (res, mpz_size(a)) != mpz_limbs_read (res) [mpz_size(a)])
+	{
+	  fprintf (stderr, "getlimbn - limbs_read differ.\n");
+	  abort ();
+	}
+      if ((i % 4 == 0) && mpz_size (res) > 1)
+	{
+	  mpz_realloc2 (res, 1);
+	  if (mpz_cmp_ui (res, 0))
+	    {
+	      fprintf (stderr, "mpz_realloc2 did not clear res.\n");
+	      abort ();
+	    }
+	  mpz_limbs_finish (ref, 0);
+	  if (mpz_cmp_d (ref, 0))
+	    {
+	      fprintf (stderr, "mpz_limbs_finish did not clear res.\n");
+	      abort ();
+	    }
+	}
     }
   mpz_clear (a);
   mpz_clear (b);


More information about the gmp-commit mailing list