]>
Commit | Line | Data |
---|---|---|
b56f1953 | 1 | // { dg-do compile } |
2 | ||
969de1a7 | 3 | // 2006-01-12 Paolo Carlini <pcarlini@suse.de> |
4 | // | |
f1717362 | 5 | // Copyright (C) 2006-2016 Free Software Foundation, Inc. |
969de1a7 | 6 | // |
7 | // This file is part of the GNU ISO C++ Library. This library is free | |
8 | // software; you can redistribute it and/or modify it under the | |
9 | // terms of the GNU General Public License as published by the | |
6bc9506f | 10 | // Free Software Foundation; either version 3, or (at your option) |
969de1a7 | 11 | // any later version. |
12 | // | |
13 | // This library is distributed in the hope that it will be useful, | |
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | // GNU General Public License for more details. | |
17 | // | |
18 | // You should have received a copy of the GNU General Public License along | |
6bc9506f | 19 | // with this library; see the file COPYING3. If not see |
20 | // <http://www.gnu.org/licenses/>. | |
969de1a7 | 21 | |
22 | // 8.1 Additions to header <complex> | |
23 | ||
24 | #include <tr1/complex> | |
969de1a7 | 25 | #include <testsuite_tr1.h> |
26 | ||
27 | void test01() | |
28 | { | |
626791f9 | 29 | using __gnu_test::check_ret_type; |
969de1a7 | 30 | |
31 | typedef std::complex<float> cmplx_f_type; | |
32 | typedef std::complex<double> cmplx_d_type; | |
33 | typedef std::complex<long double> cmplx_ld_type; | |
34 | ||
35 | const float f1 = 1.0f; | |
36 | const double d1 = 1.0; | |
37 | const long double ld1 = 1.0l; | |
38 | ||
39 | const cmplx_f_type c_f1(f1, f1); | |
40 | const cmplx_d_type c_d1(d1, d1); | |
41 | const cmplx_ld_type c_ld1(ld1, ld1); | |
42 | ||
626791f9 | 43 | check_ret_type<float>(std::tr1::arg(f1)); |
44 | check_ret_type<double>(std::tr1::arg(d1)); | |
45 | check_ret_type<long double>(std::tr1::arg(ld1)); | |
969de1a7 | 46 | |
626791f9 | 47 | check_ret_type<cmplx_f_type>(std::tr1::conj(f1)); |
48 | check_ret_type<cmplx_d_type>(std::tr1::conj(d1)); | |
49 | check_ret_type<cmplx_ld_type>(std::tr1::conj(ld1)); | |
969de1a7 | 50 | |
626791f9 | 51 | check_ret_type<float>(std::tr1::imag(f1)); |
52 | check_ret_type<double>(std::tr1::imag(d1)); | |
53 | check_ret_type<long double>(std::tr1::imag(ld1)); | |
969de1a7 | 54 | |
626791f9 | 55 | check_ret_type<float>(std::tr1::norm(f1)); |
56 | check_ret_type<double>(std::tr1::norm(d1)); | |
57 | check_ret_type<long double>(std::tr1::norm(ld1)); | |
969de1a7 | 58 | |
626791f9 | 59 | check_ret_type<cmplx_f_type>(std::tr1::polar(f1, f1)); |
60 | check_ret_type<cmplx_d_type>(std::tr1::polar(d1, f1)); | |
61 | check_ret_type<cmplx_d_type>(std::tr1::polar(f1, d1)); | |
62 | check_ret_type<cmplx_d_type>(std::tr1::polar(d1, d1)); | |
63 | check_ret_type<cmplx_ld_type>(std::tr1::polar(ld1, d1)); | |
64 | check_ret_type<cmplx_ld_type>(std::tr1::polar(d1, ld1)); | |
65 | check_ret_type<cmplx_ld_type>(std::tr1::polar(ld1, f1)); | |
66 | check_ret_type<cmplx_ld_type>(std::tr1::polar(f1, ld1)); | |
67 | check_ret_type<cmplx_ld_type>(std::tr1::polar(ld1, ld1)); | |
969de1a7 | 68 | |
626791f9 | 69 | check_ret_type<cmplx_f_type>(std::tr1::pow(c_f1, f1)); |
70 | check_ret_type<cmplx_d_type>(std::tr1::pow(c_d1, f1)); | |
71 | check_ret_type<cmplx_d_type>(std::tr1::pow(c_f1, d1)); | |
72 | check_ret_type<cmplx_d_type>(std::tr1::pow(c_d1, d1)); | |
73 | check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, d1)); | |
74 | check_ret_type<cmplx_ld_type>(std::tr1::pow(c_d1, ld1)); | |
75 | check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, f1)); | |
76 | check_ret_type<cmplx_ld_type>(std::tr1::pow(c_f1, ld1)); | |
77 | check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, ld1)); | |
969de1a7 | 78 | |
626791f9 | 79 | check_ret_type<cmplx_f_type>(std::tr1::pow(f1, c_f1)); |
80 | check_ret_type<cmplx_d_type>(std::tr1::pow(d1, c_f1)); | |
81 | check_ret_type<cmplx_d_type>(std::tr1::pow(f1, c_d1)); | |
82 | check_ret_type<cmplx_d_type>(std::tr1::pow(d1, c_d1)); | |
83 | check_ret_type<cmplx_ld_type>(std::tr1::pow(ld1, c_d1)); | |
84 | check_ret_type<cmplx_ld_type>(std::tr1::pow(d1, c_ld1)); | |
85 | check_ret_type<cmplx_ld_type>(std::tr1::pow(ld1, c_f1)); | |
86 | check_ret_type<cmplx_ld_type>(std::tr1::pow(f1, c_ld1)); | |
87 | check_ret_type<cmplx_ld_type>(std::tr1::pow(ld1, c_ld1)); | |
969de1a7 | 88 | |
626791f9 | 89 | check_ret_type<cmplx_f_type>(std::tr1::pow(c_f1, c_f1)); |
90 | check_ret_type<cmplx_d_type>(std::tr1::pow(c_d1, c_f1)); | |
91 | check_ret_type<cmplx_d_type>(std::tr1::pow(c_f1, c_d1)); | |
92 | check_ret_type<cmplx_d_type>(std::tr1::pow(c_d1, c_d1)); | |
93 | check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, c_d1)); | |
94 | check_ret_type<cmplx_ld_type>(std::tr1::pow(c_d1, c_ld1)); | |
95 | check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, c_f1)); | |
96 | check_ret_type<cmplx_ld_type>(std::tr1::pow(c_f1, c_ld1)); | |
97 | check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, c_ld1)); | |
969de1a7 | 98 | |
626791f9 | 99 | check_ret_type<float>(std::tr1::real(f1)); |
100 | check_ret_type<double>(std::tr1::real(d1)); | |
101 | check_ret_type<long double>(std::tr1::real(ld1)); | |
969de1a7 | 102 | } |