Module Name: src Committed By: jruoho Date: Tue Apr 5 08:24:28 UTC 2011
Modified Files: src/distrib/sets/lists/tests: mi src/tests/lib/libc/stdlib: Makefile t_strtod.c Removed Files: src/tests/lib/libc/stdlib: t_strtox.c Log Message: Try to maintain the structure of libc and move 't_strtox' to 't_strtod'. To generate a diff of this commit: cvs rdiff -u -r1.292 -r1.293 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.10 -r1.11 src/tests/lib/libc/stdlib/Makefile cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/stdlib/t_strtod.c cvs rdiff -u -r1.3 -r0 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.292 src/distrib/sets/lists/tests/mi:1.293 --- src/distrib/sets/lists/tests/mi:1.292 Tue Apr 5 06:15:30 2011 +++ src/distrib/sets/lists/tests/mi Tue Apr 5 08:24:28 2011 @@ -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 Index: src/tests/lib/libc/stdlib/Makefile diff -u src/tests/lib/libc/stdlib/Makefile:1.10 src/tests/lib/libc/stdlib/Makefile:1.11 --- src/tests/lib/libc/stdlib/Makefile:1.10 Tue Apr 5 06:15:30 2011 +++ src/tests/lib/libc/stdlib/Makefile Tue Apr 5 08:24:28 2011 @@ -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 <bsd.own.mk> @@ -11,7 +11,6 @@ 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 @@ PROGS+= h_atexit PROGS+= h_getopt h_getopt_long +LDADD.t_strtod= -lm LDADD.t_environment_pth= -pthread .include <bsd.test.mk> Index: src/tests/lib/libc/stdlib/t_strtod.c diff -u src/tests/lib/libc/stdlib/t_strtod.c:1.1 src/tests/lib/libc/stdlib/t_strtod.c:1.2 --- src/tests/lib/libc/stdlib/t_strtod.c:1.1 Tue Apr 5 06:15:30 2011 +++ src/tests/lib/libc/stdlib/t_strtod.c Tue Apr 5 08:24:28 2011 @@ -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 <o...@drijf.net>, 2006. */ #include <sys/cdefs.h> -__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 <atf-c.h> #include <errno.h> +#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -66,6 +67,33 @@ } } +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_TC(tp, strtod_basic); + ATF_TP_ADD_TC(tp, strtod_hex); ATF_TP_ADD_TC(tp, strtod_underflow); return atf_no_error();