]> git.ipfire.org Git - thirdparty/glibc.git/blame - stdio-common/tst-printf.sh
Update copyright notices with scripts/update-copyrights
[thirdparty/glibc.git] / stdio-common / tst-printf.sh
CommitLineData
0755050e
UD
1#! /bin/sh
2# Testing of printf.
d4697bc9 3# Copyright (C) 2000-2014 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
27LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
740b3dbe 28${test_program_prefix} \
0755050e
UD
29 ${common_objpfx}stdio-common/tst-printf \
30 > ${common_objpfx}stdio-common/tst-printf.out || status=1
31
32cat <<'EOF' |
33%.4x: `0012'
34%04x: `0012'
35%4.4x: `0012'
36%04.4x: `0012'
37%4.3x: ` 012'
38%04.3x: ` 012'
39%.*x: `0012'
40%0*x: `0012'
41%*.*x: `0012'
42%0*.*x: `0012'
43bad format: "%b"
44nil pointer (padded): " (nil)"
45decimal negative: "-2345"
46octal negative: "37777773327"
47hex negative: "fffff6d7"
48long decimal number: "-123456"
49long octal negative: "37777773327"
50long unsigned decimal number: "4294843840"
51zero-padded LDN: "-000123456"
52left-adjusted ZLDN: "-123456 "
53space-padded LDN: " -123456"
54left-adjusted SLDN: "-123456 "
55zero-padded string: " Hi, Z."
56left-adjusted Z string: "Hi, Z. "
57space-padded string: " Hi, Z."
58left-adjusted S string: "Hi, Z. "
59null string: "(null)"
60limited string: "Good morning, Doctor C"
61e-style >= 1: "1.234000e+01"
62e-style >= .1: "1.234000e-01"
63e-style < .1: "1.234000e-03"
64e-style big: "1.000000000000000000000000000000000000000000000000000000000000e+20"
65e-style == .1: "1.000000e-01"
66f-style >= 1: "12.340000"
67f-style >= .1: "0.123400"
68f-style < .1: "0.001234"
69g-style >= 1: "12.34"
70g-style >= .1: "0.1234"
71g-style < .1: "0.001234"
72g-style big: "100000000000000000000"
73 0.10000
74 0.10000
75x0.5000x
760x1
77something really insane: 1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
785.87747175411143754e-39
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
95 4.94066e-324
96| 0.0000| 0.0000e+00| 0|
97| 1.0000| 1.0000e+00| 1|
98| -1.0000| -1.0000e+00| -1|
99| 100.0000| 1.0000e+02| 100|
100| 1000.0000| 1.0000e+03| 1000|
101| 10000.0000| 1.0000e+04| 1e+04|
102| 12345.0000| 1.2345e+04| 1.234e+04|
103| 100000.0000| 1.0000e+05| 1e+05|
104| 123456.0000| 1.2346e+05| 1.235e+05|
105snprintf ("%30s", "foo") == 30, " "
351f0765 106snprintf ("%.999999u", 10) == 999999
0755050e
UD
107
108Formatted output test
109prefix 6d 6o 6x 6X 6u
110%-+#0 |-123 |0377 |0xff |0XFF |4294967295 |
111 %-+# |-123 |0377 |0xff |0XFF |4294967295 |
112 %-+0 |-123 |377 |ff |FF |4294967295 |
113 %-+ |-123 |377 |ff |FF |4294967295 |
114 %-#0 |-123 |0377 |0xff |0XFF |4294967295 |
115 %-# |-123 |0377 |0xff |0XFF |4294967295 |
116 %-0 |-123 |377 |ff |FF |4294967295 |
117 %- |-123 |377 |ff |FF |4294967295 |
118 %+#0 |-00123 |000377 |0x00ff |0X00FF |4294967295 |
119 %+# | -123 | 0377 | 0xff | 0XFF |4294967295 |
120 %+0 |-00123 |000377 |0000ff |0000FF |4294967295 |
121 %+ | -123 | 377 | ff | FF |4294967295 |
122 %#0 |-00123 |000377 |0x00ff |0X00FF |4294967295 |
123 %# | -123 | 0377 | 0xff | 0XFF |4294967295 |
124 %0 |-00123 |000377 |0000ff |0000FF |4294967295 |
125 % | -123 | 377 | ff | FF |4294967295 |
126 (null)
127(null)
1281.234568e+06 should be 1.234568e+06
1291234567.800000 should be 1234567.800000
1301.23457e+06 should be 1.23457e+06
131123.456 should be 123.456
1321e+06 should be 1e+06
13310 should be 10
1340.02 should be 0.02
0755050e
UD
135Test ok.
136sprintf (buf, "%07Lo", 040000000000ll) = 40000000000
655de5fd
UD
137printf ("%hhu", 257) = 1
138printf ("%hu", 65537) = 1
fff04b32
UD
139printf ("%hhi", 257) = 1
140printf ("%hi", 65537) = 1
141printf ("%1$hhu", 257) = 1
142printf ("%1$hu", 65537) = 1
143printf ("%1$hhi", 257) = 1
144printf ("%1$hi", 65537) = 1
0755050e
UD
145--- Should be no further output. ---
146EOF
1746f2b0 147cmp - ${common_objpfx}stdio-common/tst-printf.out > /dev/null 2>&1 ||
2a82441b
UD
148cat <<'EOF' |
149%.4x: `0012'
150%04x: `0012'
151%4.4x: `0012'
152%04.4x: `0012'
153%4.3x: ` 012'
154%04.3x: ` 012'
155%.*x: `0012'
156%0*x: `0012'
157%*.*x: `0012'
158%0*.*x: `0012'
159bad format: "%b"
160nil pointer (padded): " (nil)"
161decimal negative: "-2345"
162octal negative: "37777773327"
163hex negative: "fffff6d7"
164long decimal number: "-123456"
165long octal negative: "1777777777777777773327"
166long unsigned decimal number: "18446744073709428160"
167zero-padded LDN: "-000123456"
168left-adjusted ZLDN: "-123456 "
169space-padded LDN: " -123456"
170left-adjusted SLDN: "-123456 "
171zero-padded string: " Hi, Z."
172left-adjusted Z string: "Hi, Z. "
173space-padded string: " Hi, Z."
174left-adjusted S string: "Hi, Z. "
175null string: "(null)"
176limited string: "Good morning, Doctor C"
177e-style >= 1: "1.234000e+01"
178e-style >= .1: "1.234000e-01"
179e-style < .1: "1.234000e-03"
180e-style big: "1.000000000000000000000000000000000000000000000000000000000000e+20"
181e-style == .1: "1.000000e-01"
182f-style >= 1: "12.340000"
183f-style >= .1: "0.123400"
184f-style < .1: "0.001234"
185g-style >= 1: "12.34"
186g-style >= .1: "0.1234"
187g-style < .1: "0.001234"
188g-style big: "100000000000000000000"
189 0.10000
190 0.10000
191x0.5000x
1920x1
193something really insane: 1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1945.87747175411143754e-39
1955.87747175411143754e-39
1965.87747175411143754e-39
1975.87747175411143754e-39
1985.87747175411143754e-39
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
211 4.94066e-324
212| 0.0000| 0.0000e+00| 0|
213| 1.0000| 1.0000e+00| 1|
214| -1.0000| -1.0000e+00| -1|
215| 100.0000| 1.0000e+02| 100|
216| 1000.0000| 1.0000e+03| 1000|
217| 10000.0000| 1.0000e+04| 1e+04|
218| 12345.0000| 1.2345e+04| 1.234e+04|
219| 100000.0000| 1.0000e+05| 1e+05|
220| 123456.0000| 1.2346e+05| 1.235e+05|
221snprintf ("%30s", "foo") == 30, " "
351f0765 222snprintf ("%.999999u", 10) == 999999
2a82441b
UD
223
224Formatted output test
225prefix 6d 6o 6x 6X 6u
226%-+#0 |-123 |0377 |0xff |0XFF |4294967295 |
227 %-+# |-123 |0377 |0xff |0XFF |4294967295 |
228 %-+0 |-123 |377 |ff |FF |4294967295 |
229 %-+ |-123 |377 |ff |FF |4294967295 |
230 %-#0 |-123 |0377 |0xff |0XFF |4294967295 |
231 %-# |-123 |0377 |0xff |0XFF |4294967295 |
232 %-0 |-123 |377 |ff |FF |4294967295 |
233 %- |-123 |377 |ff |FF |4294967295 |
234 %+#0 |-00123 |000377 |0x00ff |0X00FF |4294967295 |
235 %+# | -123 | 0377 | 0xff | 0XFF |4294967295 |
236 %+0 |-00123 |000377 |0000ff |0000FF |4294967295 |
237 %+ | -123 | 377 | ff | FF |4294967295 |
238 %#0 |-00123 |000377 |0x00ff |0X00FF |4294967295 |
239 %# | -123 | 0377 | 0xff | 0XFF |4294967295 |
240 %0 |-00123 |000377 |0000ff |0000FF |4294967295 |
241 % | -123 | 377 | ff | FF |4294967295 |
242 (null)
243(null)
2441.234568e+06 should be 1.234568e+06
2451234567.800000 should be 1234567.800000
2461.23457e+06 should be 1.23457e+06
247123.456 should be 123.456
2481e+06 should be 1e+06
24910 should be 10
2500.02 should be 0.02
2a82441b
UD
251Test ok.
252sprintf (buf, "%07Lo", 040000000000ll) = 40000000000
655de5fd
UD
253printf ("%hhu", 257) = 1
254printf ("%hu", 65537) = 1
d2dc7b08
UD
255printf ("%hhi", 257) = 1
256printf ("%hi", 65537) = 1
257printf ("%1$hhu", 257) = 1
258printf ("%1$hu", 65537) = 1
259printf ("%1$hhi", 257) = 1
260printf ("%1$hi", 65537) = 1
2a82441b
UD
261--- Should be no further output. ---
262EOF
1746f2b0 263cmp - ${common_objpfx}stdio-common/tst-printf.out > /dev/null 2>&1 ||
2a82441b
UD
264{
265 status=1
266 echo "*** output comparison failed"
267}
0755050e
UD
268
269exit $status