Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src add failing test for PR lib/51427
details: https://anonhg.NetBSD.org/src/rev/b89fdaff451f
branches: trunk
changeset: 347351:b89fdaff451f
user: maya <maya%NetBSD.org@localhost>
date: Mon Aug 22 08:49:33 2016 +0000
description:
add failing test for PR lib/51427
ilogb(INFINITY)=-INT_MAX, it should be INT_MAX
while here, test raised exceptions, other values.
XXX some platforms don't have exceptions
diffstat:
distrib/sets/lists/debug/mi | 3 +-
distrib/sets/lists/tests/mi | 3 +-
tests/lib/libm/Makefile | 3 +-
tests/lib/libm/t_ilogb.c | 109 ++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 115 insertions(+), 3 deletions(-)
diffs (164 lines):
diff -r 702e95a5f921 -r b89fdaff451f distrib/sets/lists/debug/mi
--- a/distrib/sets/lists/debug/mi Mon Aug 22 08:39:20 2016 +0000
+++ b/distrib/sets/lists/debug/mi Mon Aug 22 08:49:33 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.164 2016/08/20 11:34:49 christos Exp $
+# $NetBSD: mi,v 1.165 2016/08/22 08:49:33 maya Exp $
./etc/mtree/set.debug comp-sys-root
./usr/lib comp-sys-usr compatdir
./usr/lib/i18n/libBIG5_g.a comp-c-debuglib debuglib,compatfile
@@ -2105,6 +2105,7 @@
./usr/libdata/debug/usr/tests/lib/libm/t_floor.debug tests-obsolete obsolete,compattestfile
./usr/libdata/debug/usr/tests/lib/libm/t_fmod.debug tests-lib-debug debug,atf,compattestfile
./usr/libdata/debug/usr/tests/lib/libm/t_hypot.debug tests-lib-debug debug,atf,compattestfile
+./usr/libdata/debug/usr/tests/lib/libm/t_ilogb.debug tests-lib-debug debug,atf,compattestfile
./usr/libdata/debug/usr/tests/lib/libm/t_infinity.debug tests-lib-debug debug,atf,compattestfile
./usr/libdata/debug/usr/tests/lib/libm/t_ldexp.debug tests-lib-debug debug,atf,compattestfile
./usr/libdata/debug/usr/tests/lib/libm/t_libm.debug tests-obsolete obsolete,compattestfile
diff -r 702e95a5f921 -r b89fdaff451f distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Mon Aug 22 08:39:20 2016 +0000
+++ b/distrib/sets/lists/tests/mi Mon Aug 22 08:49:33 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.683 2016/08/19 10:22:42 christos Exp $
+# $NetBSD: mi,v 1.684 2016/08/22 08:49:33 maya Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -2912,6 +2912,7 @@
./usr/tests/lib/libm/t_floor tests-obsolete obsolete
./usr/tests/lib/libm/t_fmod tests-lib-tests compattestfile,atf
./usr/tests/lib/libm/t_hypot tests-lib-tests compattestfile,atf
+./usr/tests/lib/libm/t_ilogb tests-lib-tests compattestfile,atf
./usr/tests/lib/libm/t_infinity tests-lib-tests compattestfile,atf
./usr/tests/lib/libm/t_ldexp tests-lib-tests compattestfile,atf
./usr/tests/lib/libm/t_libm tests-obsolete obsolete
diff -r 702e95a5f921 -r b89fdaff451f tests/lib/libm/Makefile
--- a/tests/lib/libm/Makefile Mon Aug 22 08:39:20 2016 +0000
+++ b/tests/lib/libm/Makefile Mon Aug 22 08:49:33 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.37 2016/01/24 20:26:47 gson Exp $
+# $NetBSD: Makefile,v 1.38 2016/08/22 08:49:33 maya Exp $
.include <bsd.own.mk>
@@ -23,6 +23,7 @@
TESTS_C+= t_fenv
TESTS_C+= t_fmod
TESTS_C+= t_hypot
+TESTS_C+= t_ilogb
TESTS_C+= t_infinity
TESTS_C+= t_ldexp
TESTS_C+= t_log
diff -r 702e95a5f921 -r b89fdaff451f tests/lib/libm/t_ilogb.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libm/t_ilogb.c Mon Aug 22 08:49:33 2016 +0000
@@ -0,0 +1,109 @@
+/* $NetBSD: t_ilogb.c,v 1.1 2016/08/22 08:49:33 maya Exp $ */
+
+/*-
+ * Copyright (c) 2016 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Maya Rashish.
+ *
+ * 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 <atf-c.h>
+#include <fenv.h>
+#include <math.h>
+
+#define ATF_CHECK_RAISED_INVALID do { \
+ int r; \
+ r = feclearexcept(FE_ALL_EXCEPT); \
+ ATF_CHECK(r == FE_INVALID); \
+ } while (0)
+
+#define ATF_CHECK_RAISED_NOTHING do { \
+ int r; \
+ r = feclearexcept(FE_ALL_EXCEPT); \
+ ATF_CHECK(r == 0); \
+ } while (0)
+
+ATF_TC(ilogb);
+ATF_TC_HEAD(ilogb, tc)
+{
+ atf_tc_set_md_var(tc, "descr","Check ilogb family");
+}
+
+ATF_TC_BODY(ilogb, tc)
+{
+ atf_tc_expect_fail("PR lib/51427");
+
+ ATF_CHECK(ilogbf(0) == FP_ILOGB0);
+ ATF_CHECK_RAISED_INVALID;
+ ATF_CHECK(ilogb(0) == FP_ILOGB0);
+ ATF_CHECK_RAISED_INVALID;
+ ATF_CHECK(ilogbl(0) == FP_ILOGB0);
+ ATF_CHECK_RAISED_INVALID;
+
+ ATF_CHECK(ilogbf(-0) == FP_ILOGB0);
+ ATF_CHECK_RAISED_INVALID;
+ ATF_CHECK(ilogb(-0) == FP_ILOGB0);
+ ATF_CHECK_RAISED_INVALID;
+ ATF_CHECK(ilogbl(-0) == FP_ILOGB0);
+ ATF_CHECK_RAISED_INVALID;
+
+ ATF_CHECK(ilogbf(INFINITY) == INT_MAX);
+ ATF_CHECK_RAISED_INVALID;
+ ATF_CHECK(ilogb(INFINITY) == INT_MAX);
+ ATF_CHECK_RAISED_INVALID;
+ ATF_CHECK(ilogbl(INFINITY) == INT_MAX);
+ ATF_CHECK_RAISED_INVALID;
+
+ ATF_CHECK(ilogbf(-INFINITY) == INT_MAX);
+ ATF_CHECK_RAISED_INVALID;
+ ATF_CHECK(ilogb(-INFINITY) == INT_MAX);
+ ATF_CHECK_RAISED_INVALID;
+ ATF_CHECK(ilogbl(-INFINITY) == INT_MAX);
+ ATF_CHECK_RAISED_INVALID;
+
+ ATF_CHECK(ilogbf(2^20) == 20);
+ ATF_CHECK_RAISED_NOTHING;
+ ATF_CHECK(ilogb(2^20) == 20);
+ ATF_CHECK_RAISED_NOTHING;
+ ATF_CHECK(ilogbl(2^20) == 20);
+ ATF_CHECK_RAISED_NOTHING;
+
+#ifndef __vax__
+ ATF_CHECK(ilogbf(NAN) == FP_ILOGBNAN);
+ ATF_CHECK_RAISED_INVALID;
+ ATF_CHECK(ilogb(NAN) == FP_ILOGBNAN);
+ ATF_CHECK_RAISED_INVALID;
+ ATF_CHECK(ilogbl(NAN) == FP_ILOGBNAN);
+ ATF_CHECK_RAISED_INVALID;
+#endif
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+ ATF_TP_ADD_TC(tp, ilogb);
+
+ return atf_no_error();
+}
Home |
Main Index |
Thread Index |
Old Index