]> git.ipfire.org Git - thirdparty/glibc.git/blame - stdio-common/tst-printf.sh
Deprecate external use of libio.h and _G_config.h.
[thirdparty/glibc.git] / stdio-common / tst-printf.sh
CommitLineData
48d0341c 1#!/bin/sh
0755050e 2# Testing of printf.
bfff8b1b 3# Copyright (C) 2000-2017 Free Software Foundation, Inc.
0755050e 4# This file is part of the GNU C Library.
41bdb6e2 5
0755050e 6# The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
7# modify it under the terms of the GNU Lesser General Public
8# License as published by the Free Software Foundation; either
9# version 2.1 of the License, or (at your option) any later version.
10
0755050e
UD
11# The GNU C Library is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2
AJ
14# Lesser General Public License for more details.
15
16# You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
17# License along with the GNU C Library; if not, see
18# <http://www.gnu.org/licenses/>.
0755050e 19
57c69bef
DL
20set -e
21
0755050e 22common_objpfx=$1; shift
740b3dbe 23test_program_prefix=$1; shift
0755050e
UD
24
25status=0
26
740b3dbe 27${test_program_prefix} \
0755050e
UD
28 ${common_objpfx}stdio-common/tst-printf \
29 > ${common_objpfx}stdio-common/tst-printf.out || status=1
30
31cat <<'EOF' |
32%.4x: `0012'
33%04x: `0012'
34%4.4x: `0012'
35%04.4x: `0012'
36%4.3x: ` 012'
37%04.3x: ` 012'
38%.*x: `0012'
39%0*x: `0012'
40%*.*x: `0012'
41%0*.*x: `0012'
42bad format: "%b"
43nil pointer (padded): " (nil)"
44decimal negative: "-2345"
45octal negative: "37777773327"
46hex negative: "fffff6d7"
47long decimal number: "-123456"
48long octal negative: "37777773327"
49long unsigned decimal number: "4294843840"
50zero-padded LDN: "-000123456"
51left-adjusted ZLDN: "-123456 "
52space-padded LDN: " -123456"
53left-adjusted SLDN: "-123456 "
54zero-padded string: " Hi, Z."
55left-adjusted Z string: "Hi, Z. "
56space-padded string: " Hi, Z."
57left-adjusted S string: "Hi, Z. "
58null string: "(null)"
59limited string: "Good morning, Doctor C"
179dcdb7
TMQMF
60a-style max: "0x1.fffffffffffffp+1023"
61a-style -max: "-0x1.fffffffffffffp+1023"
0755050e
UD
62e-style >= 1: "1.234000e+01"
63e-style >= .1: "1.234000e-01"
64e-style < .1: "1.234000e-03"
65e-style big: "1.000000000000000000000000000000000000000000000000000000000000e+20"
66e-style == .1: "1.000000e-01"
67f-style >= 1: "12.340000"
68f-style >= .1: "0.123400"
69f-style < .1: "0.001234"
70g-style >= 1: "12.34"
71g-style >= .1: "0.1234"
72g-style < .1: "0.001234"
73g-style big: "100000000000000000000"
74 0.10000
75 0.10000
76x0.5000x
770x1
78something really insane: 1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
795.87747175411143754e-39
805.87747175411143754e-39
815.87747175411143754e-39
825.87747175411143754e-39
835.87747175411143754e-39
845.87747175411143754e-39
855.87747175411143754e-39
865.87747175411143754e-39
875.87747175411143754e-39
885.87747175411143754e-39
895.87747175411143754e-39
905.87747175411143754e-39
915.87747175411143754e-39
925.87747175411143754e-39
935.87747175411143754e-39
945.87747175411143754e-39
955.87747175411143754e-39
96 4.94066e-324
97| 0.0000| 0.0000e+00| 0|
98| 1.0000| 1.0000e+00| 1|
99| -1.0000| -1.0000e+00| -1|
100| 100.0000| 1.0000e+02| 100|
101| 1000.0000| 1.0000e+03| 1000|
102| 10000.0000| 1.0000e+04| 1e+04|
103| 12345.0000| 1.2345e+04| 1.234e+04|
104| 100000.0000| 1.0000e+05| 1e+05|
105| 123456.0000| 1.2346e+05| 1.235e+05|
106snprintf ("%30s", "foo") == 30, " "
351f0765 107snprintf ("%.999999u", 10) == 999999
0755050e
UD
108
109Formatted output test
110prefix 6d 6o 6x 6X 6u
111%-+#0 |-123 |0377 |0xff |0XFF |4294967295 |
112 %-+# |-123 |0377 |0xff |0XFF |4294967295 |
113 %-+0 |-123 |377 |ff |FF |4294967295 |
114 %-+ |-123 |377 |ff |FF |4294967295 |
115 %-#0 |-123 |0377 |0xff |0XFF |4294967295 |
116 %-# |-123 |0377 |0xff |0XFF |4294967295 |
117 %-0 |-123 |377 |ff |FF |4294967295 |
118 %- |-123 |377 |ff |FF |4294967295 |
119 %+#0 |-00123 |000377 |0x00ff |0X00FF |4294967295 |
120 %+# | -123 | 0377 | 0xff | 0XFF |4294967295 |
121 %+0 |-00123 |000377 |0000ff |0000FF |4294967295 |
122 %+ | -123 | 377 | ff | FF |4294967295 |
123 %#0 |-00123 |000377 |0x00ff |0X00FF |4294967295 |
124 %# | -123 | 0377 | 0xff | 0XFF |4294967295 |
125 %0 |-00123 |000377 |0000ff |0000FF |4294967295 |
126 % | -123 | 377 | ff | FF |4294967295 |
127 (null)
128(null)
179dcdb7
TMQMF
129179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.00000000
130-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.00000000
0755050e
UD
1311.234568e+06 should be 1.234568e+06
1321234567.800000 should be 1234567.800000
1331.23457e+06 should be 1.23457e+06
134123.456 should be 123.456
1351e+06 should be 1e+06
13610 should be 10
1370.02 should be 0.02
0755050e
UD
138Test ok.
139sprintf (buf, "%07Lo", 040000000000ll) = 40000000000
655de5fd
UD
140printf ("%hhu", 257) = 1
141printf ("%hu", 65537) = 1
fff04b32
UD
142printf ("%hhi", 257) = 1
143printf ("%hi", 65537) = 1
144printf ("%1$hhu", 257) = 1
145printf ("%1$hu", 65537) = 1
146printf ("%1$hhi", 257) = 1
147printf ("%1$hi", 65537) = 1
0755050e
UD
148--- Should be no further output. ---
149EOF
1746f2b0 150cmp - ${common_objpfx}stdio-common/tst-printf.out > /dev/null 2>&1 ||
2a82441b
UD
151cat <<'EOF' |
152%.4x: `0012'
153%04x: `0012'
154%4.4x: `0012'
155%04.4x: `0012'
156%4.3x: ` 012'
157%04.3x: ` 012'
158%.*x: `0012'
159%0*x: `0012'
160%*.*x: `0012'
161%0*.*x: `0012'
162bad format: "%b"
163nil pointer (padded): " (nil)"
164decimal negative: "-2345"
165octal negative: "37777773327"
166hex negative: "fffff6d7"
167long decimal number: "-123456"
168long octal negative: "1777777777777777773327"
169long unsigned decimal number: "18446744073709428160"
170zero-padded LDN: "-000123456"
171left-adjusted ZLDN: "-123456 "
172space-padded LDN: " -123456"
173left-adjusted SLDN: "-123456 "
174zero-padded string: " Hi, Z."
175left-adjusted Z string: "Hi, Z. "
176space-padded string: " Hi, Z."
177left-adjusted S string: "Hi, Z. "
178null string: "(null)"
179limited string: "Good morning, Doctor C"
179dcdb7
TMQMF
180a-style max: "0x1.fffffffffffffp+1023"
181a-style -max: "-0x1.fffffffffffffp+1023"
2a82441b
UD
182e-style >= 1: "1.234000e+01"
183e-style >= .1: "1.234000e-01"
184e-style < .1: "1.234000e-03"
185e-style big: "1.000000000000000000000000000000000000000000000000000000000000e+20"
186e-style == .1: "1.000000e-01"
187f-style >= 1: "12.340000"
188f-style >= .1: "0.123400"
189f-style < .1: "0.001234"
190g-style >= 1: "12.34"
191g-style >= .1: "0.1234"
192g-style < .1: "0.001234"
193g-style big: "100000000000000000000"
194 0.10000
195 0.10000
196x0.5000x
1970x1
198something really insane: 1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1995.87747175411143754e-39
2005.87747175411143754e-39
2015.87747175411143754e-39
2025.87747175411143754e-39
2035.87747175411143754e-39
2045.87747175411143754e-39
2055.87747175411143754e-39
2065.87747175411143754e-39
2075.87747175411143754e-39
2085.87747175411143754e-39
2095.87747175411143754e-39
2105.87747175411143754e-39
2115.87747175411143754e-39
2125.87747175411143754e-39
2135.87747175411143754e-39
2145.87747175411143754e-39
2155.87747175411143754e-39
216 4.94066e-324
217| 0.0000| 0.0000e+00| 0|
218| 1.0000| 1.0000e+00| 1|
219| -1.0000| -1.0000e+00| -1|
220| 100.0000| 1.0000e+02| 100|
221| 1000.0000| 1.0000e+03| 1000|
222| 10000.0000| 1.0000e+04| 1e+04|
223| 12345.0000| 1.2345e+04| 1.234e+04|
224| 100000.0000| 1.0000e+05| 1e+05|
225| 123456.0000| 1.2346e+05| 1.235e+05|
226snprintf ("%30s", "foo") == 30, " "
351f0765 227snprintf ("%.999999u", 10) == 999999
2a82441b
UD
228
229Formatted output test
230prefix 6d 6o 6x 6X 6u
231%-+#0 |-123 |0377 |0xff |0XFF |4294967295 |
232 %-+# |-123 |0377 |0xff |0XFF |4294967295 |
233 %-+0 |-123 |377 |ff |FF |4294967295 |
234 %-+ |-123 |377 |ff |FF |4294967295 |
235 %-#0 |-123 |0377 |0xff |0XFF |4294967295 |
236 %-# |-123 |0377 |0xff |0XFF |4294967295 |
237 %-0 |-123 |377 |ff |FF |4294967295 |
238 %- |-123 |377 |ff |FF |4294967295 |
239 %+#0 |-00123 |000377 |0x00ff |0X00FF |4294967295 |
240 %+# | -123 | 0377 | 0xff | 0XFF |4294967295 |
241 %+0 |-00123 |000377 |0000ff |0000FF |4294967295 |
242 %+ | -123 | 377 | ff | FF |4294967295 |
243 %#0 |-00123 |000377 |0x00ff |0X00FF |4294967295 |
244 %# | -123 | 0377 | 0xff | 0XFF |4294967295 |
245 %0 |-00123 |000377 |0000ff |0000FF |4294967295 |
246 % | -123 | 377 | ff | FF |4294967295 |
247 (null)
248(null)
179dcdb7
TMQMF
249179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.00000000
250-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.00000000
2a82441b
UD
2511.234568e+06 should be 1.234568e+06
2521234567.800000 should be 1234567.800000
2531.23457e+06 should be 1.23457e+06
254123.456 should be 123.456
2551e+06 should be 1e+06
25610 should be 10
2570.02 should be 0.02
2a82441b
UD
258Test ok.
259sprintf (buf, "%07Lo", 040000000000ll) = 40000000000
655de5fd
UD
260printf ("%hhu", 257) = 1
261printf ("%hu", 65537) = 1
d2dc7b08
UD
262printf ("%hhi", 257) = 1
263printf ("%hi", 65537) = 1
264printf ("%1$hhu", 257) = 1
265printf ("%1$hu", 65537) = 1
266printf ("%1$hhi", 257) = 1
267printf ("%1$hi", 65537) = 1
2a82441b
UD
268--- Should be no further output. ---
269EOF
1746f2b0 270cmp - ${common_objpfx}stdio-common/tst-printf.out > /dev/null 2>&1 ||
2a82441b
UD
271{
272 status=1
273 echo "*** output comparison failed"
274}
0755050e
UD
275
276exit $status