Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Add testcase for PR/44189: strtod(3) wrong results with "-0x".
details: https://anonhg.NetBSD.org/src/rev/817205b8b2dc
branches: trunk
changeset: 759244:817205b8b2dc
user: njoly <njoly%NetBSD.org@localhost>
date: Fri Dec 03 13:11:50 2010 +0000
description:
Add testcase for PR/44189: strtod(3) wrong results with "-0x".
diffstat:
distrib/sets/lists/tests/mi | 4 +-
tests/lib/libc/stdlib/Makefile | 3 +-
tests/lib/libc/stdlib/t_strtox.c | 64 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 69 insertions(+), 2 deletions(-)
diffs (109 lines):
diff -r 49038767c65d -r 817205b8b2dc distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Fri Dec 03 12:02:28 2010 +0000
+++ b/distrib/sets/lists/tests/mi Fri Dec 03 13:11:50 2010 +0000
@@ -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
diff -r 49038767c65d -r 817205b8b2dc tests/lib/libc/stdlib/Makefile
--- a/tests/lib/libc/stdlib/Makefile Fri Dec 03 12:02:28 2010 +0000
+++ b/tests/lib/libc/stdlib/Makefile Fri Dec 03 13:11:50 2010 +0000
@@ -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
diff -r 49038767c65d -r 817205b8b2dc tests/lib/libc/stdlib/t_strtox.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libc/stdlib/t_strtox.c Fri Dec 03 13:11:50 2010 +0000
@@ -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();
+}
Home |
Main Index |
Thread Index |
Old Index