Source-Changes-HG archive

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

[src/trunk]: src Split out 't_printf' and 't_scanf' from 't_format' to gain t...



details:   https://anonhg.NetBSD.org/src/rev/60f078d59a44
branches:  trunk
changeset: 767076:60f078d59a44
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Fri Jul 08 06:38:03 2011 +0000

description:
Split out 't_printf' and 't_scanf' from 't_format' to gain the common
"functional scope" for the test files.

diffstat:

 distrib/sets/lists/tests/mi     |   10 ++-
 tests/lib/libc/stdio/Makefile   |    5 +-
 tests/lib/libc/stdio/t_format.c |  128 ----------------------------------------
 tests/lib/libc/stdio/t_printf.c |   81 +++++++++++++++++++++++++
 tests/lib/libc/stdio/t_scanf.c  |   82 +++++++++++++++++++++++++
 5 files changed, 173 insertions(+), 133 deletions(-)

diffs (truncated from 355 to 300 lines):

diff -r b6928499d35b -r 60f078d59a44 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Fri Jul 08 05:55:23 2011 +0000
+++ b/distrib/sets/lists/tests/mi       Fri Jul 08 06:38:03 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.372 2011/07/07 15:53:27 jruoho Exp $
+# $NetBSD: mi,v 1.373 2011/07/08 06:38:03 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -434,8 +434,10 @@
 ./usr/libdata/debug/usr/tests/lib/libc/stdio                           tests-lib-debug
 ./usr/libdata/debug/usr/tests/lib/libc/stdio/t_clearerr.debug          tests-lib-debug         debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/stdio/t_fmemopen.debug          tests-lib-debug         debug,atf
-./usr/libdata/debug/usr/tests/lib/libc/stdio/t_format.debug            tests-lib-debug         debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/stdio/t_format.debug            tests-obsolete          obsolete
 ./usr/libdata/debug/usr/tests/lib/libc/stdio/t_popen.debug             tests-lib-debug         debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/stdio/t_printf.debug            tests-lib-debug         debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/stdio/t_scanf.debug             tests-lib-debug         debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/stdlib                          tests-lib-debug
 ./usr/libdata/debug/usr/tests/lib/libc/stdlib/h_atexit.debug           tests-lib-debug         debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/stdlib/h_getopt.debug           tests-lib-debug         debug,atf
@@ -2010,8 +2012,10 @@
 ./usr/tests/lib/libc/stdio/Atffile             tests-lib-tests         atf
 ./usr/tests/lib/libc/stdio/t_clearerr          tests-lib-tests         atf
 ./usr/tests/lib/libc/stdio/t_fmemopen          tests-lib-tests         atf
-./usr/tests/lib/libc/stdio/t_format            tests-lib-tests         atf
+./usr/tests/lib/libc/stdio/t_format            tests-obsolete          obsolete
 ./usr/tests/lib/libc/stdio/t_popen             tests-lib-tests         atf
+./usr/tests/lib/libc/stdio/t_printf            tests-lib-tests         atf
+./usr/tests/lib/libc/stdio/t_scanf             tests-lib-tests         atf
 ./usr/tests/lib/libc/stdlib                    tests-lib-tests
 ./usr/tests/lib/libc/stdlib/Atffile            tests-lib-tests         atf
 ./usr/tests/lib/libc/stdlib/h_atexit           tests-lib-tests         atf
diff -r b6928499d35b -r 60f078d59a44 tests/lib/libc/stdio/Makefile
--- a/tests/lib/libc/stdio/Makefile     Fri Jul 08 05:55:23 2011 +0000
+++ b/tests/lib/libc/stdio/Makefile     Fri Jul 08 06:38:03 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2011/05/01 16:36:37 jruoho Exp $
+# $NetBSD: Makefile,v 1.5 2011/07/08 06:38:04 jruoho Exp $
 
 .include <bsd.own.mk>
 
@@ -6,7 +6,8 @@
 
 TESTS_C+=      t_clearerr
 TESTS_C+=      t_fmemopen
-TESTS_C+=      t_format
 TESTS_C+=      t_popen
+TESTS_C+=      t_printf
+TESTS_C+=      t_scanf
 
 .include <bsd.test.mk>
