1 /* Test strtod functions handle signs of NaNs (bug 23007).
2 Copyright (C) 2018-2022 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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/>. */
23 #include <stdlib/tst-strtod.h>
24 #include <support/check.h>
26 #define CONCAT_(X, Y) X ## Y
27 #define CONCAT(X, Y) CONCAT_ (X, Y)
28 #define FNX(FN) CONCAT (FNPFX, FN)
30 #define TEST_STRTOD(FSUF, FTYPE, FTOSTR, LSUF, CSUF) \
32 test_strto ## FSUF (void) \
34 FTYPE val_pos = FNX (FSUF) (L_("nan"), NULL); \
35 FTYPE copy_pos = copysign ## CSUF (1, val_pos); \
36 TEST_VERIFY (isnan (val_pos) && copy_pos == 1); \
37 FTYPE val_neg = FNX (FSUF) (L_("-nan"), NULL); \
38 FTYPE copy_neg = copysign ## CSUF (1, val_neg); \
39 TEST_VERIFY (isnan (val_neg) && copy_neg == -1); \
42 GEN_TEST_STRTOD_FOREACH (TEST_STRTOD
)
47 return STRTOD_TEST_FOREACH (test_strto
);
50 #include <support/test-driver.c>