diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | localedata/ChangeLog | 4 | ||||
-rw-r--r-- | localedata/tst-digits.c | 95 | ||||
-rw-r--r-- | stdio-common/Makefile | 4 |
4 files changed, 99 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog index 8f51dc8606..62373a8067 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,8 @@ * stdio-common/vfprintf.c: Rewrite buffer handling for integer printing. Change printing of numbers with locale specific digits to use new code in _i18n_number.h. + * stdio-common/Makefile (routines): Remove _i18n_itoa and + _i18n_itowa. * stdio-common/bug13.c: Improve messages. diff --git a/localedata/ChangeLog b/localedata/ChangeLog index 380a53fe5c..da0faca163 100644 --- a/localedata/ChangeLog +++ b/localedata/ChangeLog @@ -1,3 +1,7 @@ +2000-07-29 Ulrich Drepper <drepper@redhat.com> + + * tst-digits.c: Add ctype and wctype tests. + 2000-07-28 Ulrich Drepper <drepper@redhat.com> * Makefile (ld-test-names): Add test7. diff --git a/localedata/tst-digits.c b/localedata/tst-digits.c index 372e8acd8c..26a9474210 100644 --- a/localedata/tst-digits.c +++ b/localedata/tst-digits.c @@ -1,5 +1,26 @@ +/* Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@gnu.org>, 2000. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <ctype.h> #include <locale.h> #include <stdio.h> +#include <wctype.h> #include <sys/types.h> @@ -48,7 +69,8 @@ int main (void) { int cnt; - int printf_failures = 0; + int failures = 0; + int status; if (setlocale (LC_ALL, "test7") == NULL) { @@ -71,11 +93,76 @@ main (void) { printf ("%3d: got \"%s\", expected \"%s\"\n", cnt, buf, printf_int_tests[cnt].expected); - ++printf_failures; + ++failures; } } - printf ("\n%d failures in printf tests\n", printf_failures); + printf ("\n%d failures in printf tests\n", failures); + status = failures != 0; + + /* ctype tests. This makes sure that the multibyte chracter digit + representations are not handle in this table. */ + for (cnt = 0; cnt < 256; ++cnt) + if (cnt >= '0' && cnt <= '9') + { + if (! isdigit (cnt)) + { + printf ("isdigit ('%c') == 0\n", cnt); + ++failures; + } + } + else + { + if (isdigit (cnt)) + { + printf ("isdigit (%d) != 0\n", cnt); + ++failures; + } + } + + printf ("\n%d failures in ctype tests\n", failures); + status = failures != 0; + + /* wctype tests. This makes sure the second set of digits is also + recorded. */ + for (cnt = 0; cnt < 256; ++cnt) + if (cnt >= '0' && cnt <= '9') + { + if (! iswdigit (cnt)) + { + printf ("iswdigit (L'%c') == 0\n", cnt); + ++failures; + } + } + else + { + if (iswdigit (cnt)) + { + printf ("iswdigit (%d) != 0\n", cnt); + ++failures; + } + } + + for (cnt = 0x2070; cnt < 0x2090; ++cnt) + if (cnt >= 0x2080 && cnt <= 0x2089) + { + if (! iswdigit (cnt)) + { + printf ("iswdigit (U%04X) == 0\n", cnt); + ++failures; + } + } + else + { + if (iswdigit (cnt)) + { + printf ("iswdigit (U%04X) != 0\n", cnt); + ++failures; + } + } + + printf ("\n%d failures in wctype tests\n", failures); + status = failures != 0; - return printf_failures != 0; + return status; } diff --git a/stdio-common/Makefile b/stdio-common/Makefile index cde24ee94a..181c7ff54e 100644 --- a/stdio-common/Makefile +++ b/stdio-common/Makefile @@ -25,10 +25,10 @@ headers := printf.h routines := \ ctermid cuserid \ - _itoa _itowa _i18n_itoa _i18n_itowa itoa-digits itowa-digits \ + _itoa _itowa itoa-digits itowa-digits \ vfprintf vprintf printf_fp reg-printf printf-prs printf_fphex \ printf_size fprintf printf snprintf sprintf asprintf dprintf \ - vfscanf \ + vfscanf \ fscanf scanf sscanf \ perror psignal \ tmpfile tmpfile64 tmpnam tmpnam_r tempnam tempname \ |