diff -r b6928499d35b -r 60f078d59a44 tests/lib/libc/stdio/t_format.c
--- a/tests/lib/libc/stdio/t_format.c   Fri Jul 08 05:55:23 2011 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-/* $NetBSD: t_format.c,v 1.5 2010/12/23 13:34:46 pgoyette Exp $ */
-
-/*-
- * Copyright (c) 2010 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <atf-c.h>
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-
-ATF_TC(zero_padding);
-
-ATF_TC_HEAD(zero_padding, tc)
-{
-
-       atf_tc_set_md_var(tc, "descr", "output format zero padding");
-}
-
-ATF_TC_BODY(zero_padding, tc)
-{
-       char str[1024];
-
-       ATF_CHECK(sprintf(str, "%010f", 0.0) == 10);
-       ATF_REQUIRE_STREQ(str, "000.000000");
-
-       /* ieeefp */
-#ifndef __vax__
-       /* PR/44113: printf(3) should ignore zero padding for nan/inf */
-       ATF_CHECK(sprintf(str, "%010f", NAN) == 10);
-       ATF_REQUIRE_STREQ(str, "       nan");
-       ATF_CHECK(sprintf(str, "%010f", INFINITY) == 10);
-       ATF_REQUIRE_STREQ(str, "       inf");
-#endif
-}
-
-ATF_TC(dot_zero_f);
-
-ATF_TC_HEAD(dot_zero_f, tc)
-{
-
-       atf_tc_set_md_var(tc, "descr", \
-           "PR lib/32951: %.0f formats (0.0,0.5] to \"0.\"");
-}
-
-ATF_TC_BODY(dot_zero_f, tc)
-{
-       char s[4];
-
-       ATF_CHECK(snprintf(s, sizeof(s), "%.0f", 0.1) == 1);
-       ATF_REQUIRE_STREQ(s, "0");
-}
-
-ATF_TC(sscanf_neg_hex);
-
-ATF_TC_HEAD(sscanf_neg_hex, tc)
-{
-
-       atf_tc_set_md_var(tc, "descr", \
-           "PR lib/21691: %i and %x fail with negative hex numbers");
-}
-
-ATF_TC_BODY(sscanf_neg_hex, tc)
-{
-#define NUM     -0x1234
-#define STRNUM  ___STRING(NUM)
-
-        int i;
-
-        sscanf(STRNUM, "%i", &i);
-       ATF_REQUIRE(i == NUM);
-
-        sscanf(STRNUM, "%x", &i);
-       ATF_REQUIRE(i == NUM);
-}
-
-ATF_TC(sscanf_whitespace);
-
-ATF_TC_HEAD(sscanf_whitespace, tc)
-{
-
-       atf_tc_set_md_var(tc, "descr", "verify sscanf skips all whitespace");
-}
-
-ATF_TC_BODY(sscanf_whitespace, tc)
-{
-       const char str[] = "\f\n\r\t\v%z";
-       char c;
-
-        /* set of "white space" symbols from isspace(3) */
-        c = 0;
-        (void)sscanf(str, "%%%c", &c);
-       ATF_REQUIRE(c == 'z');
-}
-
-
-ATF_TP_ADD_TCS(tp)
-{
-
-       ATF_TP_ADD_TC(tp, zero_padding);
-       ATF_TP_ADD_TC(tp, dot_zero_f);
-       ATF_TP_ADD_TC(tp, sscanf_neg_hex);
-       ATF_TP_ADD_TC(tp, sscanf_whitespace);
-
-       return atf_no_error();
-}
diff -r b6928499d35b -r 60f078d59a44 tests/lib/libc/stdio/t_printf.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libc/stdio/t_printf.c   Fri Jul 08 06:38:03 2011 +0000
@@ -0,0 +1,81 @@
+/* $NetBSD: t_printf.c,v 1.1 2011/07/08 06:38:04 jruoho Exp $ */
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <atf-c.h>
+#include <math.h>
+#include <stdio.h>
+#include <string.h>
+
+ATF_TC(sprintf_dotzero);
+ATF_TC_HEAD(sprintf_dotzero, tc)
+{
+
+       atf_tc_set_md_var(tc, "descr", \
+           "PR lib/32951: %.0f formats (0.0,0.5] to \"0.\"");
+}
+
+ATF_TC_BODY(sprintf_dotzero, tc)
+{
+       char s[4];
+
+       ATF_CHECK(snprintf(s, sizeof(s), "%.0f", 0.1) == 1);
+       ATF_REQUIRE_STREQ(s, "0");
+}
+
+ATF_TC(sprintf_zeropad);
+ATF_TC_HEAD(sprintf_zeropad, tc)
+{
+
+       atf_tc_set_md_var(tc, "descr", "output format zero padding");
+}
+
+ATF_TC_BODY(sprintf_zeropad, tc)
+{
+       char str[1024];
+
+       ATF_CHECK(sprintf(str, "%010f", 0.0) == 10);
+       ATF_REQUIRE_STREQ(str, "000.000000");
+
+       /* ieeefp */
+#ifndef __vax__
+       /* PR/44113: printf(3) should ignore zero padding for nan/inf */
+       ATF_CHECK(sprintf(str, "%010f", NAN) == 10);
+       ATF_REQUIRE_STREQ(str, "       nan");
+       ATF_CHECK(sprintf(str, "%010f", INFINITY) == 10);
+       ATF_REQUIRE_STREQ(str, "       inf");
+#endif
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+       ATF_TP_ADD_TC(tp, sprintf_dotzero);
+       ATF_TP_ADD_TC(tp, sprintf_zeropad);
+
+       return atf_no_error();
+}
diff -r b6928499d35b -r 60f078d59a44 tests/lib/libc/stdio/t_scanf.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libc/stdio/t_scanf.c    Fri Jul 08 06:38:03 2011 +0000
@@ -0,0 +1,82 @@
+/* $NetBSD: t_scanf.c,v 1.1 2011/07/08 06:38:04 jruoho Exp $ */
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */



Home | Main Index | Thread Index | Old Index