diff options
author | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2020-10-25 18:27:49 +0100 |
---|---|---|
committer | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2020-10-25 18:27:49 +0100 |
commit | d6f60584ce8af85cf277f4403c1dab9f29187823 (patch) | |
tree | ff9183d069aa0395821ab25de530bfbd8de679bd /tests | |
parent | 2be31a21ddabddbf07834e20c3f3ca856f4e5ab6 (diff) | |
download | gmp-d6f60584ce8af85cf277f4403c1dab9f29187823.tar.gz |
tests/mpz/io.c: Test out-of-range bases for mpz_out_str
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mpz/io.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/mpz/io.c b/tests/mpz/io.c index 892f61d61..3522e9ddb 100644 --- a/tests/mpz/io.c +++ b/tests/mpz/io.c @@ -1,6 +1,7 @@ /* Test conversion and I/O using mpz_out_str and mpz_inp_str. -Copyright 1993, 1994, 1996, 2000, 2001, 2012 Free Software Foundation, Inc. +Copyright 1993, 1994, 1996, 2000, 2001, 2012, 2020 Free Software +Foundation, Inc. This file is part of the GNU MP Library test suite. @@ -63,6 +64,18 @@ main (int argc, char **argv) fp = fopen (FILENAME, "w+"); + if (mpz_out_str (fp, 63, op1) != 0) + { + printf ("mpz_out_str did not return 0 (error) with base > 62\n"); + abort (); + } + + if (mpz_out_str (fp, -37, op1) != 0) + { + printf ("mpz_out_str did not return 0 (error) with base < -37\n"); + abort (); + } + for (i = 0; i < reps; i++) { mpz_urandomb (bs, rands, 32); |