diff options
author | Torbjorn Granlund <tege@gmplib.org> | 2013-01-20 14:31:32 +0100 |
---|---|---|
committer | Torbjorn Granlund <tege@gmplib.org> | 2013-01-20 14:31:32 +0100 |
commit | 9db79306e85f6eaae87a35d84cfd1007d7dee174 (patch) | |
tree | b243c8b7eccebcd889ca96b7fd69d723b7c0a47f /tests | |
parent | f60842e11369f771f9ae59f5dd023dfc92b9f84f (diff) | |
download | gmp-9db79306e85f6eaae87a35d84cfd1007d7dee174.tar.gz |
(main): Make negative `test' index value mean divisor bits, for better small operands coverage.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mpn/t-div.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/tests/mpn/t-div.c b/tests/mpn/t-div.c index 4c593eb6a..b2ec08031 100644 --- a/tests/mpn/t-div.c +++ b/tests/mpn/t-div.c @@ -54,7 +54,7 @@ dumpy (mp_srcptr p, mp_size_t n) puts (""); } -static unsigned long test; +static signed long test; static void check_one (mp_ptr qp, mp_srcptr rp, @@ -84,7 +84,7 @@ check_one (mp_ptr qp, mp_srcptr rp, tvalue = "Q*D"; error: printf ("\r*******************************************************************************\n"); - printf ("%s failed test %lu: %s\n", fname, test, msg); + printf ("%s failed test %ld: %s\n", fname, test, msg); printf ("N= "); dumpy (np, nn); printf ("D= "); dumpy (dp, dn); printf ("Q= "); dumpy (qp, qn); @@ -147,12 +147,11 @@ main (int argc, char **argv) mp_ptr np, dup, dnp, qp, rp; mp_limb_t t; gmp_pi1_t dinv; - int count = COUNT; + long count = COUNT; mp_ptr scratch; mp_limb_t ran; mp_size_t alloc, itch; mp_limb_t rran0, rran1, qran0, qran1; - mp_limb_t dh; TMP_DECL; if (argc > 1) @@ -190,17 +189,14 @@ main (int argc, char **argv) alloc = 1; scratch = __GMP_ALLOCATE_FUNC_LIMBS (alloc); - for (test = 0; test < count;) + for (test = -300; test < count;) { - do - { - nbits = random_word (rands) % (maxnbits - GMP_NUMB_BITS) + 2 * GMP_NUMB_BITS; - if (maxdbits > nbits) - dbits = random_word (rands) % nbits + 1; - else - dbits = random_word (rands) % maxdbits + 1; - } - while (nbits < dbits); + nbits = random_word (rands) % (maxnbits - GMP_NUMB_BITS) + 2 * GMP_NUMB_BITS; + + if (test < 0) + dbits = (test + 300) % nbits + 1; + else + dbits = random_word (rands) % nbits % maxdbits + 1; #if RAND_UNIFORM #define RANDFUNC mpz_urandomb @@ -214,7 +210,7 @@ main (int argc, char **argv) dn = SIZ (d); dup = PTR (d); MPN_COPY (dnp, dup, dn); - dnp[dn - 1] |= GMP_NUMB_HIGHBIT; + dnp[dn - 1] |= GMP_NUMB_HIGHBIT; if (test % 2 == 0) { |