Remove Linux kernel version ambiguity in comment added by previous commit.
[platform/upstream/glibc.git] / stdio-common / tst-printf.sh
1 #! /bin/sh
2 # Testing of printf.
3 # Copyright (C) 2000-2013 Free Software Foundation, Inc.
4 # This file is part of the GNU C Library.
5
6 # The GNU C Library is free software; you can redistribute it and/or
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
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
14 # Lesser General Public License for more details.
15
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with the GNU C Library; if not, see
18 # <http://www.gnu.org/licenses/>.
19
20 set -e
21
22 common_objpfx=$1; shift
23 test_program_prefix=$1; shift
24
25 status=0
26
27 LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
28 ${test_program_prefix} \
29   ${common_objpfx}stdio-common/tst-printf \
30   > ${common_objpfx}stdio-common/tst-printf.out || status=1
31
32 cat <<'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'
43 bad format:     "%b"
44 nil pointer (padded):   "     (nil)"
45 decimal negative:       "-2345"
46 octal negative: "37777773327"
47 hex negative:   "fffff6d7"
48 long decimal number:    "-123456"
49 long octal negative:    "37777773327"
50 long unsigned decimal number:   "4294843840"
51 zero-padded LDN:        "-000123456"
52 left-adjusted ZLDN:     "-123456   "
53 space-padded LDN:       "   -123456"
54 left-adjusted SLDN:     "-123456   "
55 zero-padded string:     "    Hi, Z."
56 left-adjusted Z string: "Hi, Z.    "
57 space-padded string:    "    Hi, Z."
58 left-adjusted S string: "Hi, Z.    "
59 null string:    "(null)"
60 limited string: "Good morning, Doctor C"
61 e-style >= 1:   "1.234000e+01"
62 e-style >= .1:  "1.234000e-01"
63 e-style < .1:   "1.234000e-03"
64 e-style big:    "1.000000000000000000000000000000000000000000000000000000000000e+20"
65 e-style == .1:  "1.000000e-01"
66 f-style >= 1:   "12.340000"
67 f-style >= .1:  "0.123400"
68 f-style < .1:   "0.001234"
69 g-style >= 1:   "12.34"
70 g-style >= .1:  "0.1234"
71 g-style < .1:   "0.001234"
72 g-style big:    "100000000000000000000"
73  0.10000
74  0.10000
75 x0.5000x
76 0x1
77 something really insane: 1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
78 5.87747175411143754e-39
79 5.87747175411143754e-39
80 5.87747175411143754e-39
81 5.87747175411143754e-39
82 5.87747175411143754e-39
83 5.87747175411143754e-39
84 5.87747175411143754e-39
85 5.87747175411143754e-39
86 5.87747175411143754e-39
87 5.87747175411143754e-39
88 5.87747175411143754e-39
89 5.87747175411143754e-39
90 5.87747175411143754e-39
91 5.87747175411143754e-39
92 5.87747175411143754e-39
93 5.87747175411143754e-39
94 5.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|
105 snprintf ("%30s", "foo") == 30, "                   "
106 snprintf ("%.999999u", 10) == 999999
107
108 Formatted output test
109 prefix  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)    
128 1.234568e+06 should be 1.234568e+06
129 1234567.800000 should be 1234567.800000
130 1.23457e+06 should be 1.23457e+06
131 123.456 should be 123.456
132 1e+06 should be 1e+06
133 10 should be 10
134 0.02 should be 0.02
135 Test ok.
136 sprintf (buf, "%07Lo", 040000000000ll) = 40000000000
137 printf ("%hhu", 257) = 1
138 printf ("%hu", 65537) = 1
139 printf ("%hhi", 257) = 1
140 printf ("%hi", 65537) = 1
141 printf ("%1$hhu", 257) = 1
142 printf ("%1$hu", 65537) = 1
143 printf ("%1$hhi", 257) = 1
144 printf ("%1$hi", 65537) = 1
145 --- Should be no further output. ---
146 EOF
147 cmp - ${common_objpfx}stdio-common/tst-printf.out > /dev/null 2>&1 ||
148 cat <<'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'
159 bad format:     "%b"
160 nil pointer (padded):   "     (nil)"
161 decimal negative:       "-2345"
162 octal negative: "37777773327"
163 hex negative:   "fffff6d7"
164 long decimal number:    "-123456"
165 long octal negative:    "1777777777777777773327"
166 long unsigned decimal number:   "18446744073709428160"
167 zero-padded LDN:        "-000123456"
168 left-adjusted ZLDN:     "-123456   "
169 space-padded LDN:       "   -123456"
170 left-adjusted SLDN:     "-123456   "
171 zero-padded string:     "    Hi, Z."
172 left-adjusted Z string: "Hi, Z.    "
173 space-padded string:    "    Hi, Z."
174 left-adjusted S string: "Hi, Z.    "
175 null string:    "(null)"
176 limited string: "Good morning, Doctor C"
177 e-style >= 1:   "1.234000e+01"
178 e-style >= .1:  "1.234000e-01"
179 e-style < .1:   "1.234000e-03"
180 e-style big:    "1.000000000000000000000000000000000000000000000000000000000000e+20"
181 e-style == .1:  "1.000000e-01"
182 f-style >= 1:   "12.340000"
183 f-style >= .1:  "0.123400"
184 f-style < .1:   "0.001234"
185 g-style >= 1:   "12.34"
186 g-style >= .1:  "0.1234"
187 g-style < .1:   "0.001234"
188 g-style big:    "100000000000000000000"
189  0.10000
190  0.10000
191 x0.5000x
192 0x1
193 something really insane: 1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
194 5.87747175411143754e-39
195 5.87747175411143754e-39
196 5.87747175411143754e-39
197 5.87747175411143754e-39
198 5.87747175411143754e-39
199 5.87747175411143754e-39
200 5.87747175411143754e-39
201 5.87747175411143754e-39
202 5.87747175411143754e-39
203 5.87747175411143754e-39
204 5.87747175411143754e-39
205 5.87747175411143754e-39
206 5.87747175411143754e-39
207 5.87747175411143754e-39
208 5.87747175411143754e-39
209 5.87747175411143754e-39
210 5.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|
221 snprintf ("%30s", "foo") == 30, "                   "
222 snprintf ("%.999999u", 10) == 999999
223
224 Formatted output test
225 prefix  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)    
244 1.234568e+06 should be 1.234568e+06
245 1234567.800000 should be 1234567.800000
246 1.23457e+06 should be 1.23457e+06
247 123.456 should be 123.456
248 1e+06 should be 1e+06
249 10 should be 10
250 0.02 should be 0.02
251 Test ok.
252 sprintf (buf, "%07Lo", 040000000000ll) = 40000000000
253 printf ("%hhu", 257) = 1
254 printf ("%hu", 65537) = 1
255 printf ("%hhi", 257) = 1
256 printf ("%hi", 65537) = 1
257 printf ("%1$hhu", 257) = 1
258 printf ("%1$hu", 65537) = 1
259 printf ("%1$hhi", 257) = 1
260 printf ("%1$hi", 65537) = 1
261 --- Should be no further output. ---
262 EOF
263 cmp - ${common_objpfx}stdio-common/tst-printf.out > /dev/null 2>&1 ||
264 {
265   status=1
266   echo "*** output comparison failed"
267 }
268
269 exit $status