Module Name: src Committed By: jruoho Date: Wed Apr 6 09:35:49 UTC 2011
Modified Files: src/distrib/sets/lists/tests: mi src/tests/lib/libm: Makefile Added Files: src/tests/lib/libm: t_tanh.c Log Message: A test case for PR lib/44057. To generate a diff of this commit: cvs rdiff -u -r1.295 -r1.296 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libm/Makefile cvs rdiff -u -r0 -r1.1 src/tests/lib/libm/t_tanh.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.295 src/distrib/sets/lists/tests/mi:1.296 --- src/distrib/sets/lists/tests/mi:1.295 Wed Apr 6 05:53:16 2011 +++ src/distrib/sets/lists/tests/mi Wed Apr 6 09:35:49 2011 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.295 2011/04/06 05:53:16 jruoho Exp $ +# $NetBSD: mi,v 1.296 2011/04/06 09:35:49 jruoho Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -453,6 +453,7 @@ ./usr/libdata/debug/usr/tests/lib/libm/t_ceil.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libm/t_floor.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libm/t_libm.debug tests-lib-debug debug,atf +./usr/libdata/debug/usr/tests/lib/libm/t_tanh.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libobjc tests-lib-debug ./usr/libdata/debug/usr/tests/lib/libobjc/t_threads.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libposix tests-lib-debug @@ -1926,6 +1927,7 @@ ./usr/tests/lib/libm/t_ceil tests-lib-tests atf ./usr/tests/lib/libm/t_floor tests-lib-tests atf ./usr/tests/lib/libm/t_libm tests-lib-tests atf +./usr/tests/lib/libm/t_tanh tests-lib-tests atf ./usr/tests/lib/libobjc tests-lib-tests atf ./usr/tests/lib/libobjc/Atffile tests-lib-tests atf ./usr/tests/lib/libobjc/t_threads tests-lib-tests atf Index: src/tests/lib/libm/Makefile diff -u src/tests/lib/libm/Makefile:1.2 src/tests/lib/libm/Makefile:1.3 --- src/tests/lib/libm/Makefile:1.2 Thu Mar 24 15:43:06 2011 +++ src/tests/lib/libm/Makefile Wed Apr 6 09:35:49 2011 @@ -1,10 +1,10 @@ -# $NetBSD: Makefile,v 1.2 2011/03/24 15:43:06 jruoho Exp $ +# $NetBSD: Makefile,v 1.3 2011/04/06 09:35:49 jruoho Exp $ .include <bsd.own.mk> TESTSDIR= ${TESTSBASE}/lib/libm -TESTS_C+= t_ceil t_floor t_libm +TESTS_C+= t_ceil t_floor t_libm t_tanh LDADD+=-lm Added files: Index: src/tests/lib/libm/t_tanh.c diff -u /dev/null src/tests/lib/libm/t_tanh.c:1.1 --- /dev/null Wed Apr 6 09:35:49 2011 +++ src/tests/lib/libm/t_tanh.c Wed Apr 6 09:35:49 2011 @@ -0,0 +1,64 @@ +/* $NetBSD: t_tanh.c,v 1.1 2011/04/06 09:35:49 jruoho Exp $ */ + +/*- + * Copyright (c) 2011 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jukka Ruohonen. + * + * 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 <sys/cdefs.h> +__RCSID("$NetBSD: t_tanh.c,v 1.1 2011/04/06 09:35:49 jruoho Exp $"); + +#include <math.h> + +#include <atf-c.h> + +ATF_TC(tanh_sign); +ATF_TC_HEAD(tanh_sign, tc) +{ + atf_tc_set_md_var(tc, "descr", "Test signs in tanh(3) and tanhf(3)"); +} + +ATF_TC_BODY(tanh_sign, tc) +{ + double d; + float f; + + /* + * PR lib/44057. + */ + d = tanh(-0.0); + f = tanhf(-0.0); + + ATF_REQUIRE(signbit(d) != 0); + ATF_REQUIRE(signbit(f) != 0); +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, tanh_sign); + + return atf_no_error(); +}