]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++11.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 26_numerics / headers / cmath / c99_classification_macros_c++11.cc
1 // Copyright (C) 2010-2020 Free Software Foundation, Inc.
2 //
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
7 // any later version.
8
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
17
18 // { dg-do compile { target c++11 } }
19 // { dg-excess-errors "" { target uclibc } }
20
21 #include <cmath>
22
23 void fpclassify() { }
24
25 void isfinite() { }
26
27 void isinf() { }
28
29 void isnan() { }
30
31 void isnormal() { }
32
33 void signbit() { }
34
35 void isgreater() { }
36
37 void isgreaterequal() { }
38
39 void isless() { }
40
41 void islessequal() { }
42
43 void islessgreater() { }
44
45 void isunordered() { }
46
47 #if _GLIBCXX_USE_C99_MATH
48 template <typename _Tp, typename _Up = _Tp>
49 void test_c99_classify()
50 {
51 typedef _Tp fp_type_one;
52 typedef _Up fp_type_two;
53 fp_type_one f1 = 1.0;
54 fp_type_two f2 = 3.0;
55 int resi;
56 bool res;
57
58 resi = std::fpclassify(f1);
59 res = std::isfinite(f2);
60 res = std::isinf(f1);
61 res = std::isnan(f2);
62 res = std::isnormal(f1);
63 res = std::signbit(f2);
64 res = std::isgreater(f1, f2);
65 res = std::isgreaterequal(f1, f2);
66 res = std::isless(f1, f2);
67 res = std::islessequal(f1,f2);
68 res = std::islessgreater(f1, f2);
69 res = std::isunordered(f1, f2);
70 resi = resi; // Suppress unused warning.
71 res = res;
72 }
73 #endif
74
75 int main()
76 {
77 #if _GLIBCXX_USE_C99_MATH
78 test_c99_classify<float>();
79 test_c99_classify<double>();
80 test_c99_classify<long double>();
81 test_c99_classify<float, double>();
82 test_c99_classify<float, long double>();
83 test_c99_classify<double, float>();
84 test_c99_classify<double, long double>();
85 test_c99_classify<long double, float>();
86 test_c99_classify<long double, double>();
87 #endif
88 return 0;
89 }