mini-gmp test suite could be improved
Paul.Zimmermann at inria.fr
Wed Sep 5 08:08:21 UTC 2018
I noticed the mini-gmp test suite does not seem to contain any test of
mpz_add_ui with the unsigned long argument having more than 32 bits.
Indeed with the following change "make check" still says "All 25 tests passed"
(with the mini-gmp from gmp-6.1.2):
mpz_add_ui (mpz_t r, const mpz_t a, unsigned long b)
b = b % 0xffffffff;
if (a->_mp_size >= 0)
r->_mp_size = mpz_abs_add_ui (r, a, b);
r->_mp_size = -mpz_abs_sub_ui (r, a, b);
At least one test with ULONG_MAX would be welcome.
Maybe the same holds for other ui/si functions.
More information about the gmp-devel