Module Name:    src
Committed By:   jruoho
Date:           Mon Sep 12 15:27:41 UTC 2011

Modified Files:
        src/distrib/sets/lists/tests: mi
        src/tests/lib/libm: Makefile
Added Files:
        src/tests/lib/libm: t_ldexp.c t_scalbn.c

Log Message:
Start systematic testing of libm(3) by first evaluating the corner cases
(NaN, +0.0, -0.0, +Inf, -Inf) for the ldexp(3) and scalbn(3) families.


To generate a diff of this commit:
cvs rdiff -u -r1.382 -r1.383 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libm/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libm/t_ldexp.c \
    src/tests/lib/libm/t_scalbn.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.382 src/distrib/sets/lists/tests/mi:1.383
--- src/distrib/sets/lists/tests/mi:1.382	Sun Sep 11 10:32:23 2011
+++ src/distrib/sets/lists/tests/mi	Mon Sep 12 15:27:40 2011
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.382 2011/09/11 10:32:23 jruoho Exp $
+# $NetBSD: mi,v 1.383 2011/09/12 15:27:40 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -549,9 +549,11 @@
 ./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_infinity.debug			tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libm/t_ldexp.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libm/t_log.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libm/t_libm.debug			tests-obsolete		obsolete
 ./usr/libdata/debug/usr/tests/lib/libm/t_round.debug			tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libm/t_scalbn.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
@@ -2253,9 +2255,11 @@
 ./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_infinity			tests-lib-tests		atf
+./usr/tests/lib/libm/t_ldexp			tests-lib-tests		atf
 ./usr/tests/lib/libm/t_log			tests-lib-tests		atf
 ./usr/tests/lib/libm/t_libm			tests-obsolete		obsolete
 ./usr/tests/lib/libm/t_round			tests-lib-tests		atf
+./usr/tests/lib/libm/t_scalbn			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

Index: src/tests/lib/libm/Makefile
diff -u src/tests/lib/libm/Makefile:1.6 src/tests/lib/libm/Makefile:1.7
--- src/tests/lib/libm/Makefile:1.6	Mon Apr 11 10:51:36 2011
+++ src/tests/lib/libm/Makefile	Mon Sep 12 15:27:40 2011
@@ -1,12 +1,19 @@
-# $NetBSD: Makefile,v 1.6 2011/04/11 10:51:36 martin Exp $
+# $NetBSD: Makefile,v 1.7 2011/09/12 15:27:40 jruoho Exp $
 
 .include <bsd.own.mk>
 
 TESTSDIR=	${TESTSBASE}/lib/libm
 
-TESTS_C+=	t_ceil t_floor t_log t_round t_tanh t_infinity
+TESTS_C+=	t_ceil
+TESTS_C+=	t_floor
+TESTS_C+=	t_infinity
+TESTS_C+=	t_ldexp
+TESTS_C+=	t_log
+TESTS_C+=	t_round
+TESTS_C+=	t_scalbn
+TESTS_C+=	t_tanh
 
 LDADD+=		-lm
-COPTS+=		-Wfloat-equal
+#COPTS+=	-Wfloat-equal
 
 .include <bsd.test.mk>

Added files:

