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 casinh



details:   https://anonhg.NetBSD.org/src/rev/23fd8e8f365d
branches:  trunk
changeset: 817667:23fd8e8f365d
user:      maya <maya%NetBSD.org@localhost>
date:      Wed Aug 31 14:05:09 2016 +0000

description:
Add failing test for casinh

diffstat:

 distrib/sets/lists/debug/mi |   3 +-
 distrib/sets/lists/tests/mi |   3 +-
 tests/lib/libm/Makefile     |   3 +-
 tests/lib/libm/t_casinh.c   |  78 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 84 insertions(+), 3 deletions(-)

diffs (133 lines):

diff -r 559059f9c83e -r 23fd8e8f365d distrib/sets/lists/debug/mi
--- a/distrib/sets/lists/debug/mi       Wed Aug 31 09:34:04 2016 +0000
+++ b/distrib/sets/lists/debug/mi       Wed Aug 31 14:05:09 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.165 2016/08/22 08:49:33 maya Exp $
+# $NetBSD: mi,v 1.166 2016/08/31 14:05:09 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
@@ -2095,6 +2095,7 @@
 ./usr/libdata/debug/usr/tests/lib/libm/t_acos.debug                    tests-lib-debug         debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libm/t_asin.debug                    tests-lib-debug         debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libm/t_atan.debug                    tests-lib-debug         debug,atf,compattestfile
+./usr/libdata/debug/usr/tests/lib/libm/t_casinh.debug                  tests-lib-debug         debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libm/t_cbrt.debug                    tests-lib-debug         debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libm/t_ceil.debug                    tests-lib-debug         debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libm/t_cos.debug                     tests-lib-debug         debug,atf,compattestfile
diff -r 559059f9c83e -r 23fd8e8f365d distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Wed Aug 31 09:34:04 2016 +0000
+++ b/distrib/sets/lists/tests/mi       Wed Aug 31 14:05:09 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.684 2016/08/22 08:49:33 maya Exp $
+# $NetBSD: mi,v 1.685 2016/08/31 14:05:10 maya Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2902,6 +2902,7 @@
 ./usr/tests/lib/libm/t_acos                    tests-lib-tests         compattestfile,atf
 ./usr/tests/lib/libm/t_asin                    tests-lib-tests         compattestfile,atf
 ./usr/tests/lib/libm/t_atan                    tests-lib-tests         compattestfile,atf
+./usr/tests/lib/libm/t_casinh                  tests-lib-tests         compattestfile,atf
 ./usr/tests/lib/libm/t_cbrt                    tests-lib-tests         compattestfile,atf
 ./usr/tests/lib/libm/t_ceil                    tests-lib-tests         compattestfile,atf
 ./usr/tests/lib/libm/t_cos                     tests-lib-tests         compattestfile,atf
diff -r 559059f9c83e -r 23fd8e8f365d tests/lib/libm/Makefile
--- a/tests/lib/libm/Makefile   Wed Aug 31 09:34:04 2016 +0000
+++ b/tests/lib/libm/Makefile   Wed Aug 31 14:05:09 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.39 2016/08/23 10:03:44 christos Exp $
+# $NetBSD: Makefile,v 1.40 2016/08/31 14:05:10 maya Exp $
 
 .include <bsd.own.mk>
 
@@ -15,6 +15,7 @@
 TESTS_C+=      t_acos
 TESTS_C+=      t_asin
 TESTS_C+=      t_atan
+TESTS_C+=      t_casinh
 TESTS_C+=      t_cbrt
 TESTS_C+=      t_ceil
 TESTS_C+=      t_cos
diff -r 559059f9c83e -r 23fd8e8f365d tests/lib/libm/t_casinh.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libm/t_casinh.c Wed Aug 31 14:05:09 2016 +0000
@@ -0,0 +1,78 @@
+/* $NetBSD: t_casinh.c,v 1.1 2016/08/31 14:05:10 maya Exp $ */
+
+/*
+ * Written by Maya Rashish
+ * Public domain.
+ *
+ * Testing special values of casinh
+ * Values from ISO/IEC 9899:201x G.6.2.2
+ */
+
+#include <atf-c.h>
+#include <complex.h>
+#include <math.h>
+
+#define RE(z) (((double *)(&z))[0])
+#define IM(z) (((double *)(&z))[1])
+
+static const struct {
+       double input_re;
+       double input_im;
+       double result_re;
+       double result_im;
+} values[] = {
+       { +0,           +0,             +0,             +0},
+       { +5.032E3,     +INFINITY,      +INFINITY,      +M_PI/2},
+       { +INFINITY,    +5.023E3,       +INFINITY,      +0},
+       { +INFINITY,    +INFINITY,      +INFINITY,      +M_PI/4},
+#ifdef __HAVE_NANF
+       { +INFINITY,    +NAN,           +INFINITY,      +NAN},
+       { +5.032E3,     +NAN,           +NAN,           +NAN}, /* + FE_INVALID optionally raised */
+       { +NAN,         +0,             +NAN,           +0},
+       { +NAN,         -5.023E3,       +NAN,           +NAN}, /* + FE_INVALID optionally raised */
+       { +NAN,         +INFINITY,      +INFINITY,      +NAN}, /* sign of real part of result unspecified */
+       { +NAN,         +NAN,           +NAN,           +NAN},
+#endif
+};
+
+#ifdef __HAVE_NANF
+#define both_nan(a,b) (isnan(a) && isnan(b))
+#else
+#define both_nan(a,b) 0
+#endif
+
+#define crude_equality(a,b) ((a == b) || both_nan(a,b))
+
+#define ATF_COMPLEX_EQUAL(a,b) do { \
+       ATF_CHECK(crude_equality(creal(a),creal(b)) && \
+           crude_equality(cimag(a), cimag(b))); \
+} while (0/*CONSTCOND*/)
+
+
+ATF_TC(casinh);
+ATF_TC_HEAD(casinh, tc)
+{
+       atf_tc_set_md_var(tc, "descr","Check casinh family - special values");
+}
+
+ATF_TC_BODY(casinh, tc)
+{
+       complex double input;
+       complex double result;
+       unsigned int i;
+       for (i = 0; i < __arraycount(values); i++) {
+               RE(input) = values[i].input_re;
+               IM(input) = values[i].input_im;
+               RE(result) = values[i].result_re;
+               IM(result) = values[i].result_im;
+               ATF_COMPLEX_EQUAL(casinh(input), result);
+       }
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+       ATF_TP_ADD_TC(tp, casinh);
+
+       return atf_no_error();
+}



Home | Main Index | Thread Index | Old Index