1 | /* Test for bug 19439. |
2 | Copyright (C) 2016-2022 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. |
4 | |
5 | The GNU C Library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License as published by the Free Software Foundation; either |
8 | version 2.1 of the License, or (at your option) any later version. |
9 | |
10 | The GNU C Library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Lesser General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU Lesser General Public |
16 | License along with the GNU C Library; if not, see |
17 | <https://www.gnu.org/licenses/>. */ |
18 | |
19 | #define _GNU_SOURCE 1 |
20 | #include <math.h> |
21 | #include <stdio.h> |
22 | #include <stdlib.h> |
23 | |
24 | static int |
25 | do_test (void) |
26 | { |
27 | /* Verify that isinff, isinfl, isnanf, and isnanlf are defined |
28 | in the header under C++11 and can be called. Without the |
29 | header fix this test will not compile. */ |
30 | if (isinff (value: 1.0f) |
31 | || !isinff (INFINITY) |
32 | || isinfl (value: 1.0L) |
33 | || !isinfl (INFINITY) |
34 | || isnanf (value: 2.0f) |
35 | || !isnanf (NAN) |
36 | || isnanl (value: 2.0L) |
37 | || !isnanl (NAN) |
38 | ) |
39 | { |
40 | printf (format: "FAIL: Failed to call is* functions.\n" ); |
41 | exit (status: 1); |
42 | } |
43 | printf (format: "PASS: Able to call isinff, isinfl, isnanf, and isnanl.\n" ); |
44 | exit (status: 0); |
45 | } |
46 | |
47 | #define TEST_FUNCTION do_test () |
48 | #include "../test-skeleton.c" |
49 | |