Copyright 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU MP Library test suite.
The GNU MP Library test suite is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
The GNU MP Library test suite is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
mpf_t got, want; long ftell_nread; int i, pre, post, j, got_nread, want_nread;
FILE *fp;
mpf_init (got);
mpf_init (want);
for (i = 0; i < numberof (data); i++)
{ for (pre = 0; pre <= 3; pre++)
{ for (post = 0; post <= 2; post++)
{
mpf_set_str_or_abort (want, data[i].want, 10);
MPF_CHECK_FORMAT (want);
/* create the file new each time to ensure its length is what
we want */
fp = fopen (FILENAME, "w+");
ASSERT_ALWAYS (fp != NULL); for (j = 0; j < pre; j++)
putc (' ', fp);
fputs (data[i].inp, fp); for (j = 0; j < post; j++)
putc (' ', fp);
fflush (fp);
ASSERT_ALWAYS (! ferror(fp));
/* if data[i].inp is a whole string to read and there's no post
whitespace then expect to have EOF */ if (post == 0 && data[i].want_nread == strlen(data[i].inp))
{ int c = getc(fp); if (c != EOF)
{
printf ("mpf_inp_str didn't read to EOF\n");
printf (" inp \"%s\"\n", data[i].inp);
printf (" base %d\n", data[i].base);
printf (" pre %d\n", pre);
printf (" post %d\n", post);
printf (" c '%c' %#x\n", c, c);
abort ();
}
}
/* only expect "pre" included in the count when non-zero */
want_nread = data[i].want_nread; if (want_nread != 0)
want_nread += pre;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.