Source-Changes-HG archive

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

[src/trunk]: src Start moving the remaining tests from src/regress to src/tests.



details:   https://anonhg.NetBSD.org/src/rev/b8326caf6acf
branches:  trunk
changeset: 973326:b8326caf6acf
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Sat Jun 27 10:14:10 2020 +0000

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

diffstat:

 regress/lib/libc/citrus/Makefile             |   7 ----
 regress/lib/libc/citrus/mbtowc/Makefile      |  16 ---------
 regress/lib/libc/citrus/mbtowc/mbtowc_test.c |  30 -----------------
 tests/lib/libc/stdlib/Makefile               |   3 +-
 tests/lib/libc/stdlib/t_mbtowc.c             |  47 ++++++++++++++++++++++++++++
 5 files changed, 49 insertions(+), 54 deletions(-)

diffs (133 lines):

diff -r cf61a18ee921 -r b8326caf6acf regress/lib/libc/citrus/Makefile
--- a/regress/lib/libc/citrus/Makefile  Sat Jun 27 10:00:29 2020 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#      $NetBSD: Makefile,v 1.1 2005/03/27 18:48:45 christos Exp $
-
-.include <bsd.own.mk>
-
-SUBDIR+= mbtowc
-
-.include <bsd.subdir.mk>
diff -r cf61a18ee921 -r b8326caf6acf regress/lib/libc/citrus/mbtowc/Makefile
--- a/regress/lib/libc/citrus/mbtowc/Makefile   Sat Jun 27 10:00:29 2020 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-#      $NetBSD: Makefile,v 1.1 2005/03/27 18:49:51 christos Exp $
-
-NOMAN=         # defined
-
-PROG=          mbtowc_test
-WARNS?=                1
-
-regress: ${PROG}
-       @if ./${PROG}; then \
-               echo PASSED; \
-       else \
-               echo FAILED; \
-               exit 1; \
-       fi
-
-.include <bsd.prog.mk>
diff -r cf61a18ee921 -r b8326caf6acf regress/lib/libc/citrus/mbtowc/mbtowc_test.c
--- a/regress/lib/libc/citrus/mbtowc/mbtowc_test.c      Sat Jun 27 10:00:29 2020 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/* From: Miloslav Trmac <mitr%volny.cz@localhost> */
-#include <langinfo.h>
-#include <limits.h>
-#include <locale.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-int
-main(void)
-{
-       wchar_t wc;
-       char back[MB_LEN_MAX];
-       int ret;
-       size_t i;
-
-       setlocale(LC_ALL, "");
-       printf("Charset: %s\n", nl_langinfo(CODESET));
-       ret = mbtowc(&wc, "\xe4", 1);
-       printf("mbtowc(): %d\n", ret);
-       if(ret > 0) {
-               printf("Result: 0x%08lX\n",(unsigned long)wc);
-               ret = wctomb(back, wc);
-               printf("wctomb(): %d\n", ret);
-               for(i = 0; ret > 0 && i <(size_t)ret; i++)
-                       printf("%02X ",(unsigned char)back[i]);
-               putchar('\n');
-               return EXIT_SUCCESS;
-       } else
-               return EXIT_FAILURE;
-}
diff -r cf61a18ee921 -r b8326caf6acf tests/lib/libc/stdlib/Makefile
--- a/tests/lib/libc/stdlib/Makefile    Sat Jun 27 10:00:29 2020 +0000
+++ b/tests/lib/libc/stdlib/Makefile    Sat Jun 27 10:14:10 2020 +0000
@@ -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_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
diff -r cf61a18ee921 -r b8326caf6acf tests/lib/libc/stdlib/t_mbtowc.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libc/stdlib/t_mbtowc.c  Sat Jun 27 10:14:10 2020 +0000
@@ -0,0 +1,47 @@
+
+/* From: Miloslav Trmac <mitr%volny.cz@localhost> */
+
+#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();
+}



Home | Main Index | Thread Index | Old Index