From d6f60584ce8af85cf277f4403c1dab9f29187823 Mon Sep 17 00:00:00 2001 From: Marco Bodrato Date: Sun, 25 Oct 2020 18:27:49 +0100 Subject: tests/mpz/io.c: Test out-of-range bases for mpz_out_str --- tests/mpz/io.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'tests') 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); -- cgit v1.2.1