summary refs log tree commit diff
path: root/localedata
diff options
context:
space:
mode:
Diffstat (limited to 'localedata')
-rw-r--r--localedata/ChangeLog7
-rw-r--r--localedata/Makefile11
-rw-r--r--localedata/tst-wctype.c40
-rw-r--r--localedata/tst-wctype.input1
-rwxr-xr-xlocaledata/tst-wctype.sh30
5 files changed, 86 insertions, 3 deletions
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index 1555ccd217..b347763bd6 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,3 +1,10 @@
+2000-07-24  Ulrich Drepper  <drepper@redhat.com>
+
+	* Makefile: Add rules to build, run, and distribute tst-wctype.
+	* tst-wctype.c: New file.
+	* tst-wctype.input: New file.
+	* tst-wctype.sh: New file.
+
 2000-07-24  Jakub Jelinek  <jakub@redhat.com>
 
 	* locales/de_DE (LC_TIME): Use `Mit', not `Mot' as abbreviation
diff --git a/localedata/Makefile b/localedata/Makefile
index 87216d296f..1a24df978e 100644
--- a/localedata/Makefile
+++ b/localedata/Makefile
@@ -43,7 +43,7 @@ vpath %.h tests-mbwc
 
 test-srcs := collate-test xfrm-test tst-fmon tst-rpmatch tst-trans \
 	     tst-mbswcs1 tst-mbswcs2 tst-mbswcs3 tst-mbswcs4 tst-mbswcs5 \
-	     tst-ctype
+	     tst-ctype tst-wctype
 #test-input := de_DE.ISO-8859-1 da_DK.ISO-8859-1 fr_CA,2.13.ISO-8859-1 \
 #	      hr_HR.ISO-8859-2 # once it is fixed: cs_CZ.ISO-8859-2
 test-input := de_DE.ISO-8859-1 en_US.ISO-8859-1
@@ -70,7 +70,8 @@ distribute := CHECKSUMS README SUPPORTED ChangeLog			\
 	      th_TH.in cs_CZ.in tst-mbswcs.sh tst-trans.sh tst-ctype.sh \
 	      tst-ctype-de_DE.in $(wildcard tests-mbwc/*.[ch])		\
 	      $(addprefix tst-fmon-locales/tstfmon_,$(fmon-tests))	\
-	      gen-locale.sh show-ucs-data.c
+	      gen-locale.sh show-ucs-data.c				\
+	      tst-wctype.sh tst-wctype.input
 
 # Get $(inst_i18ndir) defined.
 include ../Makeconfig
@@ -136,7 +137,7 @@ $(addsuffix .out,$(addprefix $(objpfx),$(locale_test_suite))): %: \
 
 tests: $(objpfx)sort-test.out $(objpfx)tst-fmon.out $(objpfx)tst-locale.out \
        $(objpfx)tst-rpmatch.out $(objpfx)tst-trans.out \
-       $(objpfx)tst-mbswcs.out $(objpfx)tst-ctype.out
+       $(objpfx)tst-mbswcs.out $(objpfx)tst-ctype.out $(objpfx)tst-wctype.out
 
 $(objpfx)sort-test.out: sort-test.sh $(objpfx)collate-test $(objpfx)xfrm-test \
 		       $(test-input-data) $(addprefix $(objpfx),$(CTYPE_FILES))
@@ -166,6 +167,10 @@ $(objpfx)tst-ctype.out: tst-ctype.sh $(objpfx)tst-ctype \
 			$(objpfx)sort-test.out \
 			$(addprefix $(objpfx),$(CTYPE_FILES))
 	$(SHELL) -e $< $(common-objpfx) '$(built-program-cmd)'
+$(objpfx)tst-wctype.out: tst-wctype.sh $(objpfx)tst-wctype \
+			$(objpfx)sort-test.out tst-wctype.input \
+			$(addprefix $(objpfx),$(CTYPE_FILES))
+	$(SHELL) -e $< $(common-objpfx) '$(built-program-cmd)'
 endif
 
 # Sometimes the whole collection of locale files should be installed.
diff --git a/localedata/tst-wctype.c b/localedata/tst-wctype.c
new file mode 100644
index 0000000000..6c59a50427
--- /dev/null
+++ b/localedata/tst-wctype.c
@@ -0,0 +1,40 @@
+#include <error.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <wctype.h>
+
+int
+main (void)
+{
+  wctype_t wct;
+  wchar_t buf[1000];
+  int result = 1;
+
+  setlocale (LC_ALL, "");
+  wprintf (L"locale = %s\n", setlocale (LC_CTYPE, NULL));
+
+  wct = wctype ("jhira");
+  if (wct == 0)
+    error (EXIT_FAILURE, 0, "jhira: no such character class");
+
+  if (fgetws (buf, sizeof (buf) / sizeof (buf[0]), stdin) != NULL)
+    {
+      int n;
+
+      wprintf (L"buf[] = \"%ls\"\n", buf);
+
+      result = 0;
+
+      for (n = 0; buf[n] != L'\0'; ++n)
+	{
+	  wprintf (L"jhira(U%04lx = %lc) = %d\n", (long) buf[n], buf[n],
+		   iswctype (buf[n], wct));
+	  result |= ((buf[n] < 0xff && iswctype (buf[n], wct))
+		     || (buf[n] > 0xff && !iswctype (buf[n], wct)));
+	}
+    }
+
+  return result;
+}
diff --git a/localedata/tst-wctype.input b/localedata/tst-wctype.input
new file mode 100644
index 0000000000..a7b4928c39
--- /dev/null
+++ b/localedata/tst-wctype.input
@@ -0,0 +1 @@
+ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずabcdefghjklmnoprrstuvwxyz
diff --git a/localedata/tst-wctype.sh b/localedata/tst-wctype.sh
new file mode 100755
index 0000000000..ae32525e3f
--- /dev/null
+++ b/localedata/tst-wctype.sh
@@ -0,0 +1,30 @@
+#! /bin/sh
+# Test locale-define character classes.
+# Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+#
+# 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.
+
+common_objpfx=$1
+run_program_prefix=$2
+
+# Run the test program.
+LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
+LC_ALL=ja_JP.EUC-JP ${run_program_prefix} \
+  ${common_objpfx}localedata/tst-wctype < tst-wctype.input \
+    > ${common_objpfx}localedata/tst-wctype.out
+
+exit $?