Module Name:    src
Committed By:   maya
Date:           Wed Jun 20 03:51:27 UTC 2018

Modified Files:
        src/distrib/sets/lists/debug: mi
        src/distrib/sets/lists/tests: mi
        src/tests/lib/libm: Makefile
Added Files:
        src/tests/lib/libm: t_cabsl.cxx

Log Message:
Add test case for PR lib/50646.

Make sure that cabsl (aka __c99_cabsl) is usable from C++.


To generate a diff of this commit:
cvs rdiff -u -r1.251 -r1.252 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.787 -r1.788 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.43 -r1.44 src/tests/lib/libm/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libm/t_cabsl.cxx

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/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.251 src/distrib/sets/lists/debug/mi:1.252
--- src/distrib/sets/lists/debug/mi:1.251	Thu Jun 14 08:22:52 2018
+++ src/distrib/sets/lists/debug/mi	Wed Jun 20 03:51:27 2018
@@ -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

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.787 src/distrib/sets/lists/tests/mi:1.788
--- src/distrib/sets/lists/tests/mi:1.787	Fri Jun 15 09:54:02 2018
+++ src/distrib/sets/lists/tests/mi	Wed Jun 20 03:51:27 2018
@@ -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

Index: src/tests/lib/libm/Makefile
diff -u src/tests/lib/libm/Makefile:1.43 src/tests/lib/libm/Makefile:1.44
--- src/tests/lib/libm/Makefile:1.43	Mon Jun  4 09:13:47 2018
+++ src/tests/lib/libm/Makefile	Wed Jun 20 03:51:27 2018
@@ -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_sinh
 TESTS_C+=	t_sqrt
 TESTS_C+=	t_tan
 TESTS_C+=	t_tanh
+TESTS_CXX+=	t_cabsl
 
 LDADD+=		-lm
 #COPTS+=	-Wfloat-equal

Added files:

Index: src/tests/lib/libm/t_cabsl.cxx
diff -u /dev/null src/tests/lib/libm/t_cabsl.cxx:1.1
--- /dev/null	Wed Jun 20 03:51:27 2018
+++ src/tests/lib/libm/t_cabsl.cxx	Wed Jun 20 03:51:27 2018
@@ -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);
+}

Reply via email to