From 99ef2719fb3d703fe38c4113cd7f5adec516dd3a Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Fri, 28 Oct 2016 20:29:21 +0200 Subject: test: remove test suite The test suite is now a developed in a separate git repository. See here: http://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng-test.git The test suite should be just like every other software compiled with the cross-toolchain. In the past strange problems where found when the test suite got build in the toolchain creation step. --- test/locale/Makefile | 8 - test/locale/Makefile.in | 29 -- test/locale/bug-iconv-trans.c | 68 --- test/locale/bug-usesetlocale.c | 38 -- test/locale/collate-test.c | 132 ----- test/locale/dump-ctype.c | 163 ------- test/locale/gen-unicode-ctype.c | 784 ------------------------------ test/locale/show-ucs-data.c | 62 --- test/locale/tst-C-locale.c | 497 ------------------- test/locale/tst-ctype-de_DE.ISO-8859-1.in | 56 --- test/locale/tst-ctype.c | 446 ----------------- test/locale/tst-digits.c | 248 ---------- test/locale/tst-fmon.c | 67 --- test/locale/tst-langinfo.c | 283 ----------- test/locale/tst-langinfo.input | 302 ------------ test/locale/tst-leaks.c | 18 - test/locale/tst-mbswcs1.c | 62 --- test/locale/tst-mbswcs2.c | 64 --- test/locale/tst-mbswcs3.c | 75 --- test/locale/tst-mbswcs4.c | 62 --- test/locale/tst-mbswcs5.c | 74 --- test/locale/tst-mbswcs6.c | 73 --- test/locale/tst-numeric.c | 73 --- test/locale/tst-rpmatch.c | 36 -- test/locale/tst-setlocale.c | 25 - test/locale/tst-sscanf.c | 56 --- test/locale/tst-strfmon1.c | 42 -- test/locale/tst-trans.c | 70 --- test/locale/tst-wctype.c | 143 ------ test/locale/tst-xlocale1.c | 75 --- test/locale/tst-xlocale2.c | 64 --- test/locale/tst_nl_langinfo.c | 296 ----------- test/locale/xfrm-test.c | 143 ------ 33 files changed, 4634 deletions(-) delete mode 100644 test/locale/Makefile delete mode 100644 test/locale/Makefile.in delete mode 100644 test/locale/bug-iconv-trans.c delete mode 100644 test/locale/bug-usesetlocale.c delete mode 100644 test/locale/collate-test.c delete mode 100644 test/locale/dump-ctype.c delete mode 100644 test/locale/gen-unicode-ctype.c delete mode 100644 test/locale/show-ucs-data.c delete mode 100644 test/locale/tst-C-locale.c delete mode 100644 test/locale/tst-ctype-de_DE.ISO-8859-1.in delete mode 100644 test/locale/tst-ctype.c delete mode 100644 test/locale/tst-digits.c delete mode 100644 test/locale/tst-fmon.c delete mode 100644 test/locale/tst-langinfo.c delete mode 100644 test/locale/tst-langinfo.input delete mode 100644 test/locale/tst-leaks.c delete mode 100644 test/locale/tst-mbswcs1.c delete mode 100644 test/locale/tst-mbswcs2.c delete mode 100644 test/locale/tst-mbswcs3.c delete mode 100644 test/locale/tst-mbswcs4.c delete mode 100644 test/locale/tst-mbswcs5.c delete mode 100644 test/locale/tst-mbswcs6.c delete mode 100644 test/locale/tst-numeric.c delete mode 100644 test/locale/tst-rpmatch.c delete mode 100644 test/locale/tst-setlocale.c delete mode 100644 test/locale/tst-sscanf.c delete mode 100644 test/locale/tst-strfmon1.c delete mode 100644 test/locale/tst-trans.c delete mode 100644 test/locale/tst-wctype.c delete mode 100644 test/locale/tst-xlocale1.c delete mode 100644 test/locale/tst-xlocale2.c delete mode 100644 test/locale/tst_nl_langinfo.c delete mode 100644 test/locale/xfrm-test.c (limited to 'test/locale') diff --git a/test/locale/Makefile b/test/locale/Makefile deleted file mode 100644 index 263f325b9..000000000 --- a/test/locale/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# uClibc locale tests -# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. - -top_builddir=../../ -top_srcdir=../../ -include ../Rules.mak --include Makefile.in -include ../Test.mak diff --git a/test/locale/Makefile.in b/test/locale/Makefile.in deleted file mode 100644 index 5a57ca54d..000000000 --- a/test/locale/Makefile.in +++ /dev/null @@ -1,29 +0,0 @@ -# uClibc locale tests -# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. -# tst_mbtowc tst_strcoll tst_strfmon tst_strxfrm \ - -TESTS := bug-iconv-trans bug-usesetlocale collate-test dump-ctype \ - gen-unicode-ctype show-ucs-data tst-ctype \ - tst-digits tst-fmon tst-langinfo tst-leaks tst-mbswcs1 \ - tst-mbswcs2 tst-mbswcs3 tst-mbswcs4 tst-mbswcs5 tst-mbswcs6 \ - tst_nl_langinfo tst-numeric tst-rpmatch tst-setlocale \ - tst-sscanf tst-strfmon1 tst-trans tst-wctype tst-xlocale1 \ - tst-xlocale2 xfrm-test - - -# NOTE: For now disabled some tests that are known not build -TESTS_DISABLED := tst-ctype tst-fmon tst-leaks tst-rpmatch tst-strfmon1 - -ifneq ($(UCLIBC_HAS_XLOCALE),y) -TESTS_DISABLED += bug-usesetlocale tst-xlocale1 tst-xlocale2 xfrm-test tst-C-locale -endif - -DODIFF_rint := 1 - -EXTRA_CFLAGS := -D__USE_GNU -fno-builtin - -OPTS_dump-ctype = C -OPTS_tst-ctype = < tst-ctype-de_DE.ISO-8859-1.in -OPTS_tst-langinfo = < tst-langinfo.input - -EXTRA_DIRS := C diff --git a/test/locale/bug-iconv-trans.c b/test/locale/bug-iconv-trans.c deleted file mode 100644 index 3886247c3..000000000 --- a/test/locale/bug-iconv-trans.c +++ /dev/null @@ -1,68 +0,0 @@ -#include -#include -#include -#include - -int -main (void) -{ - iconv_t cd; - const char str[] = "ÄäÖöÜüß"; - const char expected[] = "AEaeOEoeUEuess"; - char *inptr = (char *) str; - size_t inlen = strlen (str) + 1; - char outbuf[500]; - char *outptr = outbuf; - size_t outlen = sizeof (outbuf); - int result = 0; - size_t n; - - if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL) - { - puts ("setlocale failed"); - return 1; - } - - cd = iconv_open ("ANSI_X3.4-1968//TRANSLIT", "ISO-8859-1"); - if (cd == (iconv_t) -1) - { - puts ("iconv_open failed"); - return 1; - } - - n = iconv (cd, &inptr, &inlen, &outptr, &outlen); - if (n != 7) - { - if (n == (size_t) -1) - printf ("iconv() returned error: %m\n"); - else - printf ("iconv() returned %Zd, expected 7\n", n); - result = 1; - } - if (inlen != 0) - { - puts ("not all input consumed"); - result = 1; - } - else if (inptr - str != strlen (str) + 1) - { - printf ("inptr wrong, advanced by %td\n", inptr - str); - result = 1; - } - if (memcmp (outbuf, expected, sizeof (expected)) != 0) - { - printf ("result wrong: \"%.*s\", expected: \"%s\"\n", - (int) (sizeof (outbuf) - outlen), outbuf, expected); - result = 1; - } - else if (outlen != sizeof (outbuf) - sizeof (expected)) - { - printf ("outlen wrong: %Zd, expected %Zd\n", outlen, - sizeof (outbuf) - 15); - result = 1; - } - else - printf ("output is \"%s\" which is OK\n", outbuf); - - return result; -} diff --git a/test/locale/bug-usesetlocale.c b/test/locale/bug-usesetlocale.c deleted file mode 100644 index 0637067de..000000000 --- a/test/locale/bug-usesetlocale.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Test case for setlocale vs uselocale (LC_GLOBAL_LOCALE) bug. */ - -#define _GNU_SOURCE 1 -#include -#include -#include - -static int -do_test (void) -{ - __locale_t loc_new, loc_old; - - int first = !!isalpha(0xE4); - - setlocale (LC_ALL, "de_DE"); - - int global_de = !!isalpha(0xE4); - - loc_new = newlocale (1 << LC_ALL, "C", 0); - loc_old = uselocale (loc_new); - - int used_c = !!isalpha(0xE4); - - uselocale (loc_old); - - int used_global = !!isalpha(0xE4); - - printf ("started %d, after setlocale %d\n", first, global_de); - printf ("after uselocale %d, after LC_GLOBAL_LOCALE %d\n", - used_c, used_global); - - freelocale (loc_new); - return !(used_c == first && used_global == global_de); -} - - -#define TEST_FUNCTION do_test () -#include "test-skeleton.c" diff --git a/test/locale/collate-test.c b/test/locale/collate-test.c deleted file mode 100644 index a84974cef..000000000 --- a/test/locale/collate-test.c +++ /dev/null @@ -1,132 +0,0 @@ -/* Test collation function using real data. - Copyright (C) 1997, 1999, 2000, 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include -#include -#include -#include -#include - - -struct lines -{ - char *key; - char *line; -}; - -static int xstrcoll (const void *, const void *); - -int -main (int argc, char *argv[]) -{ - int result = 0; - size_t nstrings, nstrings_max; - struct lines *strings; - char *line = NULL; - size_t len = 0; - size_t n; - - if (argc < 2) - error (1, 0, "usage: %s ", argv[0]); - - setlocale (LC_ALL, ""); - - nstrings_max = 100; - nstrings = 0; - strings = (struct lines *) malloc (nstrings_max * sizeof (struct lines)); - if (strings == NULL) - { - perror (argv[0]); - exit (1); - } - - while (1) - { - int l; - if (getline (&line, &len, stdin) < 0) - break; - - if (nstrings == nstrings_max) - { - strings = (struct lines *) realloc (strings, - (nstrings_max *= 2) - * sizeof (*strings)); - if (strings == NULL) - { - perror (argv[0]); - exit (1); - } - } - strings[nstrings].line = strdup (line); - l = strcspn (line, ":(;"); - while (l > 0 && isspace (line[l - 1])) - --l; - strings[nstrings].key = strndup (line, l); - ++nstrings; - } - free (line); - - /* First shuffle. */ - srandom (atoi (argv[1])); - for (n = 0; n < 10 * nstrings; ++n) - { - int r1, r2, r; - size_t idx1 = random () % nstrings; - size_t idx2 = random () % nstrings; - struct lines tmp = strings[idx1]; - strings[idx1] = strings[idx2]; - strings[idx2] = tmp; - - /* While we are at it a first little test. */ - r1 = strcoll (strings[idx1].key, strings[idx2].key); - r2 = strcoll (strings[idx2].key, strings[idx1].key); - r = r1 * r2; - - if (r > 0 || (r == 0 && r1 != 0) || (r == 0 && r2 != 0)) - printf ("`%s' and `%s' collate wrong: %d vs. %d\n", - strings[idx1].key, strings[idx2].key, r1, r2); - } - - /* Now sort. */ - qsort (strings, nstrings, sizeof (struct lines), xstrcoll); - - /* Print the result. */ - for (n = 0; n < nstrings; ++n) - { - fputs (strings[n].line, stdout); - free (strings[n].line); - free (strings[n].key); - } - free (strings); - - return result; -} - - -static int -xstrcoll (ptr1, ptr2) - const void *ptr1; - const void *ptr2; -{ - const struct lines *l1 = (const struct lines *) ptr1; - const struct lines *l2 = (const struct lines *) ptr2; - - return strcoll (l1->key, l2->key); -} diff --git a/test/locale/dump-ctype.c b/test/locale/dump-ctype.c deleted file mode 100644 index 6cf96d81d..000000000 --- a/test/locale/dump-ctype.c +++ /dev/null @@ -1,163 +0,0 @@ -/* Dump the character classes and character maps of a locale to a bunch - of individual files which can be processed with diff, sed etc. - Copyright (C) 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Bruno Haible , 2000. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* Usage example: - $ dump-ctype de_DE.UTF-8 - */ - -#include -#include -#include -#include -#include -#include -#include - -static const char *program_name = "dump-ctype"; -static const char *locale; - -static const char *class_names[] = - { - "alnum", "alpha", "blank", "cntrl", "digit", "graph", "lower", - "print", "punct", "space", "upper", "xdigit" - }; - -static const char *map_names[] = - { - "tolower", "toupper", "totitle" - }; - -static void dump_class (const char *class_name) -{ - wctype_t class; - FILE *f; - unsigned int ch; - - class = wctype (class_name); - if (class == (wctype_t) 0) - { - fprintf (stderr, "%s %s: noexistent class %s\n", program_name, - locale, class_name); - return; - } - - f = fopen (class_name, "w"); - if (f == NULL) - { - fprintf (stderr, "%s %s: cannot open file %s/%s\n", program_name, - locale, locale, class_name); - exit (1); - } - - for (ch = 0; ch < 0x10000; ch++) - if (iswctype (ch, class)) - fprintf (f, "0x%04X\n", ch); - - if (ferror (f) || fclose (f)) - { - fprintf (stderr, "%s %s: I/O error on file %s/%s\n", program_name, - locale, locale, class_name); - exit (1); - } -} - -static void dump_map (const char *map_name) -{ - wctrans_t map; - FILE *f; - unsigned int ch; - - map = wctrans (map_name); - if (map == (wctrans_t) 0) - { - fprintf (stderr, "%s %s: noexistent map %s\n", program_name, - locale, map_name); - return; - } - - f = fopen (map_name, "w"); - if (f == NULL) - { - fprintf (stderr, "%s %s: cannot open file %s/%s\n", program_name, - locale, locale, map_name); - exit (1); - } - - for (ch = 0; ch < 0x10000; ch++) - if (towctrans (ch, map) != ch) - fprintf (f, "0x%04X\t0x%04X\n", ch, towctrans (ch, map)); - - if (ferror (f) || fclose (f)) - { - fprintf (stderr, "%s %s: I/O error on file %s/%s\n", program_name, - locale, locale, map_name); - exit (1); - } -} - -int -main (int argc, char *argv[]) -{ - size_t i; - - if (argc != 2) - { - fprintf (stderr, "Usage: dump-ctype locale\n"); - exit (1); - } - locale = argv[1]; - - if (setlocale (LC_ALL, locale) == NULL) - { - fprintf (stderr, "%s: setlocale cannot switch to locale %s\n", - program_name, locale); - exit (1); - } - - if (mkdir (locale, 0777) < 0) - { - char buf[100]; - int save_errno = errno; - - sprintf (buf, "%s: cannot create directory %s", program_name, locale); - errno = save_errno; - perror (buf); - exit (1); - } - - if (chdir (locale) < 0) - { - char buf[100]; - int save_errno = errno; - - sprintf (buf, "%s: cannot chdir to %s", program_name, locale); - errno = save_errno; - perror (buf); - exit (1); - } - - for (i = 0; i < sizeof (class_names) / sizeof (class_names[0]); i++) - dump_class (class_names[i]); - - for (i = 0; i < sizeof (map_names) / sizeof (map_names[0]); i++) - dump_map (map_names[i]); - - return 0; -} diff --git a/test/locale/gen-unicode-ctype.c b/test/locale/gen-unicode-ctype.c deleted file mode 100644 index 0c74e6a7e..000000000 --- a/test/locale/gen-unicode-ctype.c +++ /dev/null @@ -1,784 +0,0 @@ -/* Generate a Unicode conforming LC_CTYPE category from a UnicodeData file. - Copyright (C) 2000-2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Bruno Haible , 2000. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* Usage example: - $ gen-unicode /usr/local/share/Unidata/UnicodeData.txt 3.1 - */ - -#include -#include -#include -#include -#include - -/* This structure represents one line in the UnicodeData.txt file. */ -struct unicode_attribute -{ - const char *name; /* Character name */ - const char *category; /* General category */ - const char *combining; /* Canonical combining classes */ - const char *bidi; /* Bidirectional category */ - const char *decomposition; /* Character decomposition mapping */ - const char *decdigit; /* Decimal digit value */ - const char *digit; /* Digit value */ - const char *numeric; /* Numeric value */ - int mirrored; /* mirrored */ - const char *oldname; /* Old Unicode 1.0 name */ - const char *comment; /* Comment */ - unsigned int upper; /* Uppercase mapping */ - unsigned int lower; /* Lowercase mapping */ - unsigned int title; /* Titlecase mapping */ -}; - -/* Missing fields are represented with "" for strings, and NONE for - characters. */ -#define NONE (~(unsigned int)0) - -/* The entire contents of the UnicodeData.txt file. */ -struct unicode_attribute unicode_attributes [0x110000]; - -/* Stores in unicode_attributes[i] the values from the given fields. */ -static void -fill_attribute (unsigned int i, - const char *field1, const char *field2, - const char *field3, const char *field4, - const char *field5, const char *field6, - const char *field7, const char *field8, - const char *field9, const char *field10, - const char *field11, const char *field12, - const char *field13, const char *field14) -{ - struct unicode_attribute * uni; - - if (i >= 0x110000) - { - fprintf (stderr, "index too large\n"); - exit (1); - } - if (strcmp (field2, "Cs") == 0) - /* Surrogates are UTF-16 artefacts, not real characters. Ignore them. */ - return; - uni = &unicode_attributes[i]; - /* Copy the strings. */ - uni->name = strdup (field1); - uni->category = (field2[0] == '\0' ? "" : strdup (field2)); - uni->combining = (field3[0] == '\0' ? "" : strdup (field3)); - uni->bidi = (field4[0] == '\0' ? "" : strdup (field4)); - uni->decomposition = (field5[0] == '\0' ? "" : strdup (field5)); - uni->decdigit = (field6[0] == '\0' ? "" : strdup (field6)); - uni->digit = (field7[0] == '\0' ? "" : strdup (field7)); - uni->numeric = (field8[0] == '\0' ? "" : strdup (field8)); - uni->mirrored = (field9[0] == 'Y'); - uni->oldname = (field10[0] == '\0' ? "" : strdup (field10)); - uni->comment = (field11[0] == '\0' ? "" : strdup (field11)); - uni->upper = (field12[0] =='\0' ? NONE : strtoul (field12, NULL, 16)); - uni->lower = (field13[0] =='\0' ? NONE : strtoul (field13, NULL, 16)); - uni->title = (field14[0] =='\0' ? NONE : strtoul (field14, NULL, 16)); -} - -/* Maximum length of a field in the UnicodeData.txt file. */ -#define FIELDLEN 120 - -/* Reads the next field from STREAM. The buffer BUFFER has size FIELDLEN. - Reads up to (but excluding) DELIM. - Returns 1 when a field was successfully read, otherwise 0. */ -static int -getfield (FILE *stream, char *buffer, int delim) -{ - int count = 0; - int c; - - for (; (c = getc (stream)), (c != EOF && c != delim); ) - { - /* The original unicode.org UnicodeData.txt file happens to have - CR/LF line terminators. Silently convert to LF. */ - if (c == '\r') - continue; - - /* Put c into the buffer. */ - if (++count >= FIELDLEN - 1) - { - fprintf (stderr, "field too long\n"); - exit (1); - } - *buffer++ = c; - } - - if (c == EOF) - return 0; - - *buffer = '\0'; - return 1; -} - -/* Stores in unicode_attributes[] the entire contents of the UnicodeData.txt - file. */ -static void -fill_attributes (const char *unicodedata_filename) -{ - unsigned int i, j; - FILE *stream; - char field0[FIELDLEN]; - char field1[FIELDLEN]; - char field2[FIELDLEN]; - char field3[FIELDLEN]; - char field4[FIELDLEN]; - char field5[FIELDLEN]; - char field6[FIELDLEN]; - char field7[FIELDLEN]; - char field8[FIELDLEN]; - char field9[FIELDLEN]; - char field10[FIELDLEN]; - char field11[FIELDLEN]; - char field12[FIELDLEN]; - char field13[FIELDLEN]; - char field14[FIELDLEN]; - int lineno = 0; - - for (i = 0; i < 0x110000; i++) - unicode_attributes[i].name = NULL; - - stream = fopen (unicodedata_filename, "r"); - if (stream == NULL) - { - fprintf (stderr, "error during fopen of '%s'\n", unicodedata_filename); - exit (1); - } - - for (;;) - { - int n; - - lineno++; - n = getfield (stream, field0, ';'); - n += getfield (stream, field1, ';'); - n += getfield (stream, field2, ';'); - n += getfield (stream, field3, ';'); - n += getfield (stream, field4, ';'); - n += getfield (stream, field5, ';'); - n += getfield (stream, field6, ';'); - n += getfield (stream, field7, ';'); - n += getfield (stream, field8, ';'); - n += getfield (stream, field9, ';'); - n += getfield (stream, field10, ';'); - n += getfield (stream, field11, ';'); - n += getfield (stream, field12, ';'); - n += getfield (stream, field13, ';'); - n += getfield (stream, field14, '\n'); - if (n == 0) - break; - if (n != 15) - { - fprintf (stderr, "short line in'%s':%d\n", - unicodedata_filename, lineno); - exit (1); - } - i = strtoul (field0, NULL, 16); - if (field1[0] == '<' - && strlen (field1) >= 9 - && !strcmp (field1 + strlen(field1) - 8, ", First>")) - { - /* Deal with a range. */ - lineno++; - n = getfield (stream, field0, ';'); - n += getfield (stream, field1, ';'); - n += getfield (stream, field2, ';'); - n += getfield (stream, field3, ';'); - n += getfield (stream, field4, ';'); - n += getfield (stream, field5, ';'); - n += getfield (stream, field6, ';'); - n += getfield (stream, field7, ';'); - n += getfield (stream, field8, ';'); - n += getfield (stream, field9, ';'); - n += getfield (stream, field10, ';'); - n += getfield (stream, field11, ';'); - n += getfield (stream, field12, ';'); - n += getfield (stream, field13, ';'); - n += getfield (stream, field14, '\n'); - if (n != 15) - { - fprintf (stderr, "missing end range in '%s':%d\n", - unicodedata_filename, lineno); - exit (1); - } - if (!(field1[0] == '<' - && strlen (field1) >= 8 - && !strcmp (field1 + strlen (field1) - 7, ", Last>"))) - { - fprintf (stderr, "missing end range in '%s':%d\n", - unicodedata_filename, lineno); - exit (1); - } - field1[strlen (field1) - 7] = '\0'; - j = strtoul (field0, NULL, 16); - for (; i <= j; i++) - fill_attribute (i, field1+1, field2, field3, field4, field5, - field6, field7, field8, field9, field10, - field11, field12, field13, field14); - } - else - { - /* Single character line */ - fill_attribute (i, field1, field2, field3, field4, field5, - field6, field7, field8, field9, field10, - field11, field12, field13, field14); - } - } - if (ferror (stream) || fclose (stream)) - { - fprintf (stderr, "error reading from '%s'\n", unicodedata_filename); - exit (1); - } -} - -/* Character mappings. */ - -static unsigned int -to_upper (unsigned int ch) -{ - if (unicode_attributes[ch].name != NULL - && unicode_attributes[ch].upper != NONE) - return unicode_attributes[ch].upper; - else - return ch; -} - -static unsigned int -to_lower (unsigned int ch) -{ - if (unicode_attributes[ch].name != NULL - && unicode_attributes[ch].lower != NONE) - return unicode_attributes[ch].lower; - else - return ch; -} - -static unsigned int -to_title (unsigned int ch) -{ - if (unicode_attributes[ch].name != NULL - && unicode_attributes[ch].title != NONE) - return unicode_attributes[ch].title; - else - return ch; -} - -/* Character class properties. */ - -static bool -is_upper (unsigned int ch) -{ - return (to_lower (ch) != ch); -} - -static bool -is_lower (unsigned int ch) -{ - return (to_upper (ch) != ch) - /* is lowercase, but without simple to_upper mapping. */ - || (ch == 0x00DF); -} - -static bool -is_alpha (unsigned int ch) -{ - return (unicode_attributes[ch].name != NULL - && ((unicode_attributes[ch].category[0] == 'L' - /* Theppitak Karoonboonyanan says - , should belong to is_punct. */ - && (ch != 0x0E2F) && (ch != 0x0E46)) - /* Theppitak Karoonboonyanan says - , .., .. are is_alpha. */ - || (ch == 0x0E31) - || (ch >= 0x0E34 && ch <= 0x0E3A) - || (ch >= 0x0E47 && ch <= 0x0E4E) - /* Avoid warning for . */ - || (ch == 0x0345) - /* Avoid warnings for ... */ - || (unicode_attributes[ch].category[0] == 'N' - && unicode_attributes[ch].category[1] == 'l') - /* Avoid warnings for ... */ - || (unicode_attributes[ch].category[0] == 'S' - && unicode_attributes[ch].category[1] == 'o' - && strstr (unicode_attributes[ch].name, " LETTER ") - != NULL) - /* Consider all the non-ASCII digits as alphabetic. - ISO C 99 forbids us to have them in category "digit", - but we want iswalnum to return true on them. */ - || (unicode_attributes[ch].category[0] == 'N' - && unicode_attributes[ch].category[1] == 'd' - && !(ch >= 0x0030 && ch <= 0x0039)))); -} - -static bool -is_digit (unsigned int ch) -{ -#if 0 - return (unicode_attributes[ch].name != NULL - && unicode_attributes[ch].category[0] == 'N' - && unicode_attributes[ch].category[1] == 'd'); - /* Note: U+0BE7..U+0BEF and U+1369..U+1371 are digit systems without - a zero. Must add <0> in front of them by hand. */ -#else - /* SUSV2 gives us some freedom for the "digit" category, but ISO C 99 - takes it away: - 7.25.2.1.5: - The iswdigit function tests for any wide character that corresponds - to a decimal-digit character (as defined in 5.2.1). - 5.2.1: - the 10 decimal digits 0 1 2 3 4 5 6 7 8 9 - */ - return (ch >= 0x0030 && ch <= 0x0039); -#endif -} - -static bool -is_outdigit (unsigned int ch) -{ - return (ch >= 0x0030 && ch <= 0x0039); -} - -static bool -is_blank (unsigned int ch) -{ - return (ch == 0x0009 /* '\t' */ - /* Category Zs without mention of "" */ - || (unicode_attributes[ch].name != NULL - && unicode_attributes[ch].category[0] == 'Z' - && unicode_attributes[ch].category[1] == 's' - && !strstr (unicode_attributes[ch].decomposition, ""))); -} - -static bool -is_space (unsigned int ch) -{ - /* Don't make U+00A0 a space. Non-breaking space means that all programs - should treat it like a punctuation character, not like a space. */ - return (ch == 0x0020 /* ' ' */ - || ch == 0x000C /* '\f' */ - || ch == 0x000A /* '\n' */ - || ch == 0x000D /* '\r' */ - || ch == 0x0009 /* '\t' */ - || ch == 0x000B /* '\v' */ - /* Categories Zl, Zp, and Zs without mention of "" */ - || (unicode_attributes[ch].name != NULL - && unicode_attributes[ch].category[0] == 'Z' - && (unicode_attributes[ch].category[1] == 'l' - || unicode_attributes[ch].category[1] == 'p' - || (unicode_attributes[ch].category[1] == 's' - && !strstr (unicode_attributes[ch].decomposition, - ""))))); -} - -static bool -is_cntrl (unsigned int ch) -{ - return (unicode_attributes[ch].name != NULL - && (!strcmp (unicode_attributes[ch].name, "") - /* Categories Zl and Zp */ - || (unicode_attributes[ch].category[0] == 'Z' - && (unicode_attributes[ch].category[1] == 'l' - || unicode_attributes[ch].category[1] == 'p')))); -} - -static bool -is_xdigit (unsigned int ch) -{ -#if 0 - return is_digit (ch) - || (ch >= 0x0041 && ch <= 0x0046) - || (ch >= 0x0061 && ch <= 0x0066); -#else - /* SUSV2 gives us some freedom for the "xdigit" category, but ISO C 99 - takes it away: - 7.25.2.1.12: - The iswxdigit function tests for any wide character that corresponds - to a hexadecimal-digit character (as defined in 6.4.4.1). - 6.4.4.1: - hexadecimal-digit: one of 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F - */ - return (ch >= 0x0030 && ch <= 0x0039) - || (ch >= 0x0041 && ch <= 0x0046) - || (ch >= 0x0061 && ch <= 0x0066); -#endif -} - -static bool -is_graph (unsigned int ch) -{ - return (unicode_attributes[ch].name != NULL - && strcmp (unicode_attributes[ch].name, "") - && !is_space (ch)); -} - -static bool -is_print (unsigned int ch) -{ - return (unicode_attributes[ch].name != NULL - && strcmp (unicode_attributes[ch].name, "") - /* Categories Zl and Zp */ - && !(unicode_attributes[ch].name != NULL - && unicode_attributes[ch].category[0] == 'Z' - && (unicode_attributes[ch].category[1] == 'l' - || unicode_attributes[ch].category[1] == 'p'))); -} - -static bool -is_punct (unsigned int ch) -{ -#if 0 - return (unicode_attributes[ch].name != NULL - && unicode_attributes[ch].category[0] == 'P'); -#else - /* The traditional POSIX definition of punctuation is every graphic, - non-alphanumeric character. */ - return (is_graph (ch) && !is_alpha (ch) && !is_digit (ch)); -#endif -} - -static bool -is_combining (unsigned int ch) -{ - /* Up to Unicode 3.0.1 we took the Combining property from the PropList.txt - file. In 3.0.1 it was identical to the union of the general categories - "Mn", "Mc", "Me". In Unicode 3.1 this property has been dropped from the - PropList.txt file, so we take the latter definition. */ - return (unicode_attributes[ch].name != NULL - && unicode_attributes[ch].category[0] == 'M' - && (unicode_attributes[ch].category[1] == 'n' - || unicode_attributes[ch].category[1] == 'c' - || unicode_attributes[ch].category[1] == 'e')); -} - -static bool -is_combining_level3 (unsigned int ch) -{ - return is_combining (ch) - && !(unicode_attributes[ch].combining[0] != '\0' - && unicode_attributes[ch].combining[0] != '0' - && strtoul (unicode_attributes[ch].combining, NULL, 10) >= 200); -} - -/* Return the UCS symbol string for a Unicode character. */ -static const char * -ucs_symbol (unsigned int i) -{ - static char buf[11+1]; - - sprintf (buf, (i < 0x10000 ? "" : ""), i); - return buf; -} - -/* Return the UCS symbol range string for a Unicode characters interval. */ -static const char * -ucs_symbol_range (unsigned int low, unsigned int high) -{ - static char buf[24+1]; - - strcpy (buf, ucs_symbol (low)); - strcat (buf, ".."); - strcat (buf, ucs_symbol (high)); - return buf; -} - -/* Output a character class (= property) table. */ - -static void -output_charclass (FILE *stream, const char *classname, - bool (*func) (unsigned int)) -{ - char table[0x110000]; - unsigned int i; - bool need_semicolon; - const int max_column = 75; - int column; - - for (i = 0; i < 0x110000; i++) - table[i] = (int) func (i); - - fprintf (stream, "%s ", classname); - need_semicolon = false; - column = 1000; - for (i = 0; i < 0x110000; ) - { - if (!table[i]) - i++; - else - { - unsigned int low, high; - char buf[25]; - - low = i; - do - i++; - while (i < 0x110000 && table[i]); - high = i - 1; - - if (low == high) - strcpy (buf, ucs_symbol (low)); - else - strcpy (buf, ucs_symbol_range (low, high)); - - if (need_semicolon) - { - fprintf (stream, ";"); - column++; - } - - if (column + strlen (buf) > max_column) - { - fprintf (stream, "/\n "); - column = 3; - } - - fprintf (stream, "%s", buf); - column += strlen (buf); - need_semicolon = true; - } - } - fprintf (stream, "\n"); -} - -/* Output a character mapping table. */ - -static void -output_charmap (FILE *stream, const char *mapname, - unsigned int (*func) (unsigned int)) -{ - char table[0x110000]; - unsigned int i; - bool need_semicolon; - const int max_column = 75; - int column; - - for (i = 0; i < 0x110000; i++) - table[i] = (func (i) != i); - - fprintf (stream, "%s ", mapname); - need_semicolon = false; - column = 1000; - for (i = 0; i < 0x110000; i++) - if (table[i]) - { - char buf[25+1]; - - strcpy (buf, "("); - strcat (buf, ucs_symbol (i)); - strcat (buf, ","); - strcat (buf, ucs_symbol (func (i))); - strcat (buf, ")"); - - if (need_semicolon) - { - fprintf (stream, ";"); - column++; - } - - if (column + strlen (buf) > max_column) - { - fprintf (stream, "/\n "); - column = 3; - } - - fprintf (stream, "%s", buf); - column += strlen (buf); - need_semicolon = true; - } - fprintf (stream, "\n"); -} - -/* Output the width table. */ - -static void -output_widthmap (FILE *stream) -{ -} - -/* Output the tables to the given file. */ - -static void -output_tables (const char *filename, const char *version) -{ - FILE *stream; - unsigned int ch; - - stream = fopen (filename, "w"); - if (stream == NULL) - { - fprintf (stderr, "cannot open '%s' for writing\n", filename); - exit (1); - } - - fprintf (stream, "escape_char /\n"); - fprintf (stream, "comment_char %%\n"); - fprintf (stream, "\n"); - fprintf (stream, "%% Generated automatically by gen-unicode-ctype for Unicode %s.\n", - version); - fprintf (stream, "\n"); - - fprintf (stream, "LC_IDENTIFICATION\n"); - fprintf (stream, "title \"Unicode %s FDCC-set\"\n", version); - fprintf (stream, "source \"UnicodeData.txt, PropList.txt\"\n"); - fprintf (stream, "address \"\"\n"); - fprintf (stream, "contact \"\"\n"); - fprintf (stream, "email \"bug-glibc-locales@gnu.org\"\n"); - fprintf (stream, "tel \"\"\n"); - fprintf (stream, "fax \"\"\n"); - fprintf (stream, "language \"\"\n"); - fprintf (stream, "territory \"Earth\"\n"); - fprintf (stream, "revision \"%s\"\n", version); - { - time_t now; - char date[11]; - now = time (NULL); - strftime (date, sizeof (date), "%Y-%m-%d", gmtime (&now)); - fprintf (stream, "date \"%s\"\n", date); - } - fprintf (stream, "category \"unicode:2001\";LC_CTYPE\n"); - fprintf (stream, "END LC_IDENTIFICATION\n"); - fprintf (stream, "\n"); - - /* Verifications. */ - for (ch = 0; ch < 0x110000; ch++) - { - /* toupper restriction: "Only characters specified for the keywords - lower and upper shall be specified. */ - if (to_upper (ch) != ch && !(is_lower (ch) || is_upper (ch))) - fprintf (stderr, - "%s is not upper|lower but toupper(0x%04X) = 0x%04X\n", - ucs_symbol (ch), ch, to_upper (ch)); - - /* tolower restriction: "Only characters specified for the keywords - lower and upper shall be specified. */ - if (to_lower (ch) != ch && !(is_lower (ch) || is_upper (ch))) - fprintf (stderr, - "%s is not upper|lower but tolower(0x%04X) = 0x%04X\n", - ucs_symbol (ch), ch, to_lower (ch)); - - /* alpha restriction: "Characters classified as either upper or lower - shall automatically belong to this class. */ - if ((is_lower (ch) || is_upper (ch)) && !is_alpha (ch)) - fprintf (stderr, "%s is upper|lower but not alpha\n", ucs_symbol (ch)); - - /* alpha restriction: "No character specified for the keywords cntrl, - digit, punct or space shall be specified." */ - if (is_alpha (ch) && is_cntrl (ch)) - fprintf (stderr, "%s is alpha and cntrl\n", ucs_symbol (ch)); - if (is_alpha (ch) && is_digit (ch)) - fprintf (stderr, "%s is alpha and digit\n", ucs_symbol (ch)); - if (is_alpha (ch) && is_punct (ch)) - fprintf (stderr, "%s is alpha and punct\n", ucs_symbol (ch)); - if (is_alpha (ch) && is_space (ch)) - fprintf (stderr, "%s is alpha and space\n", ucs_symbol (ch)); - - /* space restriction: "No character specified for the keywords upper, - lower, alpha, digit, graph or xdigit shall be specified." - upper, lower, alpha already checked above. */ - if (is_space (ch) && is_digit (ch)) - fprintf (stderr, "%s is space and digit\n", ucs_symbol (ch)); - if (is_space (ch) && is_graph (ch)) - fprintf (stderr, "%s is space and graph\n", ucs_symbol (ch)); - if (is_space (ch) && is_xdigit (ch)) - fprintf (stderr, "%s is space and xdigit\n", ucs_symbol (ch)); - - /* cntrl restriction: "No character specified for the keywords upper, - lower, alpha, digit, punct, graph, print or xdigit shall be - specified." upper, lower, alpha already checked above. */ - if (is_cntrl (ch) && is_digit (ch)) - fprintf (stderr, "%s is cntrl and digit\n", ucs_symbol (ch)); - if (is_cntrl (ch) && is_punct (ch)) - fprintf (stderr, "%s is cntrl and punct\n", ucs_symbol (ch)); - if (is_cntrl (ch) && is_graph (ch)) - fprintf (stderr, "%s is cntrl and graph\n", ucs_symbol (ch)); - if (is_cntrl (ch) && is_print (ch)) - fprintf (stderr, "%s is cntrl and print\n", ucs_symbol (ch)); - if (is_cntrl (ch) && is_xdigit (ch)) - fprintf (stderr, "%s is cntrl and xdigit\n", ucs_symbol (ch)); - - /* punct restriction: "No character specified for the keywords upper, - lower, alpha, digit, cntrl, xdigit or as the character shall - be specified." upper, lower, alpha, cntrl already checked above. */ - if (is_punct (ch) && is_digit (ch)) - fprintf (stderr, "%s is punct and digit\n", ucs_symbol (ch)); - if (is_punct (ch) && is_xdigit (ch)) - fprintf (stderr, "%s is punct and xdigit\n", ucs_symbol (ch)); - if (is_punct (ch) && (ch == 0x0020)) - fprintf (stderr, "%s is punct\n", ucs_symbol (ch)); - - /* graph restriction: "No character specified for the keyword cntrl - shall be specified." Already checked above. */ - - /* print restriction: "No character specified for the keyword cntrl - shall be specified." Already checked above. */ - - /* graph - print relation: differ only in the character. - How is this possible if there are more than one space character?! - I think susv2/xbd/locale.html should speak of "space characters", - not "space character". */ - if (is_print (ch) && !(is_graph (ch) || /* ch == 0x0020 */ is_space (ch))) - fprintf (stderr, - "%s is print but not graph|\n", ucs_symbol (ch)); - if (!is_print (ch) && (is_graph (ch) || ch == 0x0020)) - fprintf (stderr, - "%s is graph| but not print\n", ucs_symbol (ch)); - } - - fprintf (stream, "LC_CTYPE\n"); - output_charclass (stream, "upper", is_upper); - output_charclass (stream, "lower", is_lower); - output_charclass (stream, "alpha", is_alpha); - output_charclass (stream, "digit", is_digit); - output_charclass (stream, "outdigit", is_outdigit); - output_charclass (stream, "blank", is_blank); - output_charclass (stream, "space", is_space); - output_charclass (stream, "cntrl", is_cntrl); - output_charclass (stream, "punct", is_punct); - output_charclass (stream, "xdigit", is_xdigit); - output_charclass (stream, "graph", is_graph); - output_charclass (stream, "print", is_print); - output_charclass (stream, "class \"combining\";", is_combining); - output_charclass (stream, "class \"combining_level3\";", is_combining_level3); - output_charmap (stream, "toupper", to_upper); - output_charmap (stream, "tolower", to_lower); - output_charmap (stream, "map \"totitle\";", to_title); - output_widthmap (stream); - fprintf (stream, "END LC_CTYPE\n"); - - if (ferror (stream) || fclose (stream)) - { - fprintf (stderr, "error writing to '%s'\n", filename); - exit (1); - } -} - -int -main (int argc, char * argv[]) -{ - if (argc != 3) - { - fprintf (stderr, "Usage: %s UnicodeData.txt version\n", argv[0]); - exit (1); - } - - fill_attributes (argv[1]); - - output_tables ("unicode", argv[2]); - - return 0; -} diff --git a/test/locale/show-ucs-data.c b/test/locale/show-ucs-data.c deleted file mode 100644 index 9992ece42..000000000 --- a/test/locale/show-ucs-data.c +++ /dev/null @@ -1,62 +0,0 @@ -#include -#include -#include -#include - -int -main (int argc, char *argv[]) -{ - int n; - char *line = NULL; - size_t len = 0; - - for (n = 1; n < argc; ++n) - { - FILE *fp = fopen (argv[n], "r"); - if (fp == NULL) - continue; - - while (! feof (fp)) - { - ssize_t cnt = getline (&line, &len, fp); - char *runp; - if (cnt <= 0) - break; - - runp = line; - do - { - if (runp[0] == '<' && runp[1] == 'U' && isxdigit (runp[2]) - && isxdigit (runp[3]) && isxdigit (runp[4]) - && isxdigit (runp[5]) && runp[6] == '>') - { - unsigned int val = strtoul (runp + 2, NULL, 16); - - //putchar ('<'); - if (val < 128) - putchar (val); - else if (val < 0x800) - { - putchar (0xc0 | (val >> 6)); - putchar (0x80 | (val & 0x3f)); - } - else - { - putchar (0xe0 | (val >> 12)); - putchar (0x80 | ((val >> 6) & 0x3f)); - putchar (0x80 | (val & 0x3f)); - } - //putchar ('>'); - runp += 7; - } - else - putchar (*runp++); - } - while (runp < &line[cnt]); - } - - fclose (fp); - } - - return 0; -} diff --git a/test/locale/tst-C-locale.c b/test/locale/tst-C-locale.c deleted file mode 100644 index 282d53aac..000000000 --- a/test/locale/tst-C-locale.c +++ /dev/null @@ -1,497 +0,0 @@ -/* Tests of C and POSIX locale contents. - Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2000. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include -#include -#include -#include -#include -#include -#include - - -static int -run_test (const char *locname) -{ - struct lconv *lc; - const char *str; - const wchar_t *wstr; - int result = 0; - locale_t loc; - - /* ISO C stuff. */ - lc = localeconv (); - if (lc == NULL) - { - printf ("localeconv failed for locale %s\n", locname); - result = 1; - } - else - { -#define STRTEST(name, exp) \ - do \ - if (strcmp (lc->name, exp) != 0) \ - { \ - printf (#name " in locale %s wrong (is \"%s\", should be \"%s\")\n",\ - locname, lc->name, exp); \ - result = 1; \ - } \ - while (0) - STRTEST (decimal_point, "."); - STRTEST (thousands_sep, ""); - STRTEST (grouping, ""); - STRTEST (mon_decimal_point, ""); - STRTEST (mon_thousands_sep, ""); - STRTEST (mon_grouping, ""); - STRTEST (positive_sign, ""); - STRTEST (negative_sign, ""); - STRTEST (currency_symbol, ""); - STRTEST (int_curr_symbol, ""); - -#define CHARTEST(name, exp) \ - do \ - if (lc->name != exp) \ - { \ - printf (#name " in locale %s wrong (is %d, should be %d)\n", \ - locname, lc->name, CHAR_MAX); \ - result = 1; \ - } \ - while (0) - CHARTEST (frac_digits, CHAR_MAX); - CHARTEST (p_cs_precedes, CHAR_MAX); - CHARTEST (n_cs_precedes, CHAR_MAX); - CHARTEST (p_sep_by_space, CHAR_MAX); - CHARTEST (n_sep_by_space, CHAR_MAX); - CHARTEST (p_sign_posn, CHAR_MAX); - CHARTEST (n_sign_posn, CHAR_MAX); - CHARTEST (int_frac_digits, CHAR_MAX); - CHARTEST (int_p_cs_precedes, CHAR_MAX); - CHARTEST (int_n_cs_precedes, CHAR_MAX); - CHARTEST (int_p_sep_by_space, CHAR_MAX); - CHARTEST (int_n_sep_by_space, CHAR_MAX); - CHARTEST (int_p_sign_posn, CHAR_MAX); - CHARTEST (int_n_sign_posn, CHAR_MAX); - } - -#undef STRTEST -#define STRTEST(name, exp) \ - str = nl_langinfo (name); \ - if (strcmp (str, exp) != 0) \ - { \ - printf ("nl_langinfo(" #name ") in locale %s wrong " \ - "(is \"%s\", should be \"%s\")\n", locname, str, exp); \ - result = 1; \ - } -#define WSTRTEST(name, exp) \ - wstr = (wchar_t *) nl_langinfo (name); \ - if (wcscmp (wstr, exp) != 0) \ - { \ - printf ("nl_langinfo(" #name ") in locale %s wrong " \ - "(is \"%S\", should be \"%S\")\n", locname, wstr, exp); \ - result = 1; \ - } - - /* Unix stuff. */ - STRTEST (ABDAY_1, "Sun"); - STRTEST (ABDAY_2, "Mon"); - STRTEST (ABDAY_3, "Tue"); - STRTEST (ABDAY_4, "Wed"); - STRTEST (ABDAY_5, "Thu"); - STRTEST (ABDAY_6, "Fri"); - STRTEST (ABDAY_7, "Sat"); - STRTEST (DAY_1, "Sunday"); - STRTEST (DAY_2, "Monday"); - STRTEST (DAY_3, "Tuesday"); - STRTEST (DAY_4, "Wednesday"); - STRTEST (DAY_5, "Thursday"); - STRTEST (DAY_6, "Friday"); - STRTEST (DAY_7, "Saturday"); - STRTEST (ABMON_1, "Jan"); - STRTEST (ABMON_2, "Feb"); - STRTEST (ABMON_3, "Mar"); - STRTEST (ABMON_4, "Apr"); - STRTEST (ABMON_5, "May"); - STRTEST (ABMON_6, "Jun"); - STRTEST (ABMON_7, "Jul"); - STRTEST (ABMON_8, "Aug"); - STRTEST (ABMON_9, "Sep"); - STRTEST (ABMON_10, "Oct"); - STRTEST (ABMON_11, "Nov"); - STRTEST (ABMON_12, "Dec"); - STRTEST (MON_1, "January"); - STRTEST (MON_2, "February"); - STRTEST (MON_3, "March"); - STRTEST (MON_4, "April"); - STRTEST (MON_5, "May"); - STRTEST (MON_6, "June"); - STRTEST (MON_7, "July"); - STRTEST (MON_8, "August"); - STRTEST (MON_9, "September"); - STRTEST (MON_10, "October"); - STRTEST (MON_11, "November"); - STRTEST (MON_12, "December"); - STRTEST (AM_STR, "AM"); - STRTEST (PM_STR, "PM"); - STRTEST (D_T_FMT, "%a %b %e %H:%M:%S %Y"); - STRTEST (D_FMT, "%m/%d/%y"); - STRTEST (T_FMT, "%H:%M:%S"); - STRTEST (T_FMT_AMPM, "%I:%M:%S %p"); - STRTEST (ERA, ""); - STRTEST (ERA_D_FMT, ""); - STRTEST (ERA_T_FMT, ""); - STRTEST (ERA_D_T_FMT, ""); - STRTEST (ALT_DIGITS, ""); - - STRTEST (RADIXCHAR, "."); - STRTEST (THOUSEP, ""); - - STRTEST (YESEXPR, "^[yY]"); - STRTEST (NOEXPR, "^[nN]"); - - /* Extensions. */ - WSTRTEST (_NL_WABDAY_1, L"Sun"); - WSTRTEST (_NL_WABDAY_2, L"Mon"); - WSTRTEST (_NL_WABDAY_3, L"Tue"); - WSTRTEST (_NL_WABDAY_4, L"Wed"); - WSTRTEST (_NL_WABDAY_5, L"Thu"); - WSTRTEST (_NL_WABDAY_6, L"Fri"); - WSTRTEST (_NL_WABDAY_7, L"Sat"); - WSTRTEST (_NL_WDAY_1, L"Sunday"); - WSTRTEST (_NL_WDAY_2, L"Monday"); - WSTRTEST (_NL_WDAY_3, L"Tuesday"); - WSTRTEST (_NL_WDAY_4, L"Wednesday"); - WSTRTEST (_NL_WDAY_5, L"Thursday"); - WSTRTEST (_NL_WDAY_6, L"Friday"); - WSTRTEST (_NL_WDAY_7, L"Saturday"); - WSTRTEST (_NL_WABMON_1, L"Jan"); - WSTRTEST (_NL_WABMON_2, L"Feb"); - WSTRTEST (_NL_WABMON_3, L"Mar"); - WSTRTEST (_NL_WABMON_4, L"Apr"); - WSTRTEST (_NL_WABMON_5, L"May"); - WSTRTEST (_NL_WABMON_6, L"Jun"); - WSTRTEST (_NL_WABMON_7, L"Jul"); - WSTRTEST (_NL_WABMON_8, L"Aug"); - WSTRTEST (_NL_WABMON_9, L"Sep"); - WSTRTEST (_NL_WABMON_10, L"Oct"); - WSTRTEST (_NL_WABMON_11, L"Nov"); - WSTRTEST (_NL_WABMON_12, L"Dec"); - WSTRTEST (_NL_WMON_1, L"January"); - WSTRTEST (_NL_WMON_2, L"February"); - WSTRTEST (_NL_WMON_3, L"March"); - WSTRTEST (_NL_WMON_4, L"April"); - WSTRTEST (_NL_WMON_5, L"May"); - WSTRTEST (_NL_WMON_6, L"June"); - WSTRTEST (_NL_WMON_7, L"July"); - WSTRTEST (_NL_WMON_8, L"August"); - WSTRTEST (_NL_WMON_9, L"September"); - WSTRTEST (_NL_WMON_10, L"October"); - WSTRTEST (_NL_WMON_11, L"November"); - WSTRTEST (_NL_WMON_12, L"December"); - WSTRTEST (_NL_WAM_STR, L"AM"); - WSTRTEST (_NL_WPM_STR, L"PM"); - WSTRTEST (_NL_WD_T_FMT, L"%a %b %e %H:%M:%S %Y"); - WSTRTEST (_NL_WD_FMT, L"%m/%d/%y"); - WSTRTEST (_NL_WT_FMT, L"%H:%M:%S"); - WSTRTEST (_NL_WT_FMT_AMPM, L"%I:%M:%S %p"); - WSTRTEST (_NL_WERA_D_FMT, L""); - WSTRTEST (_NL_WERA_T_FMT, L""); - WSTRTEST (_NL_WERA_D_T_FMT, L""); - WSTRTEST (_NL_WALT_DIGITS, L""); - - STRTEST (_DATE_FMT, "%a %b %e %H:%M:%S %Z %Y"); - WSTRTEST (_NL_W_DATE_FMT, L"%a %b %e %H:%M:%S %Z %Y"); - - STRTEST (INT_CURR_SYMBOL, ""); - STRTEST (CURRENCY_SYMBOL, ""); - STRTEST (MON_DECIMAL_POINT, ""); - STRTEST (MON_THOUSANDS_SEP, ""); - STRTEST (MON_GROUPING, ""); - STRTEST (POSITIVE_SIGN, ""); - STRTEST (NEGATIVE_SIGN, ""); - STRTEST (GROUPING, ""); - - STRTEST (YESSTR, ""); - STRTEST (NOSTR, ""); - - /* Test the new locale mechanisms. */ - loc = newlocale (LC_ALL_MASK, locname, NULL); - if (loc == NULL) - { - printf ("cannot create locale object for locale %s\n", locname); - result = 1; - } - else - { - int c; - -#undef STRTEST -#define STRTEST(name, exp) \ - str = nl_langinfo_l (name, loc); \ - if (strcmp (str, exp) != 0) \ - { \ - printf ("nl_langinfo_l(" #name ") in locale %s wrong " \ - "(is \"%s\", should be \"%s\")\n", locname, str, exp); \ - result = 1; \ - } -#undef WSTRTEST -#define WSTRTEST(name, exp) \ - wstr = (wchar_t *) nl_langinfo_l (name, loc); \ - if (wcscmp (wstr, exp) != 0) \ - { \ - printf ("nl_langinfo_l(" #name ") in locale %s wrong " \ - "(is \"%S\", should be \"%S\")\n", locname, wstr, exp); \ - result = 1; \ - } - - /* Unix stuff. */ - STRTEST (ABDAY_1, "Sun"); - STRTEST (ABDAY_2, "Mon"); - STRTEST (ABDAY_3, "Tue"); - STRTEST (ABDAY_4, "Wed"); - STRTEST (ABDAY_5, "Thu"); - STRTEST (ABDAY_6, "Fri"); - STRTEST (ABDAY_7, "Sat"); - STRTEST (DAY_1, "Sunday"); - STRTEST (DAY_2, "Monday"); - STRTEST (DAY_3, "Tuesday"); - STRTEST (DAY_4, "Wednesday"); - STRTEST (DAY_5, "Thursday"); - STRTEST (DAY_6, "Friday"); - STRTEST (DAY_7, "Saturday"); - STRTEST (ABMON_1, "Jan"); - STRTEST (ABMON_2, "Feb"); - STRTEST (ABMON_3, "Mar"); - STRTEST (ABMON_4, "Apr"); - STRTEST (ABMON_5, "May"); - STRTEST (ABMON_6, "Jun"); - STRTEST (ABMON_7, "Jul"); - STRTEST (ABMON_8, "Aug"); - STRTEST (ABMON_9, "Sep"); - STRTEST (ABMON_10, "Oct"); - STRTEST (ABMON_11, "Nov"); - STRTEST (ABMON_12, "Dec"); - STRTEST (MON_1, "January"); - STRTEST (MON_2, "February"); - STRTEST (MON_3, "March"); - STRTEST (MON_4, "April"); - STRTEST (MON_5, "May"); - STRTEST (MON_6, "June"); - STRTEST (MON_7, "July"); - STRTEST (MON_8, "August"); - STRTEST (MON_9, "September"); - STRTEST (MON_10, "October"); - STRTEST (MON_11, "November"); - STRTEST (MON_12, "December"); - STRTEST (AM_STR, "AM"); - STRTEST (PM_STR, "PM"); - STRTEST (D_T_FMT, "%a %b %e %H:%M:%S %Y"); - STRTEST (D_FMT, "%m/%d/%y"); - STRTEST (T_FMT, "%H:%M:%S"); - STRTEST (T_FMT_AMPM, "%I:%M:%S %p"); - STRTEST (ERA, ""); - STRTEST (ERA_D_FMT, ""); - STRTEST (ERA_T_FMT, ""); - STRTEST (ERA_D_T_FMT, ""); - STRTEST (ALT_DIGITS, ""); - - STRTEST (RADIXCHAR, "."); - STRTEST (THOUSEP, ""); - - STRTEST (YESEXPR, "^[yY]"); - STRTEST (NOEXPR, "^[nN]"); - - /* Extensions. */ - WSTRTEST (_NL_WABDAY_1, L"Sun"); - WSTRTEST (_NL_WABDAY_2, L"Mon"); - WSTRTEST (_NL_WABDAY_3, L"Tue"); - WSTRTEST (_NL_WABDAY_4, L"Wed"); - WSTRTEST (_NL_WABDAY_5, L"Thu"); - WSTRTEST (_NL_WABDAY_6, L"Fri"); - WSTRTEST (_NL_WABDAY_7, L"Sat"); - WSTRTEST (_NL_WDAY_1, L"Sunday"); - WSTRTEST (_NL_WDAY_2, L"Monday"); - WSTRTEST (_NL_WDAY_3, L"Tuesday"); - WSTRTEST (_NL_WDAY_4, L"Wednesday"); - WSTRTEST (_NL_WDAY_5, L"Thursday"); - WSTRTEST (_NL_WDAY_6, L"Friday"); - WSTRTEST (_NL_WDAY_7, L"Saturday"); - WSTRTEST (_NL_WABMON_1, L"Jan"); - WSTRTEST (_NL_WABMON_2, L"Feb"); - WSTRTEST (_NL_WABMON_3, L"Mar"); - WSTRTEST (_NL_WABMON_4, L"Apr"); - WSTRTEST (_NL_WABMON_5, L"May"); - WSTRTEST (_NL_WABMON_6, L"Jun"); - WSTRTEST (_NL_WABMON_7, L"Jul"); - WSTRTEST (_NL_WABMON_8, L"Aug"); - WSTRTEST (_NL_WABMON_9, L"Sep"); - WSTRTEST (_NL_WABMON_10, L"Oct"); - WSTRTEST (_NL_WABMON_11, L"Nov"); - WSTRTEST (_NL_WABMON_12, L"Dec"); - WSTRTEST (_NL_WMON_1, L"January"); - WSTRTEST (_NL_WMON_2, L"February"); - WSTRTEST (_NL_WMON_3, L"March"); - WSTRTEST (_NL_WMON_4, L"April"); - WSTRTEST (_NL_WMON_5, L"May"); - WSTRTEST (_NL_WMON_6, L"June"); - WSTRTEST (_NL_WMON_7, L"July"); - WSTRTEST (_NL_WMON_8, L"August"); - WSTRTEST (_NL_WMON_9, L"September"); - WSTRTEST (_NL_WMON_10, L"October"); - WSTRTEST (_NL_WMON_11, L"November"); - WSTRTEST (_NL_WMON_12, L"December"); - WSTRTEST (_NL_WAM_STR, L"AM"); - WSTRTEST (_NL_WPM_STR, L"PM"); - WSTRTEST (_NL_WD_T_FMT, L"%a %b %e %H:%M:%S %Y"); - WSTRTEST (_NL_WD_FMT, L"%m/%d/%y"); - WSTRTEST (_NL_WT_FMT, L"%H:%M:%S"); - WSTRTEST (_NL_WT_FMT_AMPM, L"%I:%M:%S %p"); - WSTRTEST (_NL_WERA_D_FMT, L""); - WSTRTEST (_NL_WERA_T_FMT, L""); - WSTRTEST (_NL_WERA_D_T_FMT, L""); - WSTRTEST (_NL_WALT_DIGITS, L""); - - STRTEST (_DATE_FMT, "%a %b %e %H:%M:%S %Z %Y"); - WSTRTEST (_NL_W_DATE_FMT, L"%a %b %e %H:%M:%S %Z %Y"); - - STRTEST (INT_CURR_SYMBOL, ""); - STRTEST (CURRENCY_SYMBOL, ""); - STRTEST (MON_DECIMAL_POINT, ""); - STRTEST (MON_THOUSANDS_SEP, ""); - STRTEST (MON_GROUPING, ""); - STRTEST (POSITIVE_SIGN, ""); - STRTEST (NEGATIVE_SIGN, ""); - STRTEST (GROUPING, ""); - - STRTEST (YESSTR, ""); - STRTEST (NOSTR, ""); - - /* Character class tests. */ - for (c = 0; c < 128; ++c) - { -#define CLASSTEST(name) \ - if (is##name (c) != is##name##_l (c, loc)) \ - { \ - printf ("is%s('\\%o') != is%s_l('\\%o')\n", \ - #name, c, #name, c); \ - result = 1; \ - } - CLASSTEST (alnum); - CLASSTEST (alpha); - CLASSTEST (blank); - CLASSTEST (cntrl); - CLASSTEST (digit); - CLASSTEST (lower); - CLASSTEST (graph); - CLASSTEST (print); - CLASSTEST (punct); - CLASSTEST (space); - CLASSTEST (upper); - CLASSTEST (xdigit); - - /* Character mapping tests. */ -#define MAPTEST(name) \ - if (to##name (c) != to##name##_l (c, loc)) \ - { \ - printf ("to%s('\\%o') != to%s_l('\\%o'): '\\%o' vs '\\%o'\n", \ - #name, c, #name, c, \ - to##name (c), to##name##_l (c, loc)); \ - result = 1; \ - } - MAPTEST (lower); - MAPTEST (upper); - } - - /* Character class tests, this time for wide characters. Note that - this only works because we know that the internal encoding is - UCS4. */ - for (c = 0; c < 128; ++c) - { -#undef CLASSTEST -#define CLASSTEST(name) \ - if (isw##name (c) != isw##name##_l (c, loc)) \ - { \ - printf ("isw%s('\\%o') != isw%s_l('\\%o')\n", \ - #name, c, #name, c); \ - result = 1; \ - } - CLASSTEST (alnum); - CLASSTEST (alpha); - CLASSTEST (blank); - CLASSTEST (cntrl); - CLASSTEST (digit); - CLASSTEST (lower); - CLASSTEST (graph); - CLASSTEST (print); - CLASSTEST (punct); - CLASSTEST (space); - CLASSTEST (upper); - CLASSTEST (xdigit); - - /* Character mapping tests. Note that - this only works because we know that the internal encoding is - UCS4. */ -#undef MAPTEST -#define MAPTEST(name) \ - if (tow##name (c) != tow##name##_l (c, loc)) \ - { \ - printf ("tow%s('\\%o') != tow%s_l('\\%o'): '\\%o' vs '\\%o'\n",\ - #name, c, #name, c, \ - tow##name (c), tow##name##_l (c, loc)); \ - result = 1; \ - } - MAPTEST (lower); - MAPTEST (upper); - } - - freelocale (loc); - } - - return result; -} - - -static int -do_test (void) -{ - int result; - - /* First use the name "C". */ - if (setlocale (LC_ALL, "C") == NULL) - { - puts ("cannot set C locale"); - result = 1; - } - else - result = run_test ("C"); - - /* Then the name "POSIX". */ - if (setlocale (LC_ALL, "POSIX") == NULL) - { - puts ("cannot set POSIX locale"); - result = 1; - } - else - result |= run_test ("POSIX"); - - return result; -} - -#define TEST_FUNCTION do_test () -#include "../test-skeleton.c" diff --git a/test/locale/tst-ctype-de_DE.ISO-8859-1.in b/test/locale/tst-ctype-de_DE.ISO-8859-1.in deleted file mode 100644 index f71d76cc2..000000000 --- a/test/locale/tst-ctype-de_DE.ISO-8859-1.in +++ /dev/null @@ -1,56 +0,0 @@ -lower  ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ - 000000000000000000000100000000000000000000000000 -lower ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ - 000000000000000111111111111111111111111011111111 -upper  ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ - 000000000000000000000000000000001111111111111111 -upper ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ - 111111101111111000000000000000000000000000000000 -alpha  ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ - 000000000010000000000100001000001111111111111111 -alpha ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ - 111111101111111111111111111111111111111011111111 -digit  ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ - 000000000000000000000000000000000000000000000000 -digit ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ - 000000000000000000000000000000000000000000000000 -xdigit  ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ - 000000000000000000000000000000000000000000000000 -xdigit ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ - 000000000000000000000000000000000000000000000000 -space  ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ - 000000000000000000000000000000000000000000000000 -space ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ - 000000000000000000000000000000000000000000000000 -print  ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ - 111111111111111111111111111111111111111111111111 -print ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ - 111111111111111111111111111111111111111111111111 -graph  ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ - 111111111111111111111111111111111111111111111111 -graph ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ - 111111111111111111111111111111111111111111111111 -blank  ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ - 000000000000000000000000000000000000000000000000 -blank ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ - 000000000000000000000000000000000000000000000000 -cntrl  ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ - 000000000000000000000000000000000000000000000000 -cntrl ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ - 000000000000000000000000000000000000000000000000 -punct  ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ - 111111111101111111111011110111110000000000000000 -punct ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ - 000000010000000000000000000000000000000100000000 -alnum  ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ - 000000000010000000000100001000001111111111111111 -alnum ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ - 111111101111111111111111111111111111111011111111 -tolower  ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ -  ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿àáâãäåæçèéêëìíîï -tolower ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ - ðñòóôõö×øùúûüýþßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ -toupper  ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ -  ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ -toupper ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ - ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ÷ØÙÚÛÜÝÞÿ diff --git a/test/locale/tst-ctype.c b/test/locale/tst-ctype.c deleted file mode 100644 index d61739851..000000000 --- a/test/locale/tst-ctype.c +++ /dev/null @@ -1,446 +0,0 @@ -/* Copyright (C) 2000,02, 05 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 2000. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include -#include -#include -#include - - -static const char lower[] = "abcdefghijklmnopqrstuvwxyz"; -static const char upper[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; -static const char digits[] = "0123456789"; -static const char cntrl[] = "\ -\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\ -\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f "; - - -static struct classes -{ - const char *name; - int mask; -} classes[] = -{ -#define ENTRY(name) { #name, _IS##name } - ENTRY (upper), - ENTRY (lower), - ENTRY (alpha), - ENTRY (digit), - ENTRY (xdigit), - ENTRY (space), - ENTRY (print), - ENTRY (graph), - ENTRY (blank), - ENTRY (cntrl), - ENTRY (punct), - ENTRY (alnum) -}; -#define nclasses (sizeof (classes) / sizeof (classes[0])) - - -#define FAIL(str, args...) \ - { \ - printf (" " str "\n", ##args); \ - ++errors; \ - } - - -int -main (void) -{ - const char *cp; - const char *cp2; - int errors = 0; - char *inpline = NULL; - size_t inplinelen = 0; - char *resline = NULL; - size_t reslinelen = 0; - size_t n; - - setlocale (LC_ALL, ""); - - printf ("Testing the ctype data of the `%s' locale\n", - setlocale (LC_CTYPE, NULL)); - -#if 0 - /* Just for debugging. */ - - /* Contents of the class array. */ - printf ("\ -upper = %04x lower = %04x alpha = %04x digit = %04x xdigit = %04x\n\ -space = %04x print = %04x graph = %04x blank = %04x cntrl = %04x\n\ -punct = %04x alnum = %04x\n", - _ISupper, _ISlower, _ISalpha, _ISdigit, _ISxdigit, - _ISspace, _ISprint, _ISgraph, _ISblank, _IScntrl, - _ISpunct, _ISalnum); - - while (n < 256) - { - if (n % 8 == 0) - printf ("%02x: ", n); - printf ("%04x%s", __ctype_b[n], (n + 1) % 8 == 0 ? "\n" : " "); - ++n; - } -#endif - - puts (" Test of ASCII chara