]>
Commit | Line | Data |
---|---|---|
a53b7a4e | 1 | /* This file is part of the GNU C Library. |
04277e02 | 2 | Copyright (C) 2012-2019 Free Software Foundation, Inc. |
a53b7a4e MP |
3 | Contributed by Marek Polacek <polacek@redhat.com>, 2012. |
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 | |
5a82c748 | 17 | <https://www.gnu.org/licenses/>. */ |
a53b7a4e | 18 | |
d10b132b | 19 | #include <array_length.h> |
a53b7a4e MP |
20 | #include <wchar.h> |
21 | ||
22 | /* Prototype for our test function. */ | |
23 | static int do_test (void); | |
24 | ||
25 | static int | |
26 | do_test (void) | |
27 | { | |
70bca0a3 MP |
28 | #ifndef NO_LONG_DOUBLE |
29 | int result = 0; | |
a53b7a4e | 30 | const long double x = 24.5; |
70bca0a3 | 31 | wchar_t a[16]; |
d10b132b | 32 | swprintf (a, array_length (a), L"%La\n", x); |
70bca0a3 | 33 | wchar_t A[16]; |
d10b132b | 34 | swprintf (A, array_length (a), L"%LA\n", x); |
70bca0a3 MP |
35 | |
36 | /* Here wprintf can return four valid variants. We must accept all | |
37 | of them. */ | |
38 | result |= (wmemcmp (a, L"0xc.4p+1", 8) == 0 | |
39 | && wmemcmp (A, L"0XC.4P+1", 8) == 0); | |
40 | result |= (wmemcmp (a, L"0x3.1p+3", 8) == 0 | |
41 | && wmemcmp (A, L"0X3.1P+3", 8) == 0); | |
42 | result |= (wmemcmp (a, L"0x6.2p+2", 8) == 0 | |
43 | && wmemcmp (A, L"0X6.2P+2", 8) == 0); | |
44 | result |= (wmemcmp (a, L"0x1.88p+4", 8) == 0 | |
45 | && wmemcmp (A, L"0X1.88P+4", 8) == 0); | |
46 | ||
47 | return result != 1; | |
48 | #else | |
49 | return 0; | |
50 | #endif | |
a53b7a4e MP |
51 | } |
52 | ||
53 | #define TEST_FUNCTION do_test () | |
54 | #include "../test-skeleton.c" |