]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++0x.cc
Update copyright years in libstdc++-v3/
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 26_numerics / headers / cmath / c99_classification_macros_c++0x.cc
1 // Copyright (C) 2010-2014 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-options "-std=gnu++0x" }
19 // { dg-do compile { xfail uclibc } }
20 // { dg-excess-errors "" { target uclibc } }
21
22 #include <cmath>
23
24 void fpclassify() { }
25
26 void isfinite() { }
27
28 void isinf() { }
29
30 void isnan() { }
31
32 void isnormal() { }
33
34 void signbit() { }
35
36 void isgreater() { }
37
38 void isgreaterequal() { }
39
40 void isless() { }
41
42 void islessequal() { }
43
44 void islessgreater() { }
45
46 void isunordered() { }
47
48 #if _GLIBCXX_USE_C99_MATH
49 template <typename _Tp, typename _Up = _Tp>
50 void test_c99_classify()
51 {
52 bool test __attribute__((unused)) = true;
53
54 typedef _Tp fp_type_one;
55 typedef _Up fp_type_two;
56 fp_type_one f1 = 1.0;
57 fp_type_two f2 = 3.0;
58 int resi;
59 bool res;
60
61 resi = std::fpclassify(f1);
62 res = std::isfinite(f2);
63 res = std::isinf(f1);
64 res = std::isnan(f2);
65 res = std::isnormal(f1);
66 res = std::signbit(f2);
67 res = std::isgreater(f1, f2);
68 res = std::isgreaterequal(f1, f2);
69 res = std::isless(f1, f2);
70 res = std::islessequal(f1,f2);
71 res = std::islessgreater(f1, f2);
72 res = std::isunordered(f1, f2);
73 resi = resi; // Suppress unused warning.
74 res = res;
75 }
76 #endif
77
78 int main()
79 {
80 #if _GLIBCXX_USE_C99_MATH
81 test_c99_classify<float>();
82 test_c99_classify<double>();
83 test_c99_classify<long double>();
84 test_c99_classify<float, double>();
85 test_c99_classify<float, long double>();
86 test_c99_classify<double, float>();
87 test_c99_classify<double, long double>();
88 test_c99_classify<long double, float>();
89 test_c99_classify<long double, double>();
90 #endif
91 return 0;
92 }