diff options
author | Kevin Ryde <user42@zip.com.au> | 2004-04-21 21:42:15 +0200 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2004-04-21 21:42:15 +0200 |
commit | 0545baaa94f459a2484b50b4d81fc45771486eaa (patch) | |
tree | 1a17d418fb247fd0ffd41225424f4f009885803a /tests/rand | |
parent | 72100f45929ba89764c36629eb5f032a4f7e172b (diff) | |
download | gmp-0545baaa94f459a2484b50b4d81fc45771486eaa.tar.gz |
* tests/rand/t-lc2exp.c (check_bigc1): New test.
Diffstat (limited to 'tests/rand')
-rw-r--r-- | tests/rand/t-lc2exp.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/rand/t-lc2exp.c b/tests/rand/t-lc2exp.c index 62258c23b..4b6056481 100644 --- a/tests/rand/t-lc2exp.c +++ b/tests/rand/t-lc2exp.c @@ -117,6 +117,37 @@ check_bigc (void) gmp_randclear (r); } +void +check_bigc1 (void) +{ + gmp_randstate_t r; + mpz_t a; + unsigned long c, m2exp; + int i; + + mpz_init_set_ui (a, 0L); + c = ULONG_MAX; + m2exp = 2; + + gmp_randinit_lc_2exp (r, a, c, m2exp); + gmp_randseed_ui (r, 0L); + + for (i = 0; i < 20; i++) + { + mpz_urandomb (a, r, 1L); + if (mpz_cmp_ui (a, 1L) != 0) + { + printf ("check_bigc1: mpz_urandomb didn't give 1\n"); + printf (" m2exp=%lu\n", m2exp); + gmp_printf (" got rand=%#ZX\n", a); + abort (); + } + } + + mpz_clear (a); + gmp_randclear (r); +} + /* Checks parameters which triggered an assertion failure in the past. Happened when limbs(a)+limbs(c) < bits_to_limbs(m2exp). */ void @@ -177,6 +208,7 @@ main (void) check_nega (); check_bigc (); + check_bigc1 (); check_bigm (); check_bigs (); |