]>
git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat-template.c
1 /* Test for the long double variants of *scanf functions.
2 Copyright (C) 2019-2020 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/>. */
25 #include <support/check.h>
28 va_start (args, format); \
29 ldptr = va_arg (args, long double *); \
30 fptr = va_arg (args, float *); \
36 va_start (args, format); \
37 ldptr = va_arg (args, long double *); \
38 fptr = va_arg (args, float *); \
40 if (*ldptr == -1 && *fptr == -2) \
43 printf ("ERROR (%Lf %f)", *ldptr, *fptr); \
51 if (ld == -1 && f == -2) \
54 printf ("ERROR (%Lf %f)", ld, f); \
58 do_test_call (FILE *stream
, CHAR
*string
, const CHAR
*format
, ...)
68 FSCANF (stream
, format
, &ld
, &f
);
73 SCANF (format
, &ld
, &f
);
78 SSCANF (string
, format
, &ld
, &f
);
83 va_start (args
, format
);
84 VFSCANF (stream
, format
, args
);
90 va_start (args
, format
);
91 VSCANF (format
, args
);
97 va_start (args
, format
);
98 VSSCANF (string
, format
, args
);
110 /* Scan in decimal notation. */
114 do_test_call (stdin
, string
, L("%Lf %f"), &ld
, &f
);
116 /* Scan in hexadecimal notation. */
118 L ("-0x1.0p+0 -0x2.0p+0\n")
119 L ("-0x1.0p+0 -0x2.0p+0\n") );
120 /* For ISO C99, scan the single-precision value with "%as" to test
121 that __isoc99_*scanf ignores the 's'. For DEPRECATED_SCANF, do not
122 use "%as", because that would try to scan a string and allocate
124 #if __GLIBC_USE (DEPRECATED_SCANF)
125 # define FMT "%La %a"
127 # define FMT "%La %as"
129 do_test_call (stdin
, string
, L(FMT
), &ld
, &f
);
134 #include <support/test-driver.c>