diff --git a/distrib/sets/lists/tests/mi b/distrib/sets/lists/tests/mi index 7f474fd4f69b..2c9b3fa6d8ea 100644 --- a/distrib/sets/lists/tests/mi +++ b/distrib/sets/lists/tests/mi @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.292 2011/04/05 06:15:30 jruoho Exp $ +# $NetBSD: mi,v 1.293 2011/04/05 08:24:28 jruoho Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -410,7 +410,7 @@ ./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_posix_memalign.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libc/stdlib/t_strtod.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/stdlib/t_strtox.debug tests-obsolete obsolete ./usr/libdata/debug/usr/tests/lib/libc/string tests-lib-debug ./usr/libdata/debug/usr/tests/lib/libc/string/t_memcpy.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libc/string/t_memmem.debug tests-lib-debug debug,atf @@ -1866,7 +1866,7 @@ ./usr/tests/lib/libc/stdlib/t_mi_vector_hash tests-lib-tests atf ./usr/tests/lib/libc/stdlib/t_posix_memalign tests-lib-tests atf ./usr/tests/lib/libc/stdlib/t_strtod tests-lib-tests atf -./usr/tests/lib/libc/stdlib/t_strtox tests-lib-tests atf +./usr/tests/lib/libc/stdlib/t_strtox tests-obsolete obsolete ./usr/tests/lib/libc/string tests-lib-tests ./usr/tests/lib/libc/string/Atffile tests-lib-tests atf ./usr/tests/lib/libc/string/t_memcpy tests-lib-tests atf diff --git a/tests/lib/libc/stdlib/Makefile b/tests/lib/libc/stdlib/Makefile index f4bd64c33ef2..fd8a07f5530e 100644 --- a/tests/lib/libc/stdlib/Makefile +++ b/tests/lib/libc/stdlib/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.10 2011/04/05 06:15:30 jruoho Exp $ +# $NetBSD: Makefile,v 1.11 2011/04/05 08:24:28 jruoho Exp $ .include @@ -11,7 +11,6 @@ TESTS_C+= t_hsearch TESTS_C+= t_mi_vector_hash TESTS_C+= t_posix_memalign TESTS_C+= t_strtod -TESTS_C+= t_strtox TESTS_SH+= t_atexit TESTS_SH+= t_getopt @@ -23,6 +22,7 @@ BINDIR= ${TESTSDIR} PROGS+= h_atexit PROGS+= h_getopt h_getopt_long +LDADD.t_strtod= -lm LDADD.t_environment_pth= -pthread .include diff --git a/tests/lib/libc/stdlib/t_strtod.c b/tests/lib/libc/stdlib/t_strtod.c index c68081820f34..45a9d44b9e59 100644 --- a/tests/lib/libc/stdlib/t_strtod.c +++ b/tests/lib/libc/stdlib/t_strtod.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_strtod.c,v 1.1 2011/04/05 06:15:30 jruoho Exp $ */ +/* $NetBSD: t_strtod.c,v 1.2 2011/04/05 08:24:28 jruoho Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -32,10 +32,11 @@ /* Public domain, Otto Moerbeek , 2006. */ #include -__RCSID("$NetBSD: t_strtod.c,v 1.1 2011/04/05 06:15:30 jruoho Exp $"); +__RCSID("$NetBSD: t_strtod.c,v 1.2 2011/04/05 08:24:28 jruoho Exp $"); #include #include +#include #include #include #include @@ -66,6 +67,33 @@ ATF_TC_BODY(strtod_basic, tc) } } +ATF_TC(strtod_hex); +ATF_TC_HEAD(strtod_hex, tc) +{ + atf_tc_set_md_var(tc, "descr", "A strtod(3) with hexadecimals"); +} + +ATF_TC_BODY(strtod_hex, tc) +{ + const char *str; + char *end; + double d; + + str = "-0x0"; + d = strtod(str, &end); /* -0.0 */ + + ATF_REQUIRE(end == str + 4); + ATF_REQUIRE(signbit(d) != 0); + ATF_REQUIRE(fabs(d) < 1.0e-40); + + str = "-0x"; + d = strtod(str, &end); /* -0.0 */ + + ATF_REQUIRE(end == str + 2); + ATF_REQUIRE(signbit(d) != 0); + ATF_REQUIRE(fabs(d) < 1.0e-40); +} + ATF_TC(strtod_underflow); ATF_TC_HEAD(strtod_underflow, tc) { @@ -98,6 +126,7 @@ ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, strtod_basic); + ATF_TP_ADD_TC(tp, strtod_hex); ATF_TP_ADD_TC(tp, strtod_underflow); return atf_no_error(); diff --git a/tests/lib/libc/stdlib/t_strtox.c b/tests/lib/libc/stdlib/t_strtox.c deleted file mode 100644 index 5ca090f72c79..000000000000 --- a/tests/lib/libc/stdlib/t_strtox.c +++ /dev/null @@ -1,62 +0,0 @@ -/* $NetBSD: t_strtox.c,v 1.3 2011/03/22 22:29:18 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 -__RCSID("$NetBSD: t_strtox.c,v 1.3 2011/03/22 22:29:18 njoly Exp $"); - -#include -#include - -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); - - str = "-0x"; - ATF_REQUIRE(strtod(str, &end) == -0.0 && end == str+2); -} - -ATF_TP_ADD_TCS(tp) -{ - ATF_TP_ADD_TC(tp, hexadecimal); - - return atf_no_error(); -}