Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Add test case for PR lib/50646.
details: https://anonhg.NetBSD.org/src/rev/d2049f4409ba
branches: trunk
changeset: 320025:d2049f4409ba
user: maya <maya%NetBSD.org@localhost>
date: Wed Jun 20 03:51:27 2018 +0000
description:
Add test case for PR lib/50646.
Make sure that cabsl (aka __c99_cabsl) is usable from C++.
diffstat:
distrib/sets/lists/debug/mi | 3 +-
distrib/sets/lists/tests/mi | 3 +-
tests/lib/libm/Makefile | 3 +-
tests/lib/libm/t_cabsl.cxx | 66 +++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 72 insertions(+), 3 deletions(-)
diffs (121 lines):
diff -r 609d1c27e9d4 -r d2049f4409ba distrib/sets/lists/debug/mi
--- a/distrib/sets/lists/debug/mi Wed Jun 20 02:15:13 2018 +0000
+++ b/distrib/sets/lists/debug/mi Wed Jun 20 03:51:27 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.251 2018/06/14 08:22:52 yamaguchi Exp $
+# $NetBSD: mi,v 1.252 2018/06/20 03:51:27 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
@@ -2174,6 +2174,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_cabsl.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
diff -r 609d1c27e9d4 -r d2049f4409ba distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Wed Jun 20 02:15:13 2018 +0000
+++ b/distrib/sets/lists/tests/mi Wed Jun 20 03:51:27 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.787 2018/06/15 09:54:02 yamaguchi Exp $
+# $NetBSD: mi,v 1.788 2018/06/20 03:51:27 maya Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -2994,6 +2994,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_cabsl 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
diff -r 609d1c27e9d4 -r d2049f4409ba tests/lib/libm/Makefile
--- a/tests/lib/libm/Makefile Wed Jun 20 02:15:13 2018 +0000
+++ b/tests/lib/libm/Makefile Wed Jun 20 03:51:27 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.43 2018/06/04 09:13:47 maya Exp $
+# $NetBSD: Makefile,v 1.44 2018/06/20 03:51:27 maya Exp $
.include <bsd.own.mk>
@@ -42,6 +42,7 @@
TESTS_C+= t_sqrt
TESTS_C+= t_tan
TESTS_C+= t_tanh
+TESTS_CXX+= t_cabsl
LDADD+= -lm
#COPTS+= -Wfloat-equal
diff -r 609d1c27e9d4 -r d2049f4409ba tests/lib/libm/t_cabsl.cxx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libm/t_cabsl.cxx Wed Jun 20 03:51:27 2018 +0000
@@ -0,0 +1,66 @@
+/*-
+ * Copyright (c) 2018 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.
+ */
+
+/*
+ * Test that C++ "cabsl" is usable. PR lib/50646
+ */
+
+#include <atf-c++.hpp>
+#include <complex>
+
+ATF_TEST_CASE(cabsl);
+ATF_TEST_CASE_HEAD(cabsl)
+{
+ set_md_var("descr", "Check that cabsl is usable from C++");
+}
+ATF_TEST_CASE_BODY(cabsl)
+{
+ int sum = 0;
+
+#ifdef __HAVE_LONG_DOUBLE
+ std::complex<long double> cld(3.0,4.0);
+ sum += std::abs(cld);
+#endif
+ std::complex<double> cd(3.0,4.0);
+ sum += std::abs(cd);
+
+ std::complex<float> cf(3.0,4.0);
+ sum += std::abs(cf);
+
+#ifdef __HAVE_LONG_DOUBLE
+ ATF_REQUIRE_EQ(sum, 3*5);
+#else
+ ATF_REQUIRE_EQ(sum, 2*5);
+#endif
+}
+
+ATF_INIT_TEST_CASES(tcs)
+{
+ ATF_ADD_TEST_CASE(tcs, cabsl);
+}
Home |
Main Index |
Thread Index |
Old Index