Module Name: src
Committed By: njoly
Date: Fri Dec 3 13:11:50 UTC 2010
Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/lib/libc/stdlib: Makefile
Added Files:
src/tests/lib/libc/stdlib: t_strtox.c
Log Message:
Add testcase for PR/44189: strtod(3) wrong results with "-0x".
To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/stdlib/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/stdlib/t_strtox.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.167 src/distrib/sets/lists/tests/mi:1.168
--- src/distrib/sets/lists/tests/mi:1.167 Fri Dec 3 12:02:28 2010
+++ src/distrib/sets/lists/tests/mi Fri Dec 3 13:11:50 2010
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.167 2010/12/03 12:02:28 hannken Exp $
+# $NetBSD: mi,v 1.168 2010/12/03 13:11:50 njoly Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -328,6 +328,7 @@
./usr/libdata/debug/usr/tests/lib/libc/stdlib/t_environment.debug tests-lib-debug debug,atf
./usr/libdata/debug/usr/tests/lib/libc/stdlib/t_environment_pth.debug tests-lib-debug debug,atf
./usr/libdata/debug/usr/tests/lib/libc/stdlib/t_mi_vector_hash.debug tests-lib-debug debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/stdlib/t_strtox.debug tests-lib-debug debug,atf
./usr/libdata/debug/usr/tests/lib/libc/string tests-obsolete obsolete
./usr/libdata/debug/usr/tests/lib/libc/string/t_popcount.debug tests-obsolete obsolete
./usr/libdata/debug/usr/tests/lib/libdes tests-lib-debug
@@ -1528,6 +1529,7 @@
./usr/tests/lib/libc/stdlib/t_environment tests-lib-tests atf
./usr/tests/lib/libc/stdlib/t_environment_pth tests-lib-tests atf
./usr/tests/lib/libc/stdlib/t_mi_vector_hash tests-lib-tests atf
+./usr/tests/lib/libc/stdlib/t_strtox tests-lib-tests atf
./usr/tests/lib/libc/stdio tests-lib-tests
./usr/tests/lib/libc/stdio/Atffile tests-lib-tests atf
./usr/tests/lib/libc/stdio/t_fmemopen tests-lib-tests atf
Index: src/tests/lib/libc/stdlib/Makefile
diff -u src/tests/lib/libc/stdlib/Makefile:1.4 src/tests/lib/libc/stdlib/Makefile:1.5
--- src/tests/lib/libc/stdlib/Makefile:1.4 Tue Nov 16 14:03:47 2010
+++ src/tests/lib/libc/stdlib/Makefile Fri Dec 3 13:11:50 2010
@@ -1,10 +1,11 @@
-# $NetBSD: Makefile,v 1.4 2010/11/16 14:03:47 tron Exp $
+# $NetBSD: Makefile,v 1.5 2010/12/03 13:11:50 njoly Exp $
.include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/lib/libc/stdlib
TESTS_C+= t_mi_vector_hash t_environment t_environment_pth
+TESTS_C+= t_strtox
LDADD.t_environment_pth= -pthread
Added files:
Index: src/tests/lib/libc/stdlib/t_strtox.c
diff -u /dev/null src/tests/lib/libc/stdlib/t_strtox.c:1.1
--- /dev/null Fri Dec 3 13:11:50 2010
+++ src/tests/lib/libc/stdlib/t_strtox.c Fri Dec 3 13:11:50 2010
@@ -0,0 +1,64 @@
+/* $NetBSD: t_strtox.c,v 1.1 2010/12/03 13:11:50 njoly 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 COPYRIGHT HOLDERS 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
+ * COPYRIGHT HOLDERS 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 <sys/cdefs.h>
+__RCSID("$NetBSD: t_strtox.c,v 1.1 2010/12/03 13:11:50 njoly Exp $");
+
+#include <atf-c.h>
+#include <stdlib.h>
+
+ATF_TC(hexadecimal);
+
+ATF_TC_HEAD(hexadecimal, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Test strtod with hexdecimal numbers");
+}
+
+ATF_TC_BODY(hexadecimal, tc)
+{
+ const char *str;
+ char *end;
+
+ str = "-0x0";
+ ATF_REQUIRE(strtod(str, &end) == -0.0 && end == str+4);
+
+ atf_tc_expect_fail("PR/44189");
+ str = "-0x";
+ ATF_REQUIRE(strtod(str, &end) == -0.0 && end == str+2);
+ atf_tc_expect_pass();
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ ATF_TP_ADD_TC(tp, hexadecimal);
+
+ return atf_no_error();
+}