Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/regress/lib/libc/locale Regression tests for libc locale (LC...



details:   https://anonhg.NetBSD.org/src/rev/977c6aada30e
branches:  trunk
changeset: 536219:977c6aada30e
user:      minoura <minoura%NetBSD.org@localhost>
date:      Wed Sep 11 14:54:33 2002 +0000

description:
Regression tests for libc locale (LC_CTYPE) functions.
Based on Citrus repository xpg4dl/test/*, written by tshiozak and yamt.

diffstat:

 regress/lib/libc/locale/Makefile                       |    5 +
 regress/lib/libc/locale/ctype1/Makefile                |   26 +++
 regress/lib/libc/locale/ctype1/ctype1.c                |   50 ++++++
 regress/lib/libc/locale/ctype1/en_US.UTF-8.exp.uu      |   13 +
 regress/lib/libc/locale/ctype1/en_US.UTF-8.in.uu       |    7 +
 regress/lib/libc/locale/ctype1/ja_JP.ISO2022-JP.exp.uu |   11 +
 regress/lib/libc/locale/ctype1/ja_JP.ISO2022-JP.in.uu  |    6 +
 regress/lib/libc/locale/ctype1/ja_JP.SJIS.exp.uu       |   10 +
 regress/lib/libc/locale/ctype1/ja_JP.SJIS.in.uu        |    6 +
 regress/lib/libc/locale/ctype1/ja_JP.eucJP.exp.uu      |   10 +
 regress/lib/libc/locale/ctype1/ja_JP.eucJP.in.uu       |    6 +
 regress/lib/libc/locale/ctype2/C.in.uu                 |    6 +
 regress/lib/libc/locale/ctype2/Makefile                |   27 +++
 regress/lib/libc/locale/ctype2/en_US.UTF-8.in.uu       |    7 +
 regress/lib/libc/locale/ctype2/ja_JP.ISO2022-JP2.in.uu |    6 +
 regress/lib/libc/locale/ctype2/ja_JP.SJIS.in.uu        |    6 +
 regress/lib/libc/locale/ctype2/ja_JP.eucJP.in.uu       |    6 +
 regress/lib/libc/locale/ctype2/mbrtowc.c               |  122 +++++++++++++++++
 regress/lib/libc/locale/ctype3/Makefile                |   29 ++++
 19 files changed, 359 insertions(+), 0 deletions(-)

diffs (truncated from 435 to 300 lines):

diff -r e62a533a9b9f -r 977c6aada30e regress/lib/libc/locale/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/lib/libc/locale/Makefile  Wed Sep 11 14:54:33 2002 +0000
@@ -0,0 +1,5 @@
+#      $NetBSD: Makefile,v 1.1 2002/09/11 14:54:33 minoura Exp $
+
+SUBDIR+= ctype1 ctype2 ctype3
+
+.include <bsd.subdir.mk>
diff -r e62a533a9b9f -r 977c6aada30e regress/lib/libc/locale/ctype1/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/lib/libc/locale/ctype1/Makefile   Wed Sep 11 14:54:33 2002 +0000
@@ -0,0 +1,26 @@
+PROG=          ctype1
+NOMAN=         # defined
+
+TESTS=         en_US.UTF-8 ja_JP.ISO2022-JP ja_JP.SJIS ja_JP.eucJP
+
+INPUTS=                ${TESTS:S/$/.in/}
+EXPECTS=       ${TESTS:S/$/.exp/}
+OUTPUTS=       ${TESTS:S/$/.out/}
+
+CLEANFILES+=   ${OUTPUTS} ${INPUTS} ${EXPECTS}
+
+regress: ${PROG} ${INPUTS} ${EXPECTS}
+.for L in ${TESTS}
+       @env LC_CTYPE=$L LC_ALL= LANG= ./${PROG} < $L.in > $L.out
+       @cmp $L.exp $L.out && echo "ok." 1>&2
+.endfor
+
+# paranoia: protect against non-ASCII characters
+.for L in ${TESTS}
+$L.in: $L.in.uu
+       uudecode ${.ALLSRC}
+$L.exp: $L.exp.uu
+       uudecode ${.ALLSRC}
+.endfor
+
+.include <bsd.prog.mk>
diff -r e62a533a9b9f -r 977c6aada30e regress/lib/libc/locale/ctype1/ctype1.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/lib/libc/locale/ctype1/ctype1.c   Wed Sep 11 14:54:33 2002 +0000
@@ -0,0 +1,50 @@
+/*     $NetBSD: ctype1.c,v 1.1 2002/09/11 14:54:34 minoura Exp $       */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <err.h>
+#include <locale.h>
+#include <wchar.h>
+
+int
+main(int ac, char **av)
+{
+    char    buf[256];
+    char    *str;
+    int     c;
+    wchar_t wbuf[256];
+    wchar_t *p;
+
+    str = setlocale(LC_ALL, "");
+    if (str == 0)
+       err(1, "setlocale");
+    fprintf(stderr, "===> Testing for locale %s... ", str);
+
+    for (str=buf; 1; str++) {
+        c = getchar();
+        if ( c==EOF || c=='\n' )
+            break;
+        *str=c;
+    }
+    *str='\0';
+    strcat(buf, "\n");
+    
+    mbstowcs(wbuf, buf, 255);
+    wcstombs(buf, wbuf, 255);
+    printf("%s\n", buf);
+
+    for ( p=wbuf; *p; p++) {
+        printf("0x%04X  ", (unsigned)*p);
+    }
+    putchar('\n');
+
+    printf("width:\n", buf);
+    for ( p=wbuf; *p; p++) {
+        printf("%d ", wcwidth(*p));
+    }
+    putchar('\n');
+
+    printf("wcswidth=%d\n", wcswidth(wbuf, 255));
+    
+    return 0;
+}
diff -r e62a533a9b9f -r 977c6aada30e regress/lib/libc/locale/ctype1/en_US.UTF-8.exp.uu
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/lib/libc/locale/ctype1/en_US.UTF-8.exp.uu Wed Sep 11 14:54:33 2002 +0000
@@ -0,0 +1,13 @@
+#      $NetBSD: en_US.UTF-8.exp.uu,v 1.1 2002/09/11 14:54:34 minoura Exp $
+
+begin 664 en_US.UTF-8.exp
+M6P%_75O"@-^_75O@H(#OO[]=6_"0@(#WO[^_75OXB("`@/N_O[^_75O\A("`
+M@(#]O[^_O[]="@HP>#`P-4(@(#!X,#`P,2`@,'@P,#=&("`P>#`P-40@(#!X
+M,#`U0B`@,'@P,#@P("`P>#`W1D8@(#!X,#`U1"`@,'@P,#5"("`P>#`X,#`@
+M(#!X1D9&1B`@,'@P,#5$("`P>#`P-4(@(#!X,3`P,#`@(#!X,49&1D9&("`P
+M>#`P-40@(#!X,#`U0B`@,'@R,#`P,#`@(#!X,T9&1D9&1B`@,'@P,#5$("`P
+M>#`P-4(@(#!X-#`P,#`P,"`@,'@W1D9&1D9&1B`@,'@P,#5$("`P>#`P,$$@
+M(`IW:61T:#H*,2`P(#`@,2`Q(#`@,"`Q(#$@,"`P(#$@,2`P(#`@,2`Q(#`@
+;,"`Q(#$@,"`P(#$@,"`*=V-S=VED=&@],3(*
+`
+end
diff -r e62a533a9b9f -r 977c6aada30e regress/lib/libc/locale/ctype1/en_US.UTF-8.in.uu
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/lib/libc/locale/ctype1/en_US.UTF-8.in.uu  Wed Sep 11 14:54:33 2002 +0000
@@ -0,0 +1,7 @@
+#      $NetBSD: en_US.UTF-8.in.uu,v 1.1 2002/09/11 14:54:34 minoura Exp $
+
+begin 644 en_US.UTF-8.in
+M6P%_75O"@-^_75O@H(#OO[]=6_"0@(#WO[^_75OXB("`@/N_O[^_75O\A("`
+*@(#]O[^_O[]="EO@
+`
+end
diff -r e62a533a9b9f -r 977c6aada30e regress/lib/libc/locale/ctype1/ja_JP.ISO2022-JP.exp.uu
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/lib/libc/locale/ctype1/ja_JP.ISO2022-JP.exp.uu    Wed Sep 11 14:54:33 2002 +0000
@@ -0,0 +1,11 @@
+#      $NetBSD: ja_JP.ISO2022-JP.exp.uu,v 1.1 2002/09/11 14:54:34 minoura Exp $
+
+begin 664 ja_JP.ISO2022-JP.exp
+M&R1"(THC22-3)$<D.2$C&RA"86%A81LD0B0B)"0D)B0H)"H;*$(*"C!X-#(P
+M,#(S-$$@(#!X-#(P,#(S-#D@(#!X-#(P,#(S-3,@(#!X-#(P,#(T-#<@(#!X
+M-#(P,#(T,SD@(#!X-#(P,#(Q,C,@(#!X,#`V,2`@,'@P,#8Q("`P>#`P-C$@
+M(#!X,#`V,2`@,'@T,C`P,C0R,B`@,'@T,C`P,C0R-"`@,'@T,C`P,C0R-B`@
+M,'@T,C`P,C0R."`@,'@T,C`P,C0R02`@,'@P,#!!("`*=VED=&@Z"C(@,B`R
+H(#(@,B`R(#$@,2`Q(#$@,B`R(#(@,B`R(#`@"G=C<W=I9'1H/3(V"C(@
+`
+end
diff -r e62a533a9b9f -r 977c6aada30e regress/lib/libc/locale/ctype1/ja_JP.ISO2022-JP.in.uu
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/lib/libc/locale/ctype1/ja_JP.ISO2022-JP.in.uu     Wed Sep 11 14:54:33 2002 +0000
@@ -0,0 +1,6 @@
+#      $NetBSD: ja_JP.ISO2022-JP.in.uu,v 1.1 2002/09/11 14:54:34 minoura Exp $
+
+begin 644 ja_JP.ISO2022-JP.in
+G&R1"(THC22-3)$<D.2$C&RA"86%A81LD0B0B)"0D)B0H)"H;*$(*
+`
+end
diff -r e62a533a9b9f -r 977c6aada30e regress/lib/libc/locale/ctype1/ja_JP.SJIS.exp.uu
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/lib/libc/locale/ctype1/ja_JP.SJIS.exp.uu  Wed Sep 11 14:54:33 2002 +0000
@@ -0,0 +1,10 @@
+#      $NetBSD: ja_JP.SJIS.exp.uu,v 1.1 2002/09/11 14:54:34 minoura Exp $
+
+begin 664 ja_JP.SJIS.exp
+M@G*":8)H@G*"Q8*W@4)A86%A@J""HH*D@J:"J`H*,'@X,C<R("`P>#@R-CD@
+M(#!X.#(V."`@,'@X,C<R("`P>#@R0S4@(#!X.#)"-R`@,'@X,30R("`P>#`P
+M-C$@(#!X,#`V,2`@,'@P,#8Q("`P>#`P-C$@(#!X.#)!,"`@,'@X,D$R("`P
+M>#@R030@(#!X.#)!-B`@,'@X,D$X("`P>#`P,$$@(`IW:61T:#H*,B`R(#(@
+I,B`R(#(@,B`Q(#$@,2`Q(#(@,B`R(#(@,B`P(`IW8W-W:61T:#TR.`HR
+`
+end
diff -r e62a533a9b9f -r 977c6aada30e regress/lib/libc/locale/ctype1/ja_JP.SJIS.in.uu
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/lib/libc/locale/ctype1/ja_JP.SJIS.in.uu   Wed Sep 11 14:54:33 2002 +0000
@@ -0,0 +1,6 @@
+#      $NetBSD: ja_JP.SJIS.in.uu,v 1.1 2002/09/11 14:54:34 minoura Exp $
+
+begin 644 ja_JP.SJIS.in
+=@G*":8)H@G*"Q8*W@4)A86%A@J""HH*D@J:"J`H`
+`
+end
diff -r e62a533a9b9f -r 977c6aada30e regress/lib/libc/locale/ctype1/ja_JP.eucJP.exp.uu
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/lib/libc/locale/ctype1/ja_JP.eucJP.exp.uu Wed Sep 11 14:54:33 2002 +0000
@@ -0,0 +1,10 @@
+#      $NetBSD: ja_JP.eucJP.exp.uu,v 1.1 2002/09/11 14:54:34 minoura Exp $
+
+begin 664 ja_JP.eucJP.exp
+MH\6CU:/#I,>DN:&C86%A8:2BI*2DIJ2HI*H*"C!X03-#-2`@,'A!,T0U("`P
+M>$$S0S,@(#!X031#-R`@,'A!-$(Y("`P>$$Q03,@(#!X,#`V,2`@,'@P,#8Q
+M("`P>#`P-C$@(#!X,#`V,2`@,'A!-$$R("`P>$$T030@(#!X031!-B`@,'A!
+M-$$X("`P>$$T04$@(#!X,#`P02`@"G=I9'1H.@HR(#(@,B`R(#(@,B`Q(#$@
+=,2`Q(#(@,B`R(#(@,B`P(`IW8W-W:61T:#TR-@HR
+`
+end
diff -r e62a533a9b9f -r 977c6aada30e regress/lib/libc/locale/ctype1/ja_JP.eucJP.in.uu
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/lib/libc/locale/ctype1/ja_JP.eucJP.in.uu  Wed Sep 11 14:54:33 2002 +0000
@@ -0,0 +1,6 @@
+#      $NetBSD: ja_JP.eucJP.in.uu,v 1.1 2002/09/11 14:54:34 minoura Exp $
+
+begin 644 ja_JP.eucJP.in
+;H\6CU:/#I,>DN:&C86%A8:2BI*2DIJ2HI*H*
+`
+end
diff -r e62a533a9b9f -r 977c6aada30e regress/lib/libc/locale/ctype2/C.in.uu
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/lib/libc/locale/ctype2/C.in.uu    Wed Sep 11 14:54:33 2002 +0000
@@ -0,0 +1,6 @@
+#      $NetBSD: C.in.uu,v 1.1 2002/09/11 14:54:34 minoura Exp $
+
+begin 664 C.in
+,04)#1#`Q,C,T7UP*
+`
+end
diff -r e62a533a9b9f -r 977c6aada30e regress/lib/libc/locale/ctype2/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/lib/libc/locale/ctype2/Makefile   Wed Sep 11 14:54:33 2002 +0000
@@ -0,0 +1,27 @@
+#      $NetBSD: Makefile,v 1.1 2002/09/11 14:54:34 minoura Exp $
+
+PROG=          mbrtowc
+NOMAN=         # defined
+
+TESTS=         C en_US.UTF-8 ja_JP.ISO2022-JP2 ja_JP.SJIS ja_JP.eucJP
+
+INPUTS=                ${TESTS:S/$/.in/}
+OUTPUTS=       ${TESTS:S/$/.out/}
+
+CLEANFILES+=   ${OUTPUTS} ${INPUTS}
+
+regress: ${PROG} ${TESTS}
+
+.PHONY:                ${TESTS}
+.for L in ${TESTS}
+$L: $L.in
+       @env LC_CTYPE=$L LC_ALL= LANG= ./${PROG} `cat ${.ALLSRC}` > $L.out
+.endfor
+
+# paranoia: protect against non-ASCII characters
+.for L in ${TESTS}
+$L.in: $L.in.uu
+       uudecode ${.ALLSRC}
+.endfor
+
+.include <bsd.prog.mk>
diff -r e62a533a9b9f -r 977c6aada30e regress/lib/libc/locale/ctype2/en_US.UTF-8.in.uu
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/lib/libc/locale/ctype2/en_US.UTF-8.in.uu  Wed Sep 11 14:54:33 2002 +0000
@@ -0,0 +1,7 @@
+#      $NetBSD: en_US.UTF-8.in.uu,v 1.1 2002/09/11 14:54:35 minoura Exp $
+
+begin 664 en_US.UTF-8.in
+M6P%_75O"@-^_75O@H(#OO[]=6_"0@(#WO[^_75OXB("`@/N_O[^_75O\A("`
+*@(#]O[^_O[]="EO@
+`
+end
diff -r e62a533a9b9f -r 977c6aada30e regress/lib/libc/locale/ctype2/ja_JP.ISO2022-JP2.in.uu
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/lib/libc/locale/ctype2/ja_JP.ISO2022-JP2.in.uu    Wed Sep 11 14:54:33 2002 +0000
@@ -0,0 +1,6 @@
+#      $NetBSD: ja_JP.ISO2022-JP2.in.uu,v 1.1 2002/09/11 14:54:35 minoura Exp $
+
+begin 664 ja_JP.ISO2022-JP2.in
+?&R1"1GQ+7#AL&RA"01LD0B0B&RA"0ALD0B0D&RA""@!4
+`
+end
diff -r e62a533a9b9f -r 977c6aada30e regress/lib/libc/locale/ctype2/ja_JP.SJIS.in.uu
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/lib/libc/locale/ctype2/ja_JP.SJIS.in.uu   Wed Sep 11 14:54:33 2002 +0000
@@ -0,0 +1,6 @@
+#      $NetBSD: ja_JP.SJIS.in.uu,v 1.1 2002/09/11 14:54:35 minoura Exp $
+
+begin 664 ja_JP.SJIS.in
+-D_J6>XSJ08*@0H*B"@``
+`
+end
diff -r e62a533a9b9f -r 977c6aada30e regress/lib/libc/locale/ctype2/ja_JP.eucJP.in.uu
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/lib/libc/locale/ctype2/ja_JP.eucJP.in.uu  Wed Sep 11 14:54:33 2002 +0000
@@ -0,0 +1,6 @@
+#      $NetBSD: ja_JP.eucJP.in.uu,v 1.1 2002/09/11 14:54:35 minoura Exp $
+
+begin 664 ja_JP.eucJP.in
+-QOS+W+CL0:2B0J2D"@``
+`
+end
diff -r e62a533a9b9f -r 977c6aada30e regress/lib/libc/locale/ctype2/mbrtowc.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/lib/libc/locale/ctype2/mbrtowc.c  Wed Sep 11 14:54:33 2002 +0000
@@ -0,0 +1,122 @@
+/*     $NetBSD: mbrtowc.c,v 1.1 2002/09/11 14:54:35 minoura Exp $      */
+
+/*
+ * test code for mbrtowc
+ * by YAMAMOTO Takashi
+ *
+ * this file uses following mb/ws functions.
+ * setlocale, mbrtowc, mbsrtowcs, mbsinit, wcscmp
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <locale.h>
+#include <assert.h>
+#include <errno.h>
+#include <sys/types.h>
+
+#define WBSIZE 100
+



Home | Main Index | Thread Index | Old Index