Module Name:    src
Committed By:   jruoho
Date:           Sat Jun 27 10:14:10 UTC 2020

Modified Files:
        src/tests/lib/libc/stdlib: Makefile
Added Files:
        src/tests/lib/libc/stdlib: t_mbtowc.c
Removed Files:
        src/regress/lib/libc/citrus: Makefile
        src/regress/lib/libc/citrus/mbtowc: Makefile mbtowc_test.c

Log Message:
Start moving the remaining tests from src/regress to src/tests.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r0 src/regress/lib/libc/citrus/Makefile
cvs rdiff -u -r1.1 -r0 src/regress/lib/libc/citrus/mbtowc/Makefile \
    src/regress/lib/libc/citrus/mbtowc/mbtowc_test.c
cvs rdiff -u -r1.29 -r1.30 src/tests/lib/libc/stdlib/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/stdlib/t_mbtowc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/stdlib/Makefile
diff -u src/tests/lib/libc/stdlib/Makefile:1.29 src/tests/lib/libc/stdlib/Makefile:1.30
--- src/tests/lib/libc/stdlib/Makefile:1.29	Sat Jun 27 09:45:57 2020
+++ src/tests/lib/libc/stdlib/Makefile	Sat Jun 27 10:14:10 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.29 2020/06/27 09:45:57 jruoho Exp $
+# $NetBSD: Makefile,v 1.30 2020/06/27 10:14:10 jruoho Exp $
 
 .include <bsd.own.mk>
 
@@ -11,6 +11,7 @@ TESTS_C+=	t_getenv
 TESTS_C+=	t_getenv_thread
 TESTS_C+=	t_exit
 TESTS_C+=	t_hsearch
+TESTS_C+=	t_mbtowc
 TESTS_C+=	t_mktemp
 TESTS_C+=	t_mi_vector_hash
 TESTS_C+=	t_posix_memalign

Added files:

Index: src/tests/lib/libc/stdlib/t_mbtowc.c
diff -u /dev/null src/tests/lib/libc/stdlib/t_mbtowc.c:1.1
--- /dev/null	Sat Jun 27 10:14:10 2020
+++ src/tests/lib/libc/stdlib/t_mbtowc.c	Sat Jun 27 10:14:10 2020
@@ -0,0 +1,47 @@
+
+/* From: Miloslav Trmac <m...@volny.cz> */
+
+#include <atf-c.h>
+#include <langinfo.h>
+#include <limits.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+ATF_TC(mbtowc_sign);
+ATF_TC_HEAD(mbtowc_sign, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test mbtowc(3) sign conversion");
+}
+
+ATF_TC_BODY(mbtowc_sign, tc)
+{
+	char back[MB_LEN_MAX];
+	wchar_t wc;
+	size_t i;
+	int ret;
+
+	(void)setlocale(LC_ALL, "");
+	(void)printf("Charset: %s\n", nl_langinfo(CODESET));
+	ret = mbtowc(&wc, "\xe4", 1);
+	(void)printf("mbtowc(): %d\n", ret);
+
+	if (ret > 0) {
+		(void)printf("Result: 0x%08lX\n",(unsigned long)wc);
+		ret = wctomb(back, wc);
+		(void)printf("wctomb(): %d\n", ret);
+		for(i = 0; ret > 0 && i < (size_t)ret; i++)
+			printf("%02X ",(unsigned char)back[i]);
+		putchar('\n');
+	}
+
+	ATF_REQUIRE(ret > 0);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+	ATF_TP_ADD_TC(tp, mbtowc_sign);
+
+	return atf_no_error();
+}

Reply via email to