Index: src/tests/lib/libm/t_ldexp.c
diff -u /dev/null src/tests/lib/libm/t_ldexp.c:1.1
--- /dev/null	Mon Sep 12 15:27:41 2011
+++ src/tests/lib/libm/t_ldexp.c	Mon Sep 12 15:27:40 2011
@@ -0,0 +1,220 @@
+/* $NetBSD: t_ldexp.c,v 1.1 2011/09/12 15:27:40 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_ldexp.c,v 1.1 2011/09/12 15:27:40 jruoho Exp $");
+
+#include <math.h>
+#include <limits.h>
+
+#include <atf-c.h>
+
+static const int exps[] = { 0, 1, -1, 100, -100 };
+
+/*
+ * ldexp(3)
+ */
+ATF_TC(ldexp_nan);
+ATF_TC_HEAD(ldexp_nan, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test NaN with ldexp(3)");
+}
+
+ATF_TC_BODY(ldexp_nan, tc)
+{
+	const double x = 0.0L / 0.0L;
+	double y;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++) {
+		y = ldexp(x, exps[i]);
+		ATF_CHECK(isnan(y) != 0);
+	}
+}
+
+ATF_TC(ldexp_inf_neg);
+ATF_TC_HEAD(ldexp_inf_neg, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test -Inf with ldexp(3)");
+}
+
+ATF_TC_BODY(ldexp_inf_neg, tc)
+{
+	const double x = -1.0L / 0.0L;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++)
+		ATF_CHECK(ldexp(x, exps[i]) == x);
+}
+
+ATF_TC(ldexp_inf_pos);
+ATF_TC_HEAD(ldexp_inf_pos, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test +Inf with ldexp(3)");
+}
+
+ATF_TC_BODY(ldexp_inf_pos, tc)
+{
+	const double x = 1.0L / 0.0L;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++)
+		ATF_CHECK(ldexp(x, exps[i]) == x);
+}
+
+ATF_TC(ldexp_zero_neg);
+ATF_TC_HEAD(ldexp_zero_neg, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test -0.0 with ldexp(3)");
+}
+
+ATF_TC_BODY(ldexp_zero_neg, tc)
+{
+	const double x = -0.0L;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++)
+		ATF_CHECK(ldexp(x, exps[i]) == x);
+}
+
+ATF_TC(ldexp_zero_pos);
+ATF_TC_HEAD(ldexp_zero_pos, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test +0.0 with ldexp(3)");
+}
+
+ATF_TC_BODY(ldexp_zero_pos, tc)
+{
+	const double x = 0.0L;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++)
+		ATF_CHECK(ldexp(x, exps[i]) == x);
+}
+
+ATF_TC(ldexpf_nan);
+ATF_TC_HEAD(ldexpf_nan, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test NaN with ldexpf(3)");
+}
+
+ATF_TC_BODY(ldexpf_nan, tc)
+{
+	const float x = 0.0L / 0.0L;
+	float y;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++) {
+		y = ldexpf(x, exps[i]);
+		ATF_CHECK(isnan(y) != 0);
+	}
+}
+
+/*
+ * ldexpf(3)
+ */
+
+ATF_TC(ldexpf_inf_neg);
+ATF_TC_HEAD(ldexpf_inf_neg, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test -Inf with ldexpf(3)");
+}
+
+ATF_TC_BODY(ldexpf_inf_neg, tc)
+{
+	const float x = -1.0L / 0.0L;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++)
+		ATF_CHECK(ldexpf(x, exps[i]) == x);
+}
+
+ATF_TC(ldexpf_inf_pos);
+ATF_TC_HEAD(ldexpf_inf_pos, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test +Inf with ldexpf(3)");
+}
+
+ATF_TC_BODY(ldexpf_inf_pos, tc)
+{
+	const float x = 1.0L / 0.0L;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++)
+		ATF_CHECK(ldexpf(x, exps[i]) == x);
+}
+
+ATF_TC(ldexpf_zero_neg);
+ATF_TC_HEAD(ldexpf_zero_neg, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test -0.0 with ldexpf(3)");
+}
+
+ATF_TC_BODY(ldexpf_zero_neg, tc)
+{
+	const float x = -0.0L;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++)
+		ATF_CHECK(ldexpf(x, exps[i]) == x);
+}
+
+ATF_TC(ldexpf_zero_pos);
+ATF_TC_HEAD(ldexpf_zero_pos, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test +0.0 with ldexpf(3)");
+}
+
+ATF_TC_BODY(ldexpf_zero_pos, tc)
+{
+	const float x = 0.0L;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++)
+		ATF_CHECK(ldexpf(x, exps[i]) == x);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+	ATF_TP_ADD_TC(tp, ldexp_nan);
+	ATF_TP_ADD_TC(tp, ldexp_inf_neg);
+	ATF_TP_ADD_TC(tp, ldexp_inf_pos);
+	ATF_TP_ADD_TC(tp, ldexp_zero_neg);
+	ATF_TP_ADD_TC(tp, ldexp_zero_pos);
+
+	ATF_TP_ADD_TC(tp, ldexpf_nan);
+	ATF_TP_ADD_TC(tp, ldexpf_inf_neg);
+	ATF_TP_ADD_TC(tp, ldexpf_inf_pos);
+	ATF_TP_ADD_TC(tp, ldexpf_zero_neg);
+	ATF_TP_ADD_TC(tp, ldexpf_zero_pos);
+
+	return atf_no_error();
+}
Index: src/tests/lib/libm/t_scalbn.c
diff -u /dev/null src/tests/lib/libm/t_scalbn.c:1.1
--- /dev/null	Mon Sep 12 15:27:41 2011
+++ src/tests/lib/libm/t_scalbn.c	Mon Sep 12 15:27:40 2011
@@ -0,0 +1,326 @@
+/* $NetBSD: t_scalbn.c,v 1.1 2011/09/12 15:27:40 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_scalbn.c,v 1.1 2011/09/12 15:27:40 jruoho Exp $");
+
+#include <math.h>
+#include <limits.h>
+
+#include <atf-c.h>
+
+static const int exps[] = { 0, 1, -1, 100, -100 };
+
+/*
+ * scalbn(3)
+ */
+ATF_TC(scalbn_nan);
+ATF_TC_HEAD(scalbn_nan, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test NaN with scalbn(3)");
+}
+
+ATF_TC_BODY(scalbn_nan, tc)
+{
+	const double x = 0.0L / 0.0L;
+	double y;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++) {
+		y = scalbn(x, exps[i]);
+		ATF_CHECK(isnan(y) != 0);
+	}
+}
+
+ATF_TC(scalbn_inf_neg);
+ATF_TC_HEAD(scalbn_inf_neg, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test -Inf with scalbn(3)");
+}
+
+ATF_TC_BODY(scalbn_inf_neg, tc)
+{
+	const double x = -1.0L / 0.0L;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++)
+		ATF_CHECK(scalbn(x, exps[i]) == x);
+}
+
+ATF_TC(scalbn_inf_pos);
+ATF_TC_HEAD(scalbn_inf_pos, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test +Inf with scalbn(3)");
+}
+
+ATF_TC_BODY(scalbn_inf_pos, tc)
+{
+	const double x = 1.0L / 0.0L;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++)
+		ATF_CHECK(scalbn(x, exps[i]) == x);
+}
+
+ATF_TC(scalbn_zero_neg);
+ATF_TC_HEAD(scalbn_zero_neg, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test -0.0 with scalbn(3)");
+}
+
+ATF_TC_BODY(scalbn_zero_neg, tc)
+{
+	const double x = -0.0L;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++)
+		ATF_CHECK(scalbn(x, exps[i]) == x);
+}
+
+ATF_TC(scalbn_zero_pos);
+ATF_TC_HEAD(scalbn_zero_pos, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test +0.0 with scalbn(3)");
+}
+
+ATF_TC_BODY(scalbn_zero_pos, tc)
+{
+	const double x = 0.0L;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++)
+		ATF_CHECK(scalbn(x, exps[i]) == x);
+}
+
+/*
+ * scalbnf(3)
+ */
+ATF_TC(scalbnf_nan);
+ATF_TC_HEAD(scalbnf_nan, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test NaN with scalbnf(3)");
+}
+
+ATF_TC_BODY(scalbnf_nan, tc)
+{
+	const float x = 0.0L / 0.0L;
+	float y;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++) {
+		y = scalbnf(x, exps[i]);
+		ATF_CHECK(isnan(y) != 0);
+	}
+}
+
+ATF_TC(scalbnf_inf_neg);
+ATF_TC_HEAD(scalbnf_inf_neg, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test -Inf with scalbnf(3)");
+}
+
+ATF_TC_BODY(scalbnf_inf_neg, tc)
+{
+	const float x = -1.0L / 0.0L;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++)
+		ATF_CHECK(scalbnf(x, exps[i]) == x);
+}
+
+ATF_TC(scalbnf_inf_pos);
+ATF_TC_HEAD(scalbnf_inf_pos, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test +Inf with scalbnf(3)");
+}
+
+ATF_TC_BODY(scalbnf_inf_pos, tc)
+{
+	const float x = 1.0L / 0.0L;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++)
+		ATF_CHECK(scalbnf(x, exps[i]) == x);
+}
+
+ATF_TC(scalbnf_zero_neg);
+ATF_TC_HEAD(scalbnf_zero_neg, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test -0.0 with scalbnf(3)");
+}
+
+ATF_TC_BODY(scalbnf_zero_neg, tc)
+{
+	const float x = -0.0L;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++)
+		ATF_CHECK(scalbnf(x, exps[i]) == x);
+}
+
+ATF_TC(scalbnf_zero_pos);
+ATF_TC_HEAD(scalbnf_zero_pos, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test +0.0 with scalbnf(3)");
+}
+
+ATF_TC_BODY(scalbnf_zero_pos, tc)
+{
+	const float x = 0.0L;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++)
+		ATF_CHECK(scalbnf(x, exps[i]) == x);
+}
+
+/*
+ * scalbnl(3)
+ */
+ATF_TC(scalbnl_nan);
+ATF_TC_HEAD(scalbnl_nan, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test NaN with scalbnl(3)");
+}
+
+ATF_TC_BODY(scalbnl_nan, tc)
+{
+#ifndef __HAVE_LONG_DOUBLE
+	atf_tc_skip("Requires long double support");
+#else
+	const long double x = 0.0L / 0.0L;
+	long double y;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++) {
+		y = scalbnl(x, exps[i]);
+		ATF_CHECK(isnan(y) != 0);
+	}
+#endif
+}
+
+ATF_TC(scalbnl_inf_neg);
+ATF_TC_HEAD(scalbnl_inf_neg, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test -Inf with scalbnl(3)");
+}
+
+ATF_TC_BODY(scalbnl_inf_neg, tc)
+{
+#ifndef __HAVE_LONG_DOUBLE
+	atf_tc_skip("Requires long double support");
+#else
+	const long double x = -1.0L / 0.0L;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++)
+		ATF_CHECK(scalbnl(x, exps[i]) == x);
+#endif
+}
+
+ATF_TC(scalbnl_inf_pos);
+ATF_TC_HEAD(scalbnl_inf_pos, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test +Inf with scalbnl(3)");
+}
+
+ATF_TC_BODY(scalbnl_inf_pos, tc)
+{
+#ifndef __HAVE_LONG_DOUBLE
+	atf_tc_skip("Requires long double support");
+#else
+	const long double x = 1.0L / 0.0L;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++)
+		ATF_CHECK(scalbnl(x, exps[i]) == x);
+#endif
+}
+
+ATF_TC(scalbnl_zero_neg);
+ATF_TC_HEAD(scalbnl_zero_neg, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test -0.0 with scalbnl(3)");
+}
+
+ATF_TC_BODY(scalbnl_zero_neg, tc)
+{
+#ifndef __HAVE_LONG_DOUBLE
+	atf_tc_skip("Requires long double support");
+#else
+	const long double x = -0.0L;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++)
+		ATF_CHECK(scalbnl(x, exps[i]) == x);
+#endif
+}
+
+ATF_TC(scalbnl_zero_pos);
+ATF_TC_HEAD(scalbnl_zero_pos, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test +0.0 with scalbnl(3)");
+}
+
+ATF_TC_BODY(scalbnl_zero_pos, tc)
+{
+#ifndef __HAVE_LONG_DOUBLE
+	atf_tc_skip("Requires long double support");
+#else
+	const long double x = 0.0L;
+	size_t i;
+
+	for (i = 0; i < __arraycount(exps); i++)
+		ATF_CHECK(scalbnl(x, exps[i]) == x);
+#endif
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+	ATF_TP_ADD_TC(tp, scalbn_nan);
+	ATF_TP_ADD_TC(tp, scalbn_inf_neg);
+	ATF_TP_ADD_TC(tp, scalbn_inf_pos);
+	ATF_TP_ADD_TC(tp, scalbn_zero_neg);
+	ATF_TP_ADD_TC(tp, scalbn_zero_pos);
+
+	ATF_TP_ADD_TC(tp, scalbnf_nan);
+	ATF_TP_ADD_TC(tp, scalbnf_inf_neg);
+	ATF_TP_ADD_TC(tp, scalbnf_inf_pos);
+	ATF_TP_ADD_TC(tp, scalbnf_zero_neg);
+	ATF_TP_ADD_TC(tp, scalbnf_zero_pos);
+
+	ATF_TP_ADD_TC(tp, scalbnl_nan);
+	ATF_TP_ADD_TC(tp, scalbnl_inf_neg);
+	ATF_TP_ADD_TC(tp, scalbnl_inf_pos);
+	ATF_TP_ADD_TC(tp, scalbnl_zero_neg);
+	ATF_TP_ADD_TC(tp, scalbnl_zero_pos);
+
+	return atf_no_error();
+}

Reply via email to