source: vendor/glibc-tests/glibc/stdio-common/tst-printf.sh

Last change on this file was 2036, checked in by bird, 20 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 27.4 KB
Line 
1#! /bin/sh
2# Testing of printf.
3# Copyright (C) 2000, 2002 Free Software Foundation, Inc.
4# This file is part of the GNU C Library.
5#
6
7# The GNU C Library is free software; you can redistribute it and/or
8# modify it under the terms of the GNU Lesser General Public
9# License as published by the Free Software Foundation; either
10# version 2.1 of the License, or (at your option) any later version.
11
12# The GNU C Library is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15# Lesser General Public License for more details.
16
17# You should have received a copy of the GNU Lesser General Public
18# License along with the GNU C Library; if not, write to the Free
19# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20# 02111-1307 USA.
21
22common_objpfx=$1; shift
23run_program_prefix=$1; shift
24
25status=0
26
27LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
28${run_program_prefix} \
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, " "
106snprintf ("%.999999u", 10) == 999999
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
135Test ok.
136sprintf (buf, "%07Lo", 040000000000ll) = 40000000000
137printf ("%hhu", 257) = 1
138printf ("%hu", 65537) = 1
139--- Should be no further output. ---
140EOF
141cmp - ${common_objpfx}stdio-common/tst-printf.out > /dev/null 2>&1 ||
142cat <<'EOF' |
143%.4x: `0012'
144%04x: `0012'
145%4.4x: `0012'
146%04.4x: `0012'
147%4.3x: ` 012'
148%04.3x: ` 012'
149%.*x: `0012'
150%0*x: `0012'
151%*.*x: `0012'
152%0*.*x: `0012'
153bad format: "%b"
154nil pointer (padded): " (nil)"
155decimal negative: "-2345"
156octal negative: "37777773327"
157hex negative: "fffff6d7"
158long decimal number: "-123456"
159long octal negative: "1777777777777777773327"
160long unsigned decimal number: "18446744073709428160"
161zero-padded LDN: "-000123456"
162left-adjusted ZLDN: "-123456 "
163space-padded LDN: " -123456"
164left-adjusted SLDN: "-123456 "
165zero-padded string: " Hi, Z."
166left-adjusted Z string: "Hi, Z. "
167space-padded string: " Hi, Z."
168left-adjusted S string: "Hi, Z. "
169null string: "(null)"
170limited string: "Good morning, Doctor C"
171e-style >= 1: "1.234000e+01"
172e-style >= .1: "1.234000e-01"
173e-style < .1: "1.234000e-03"
174e-style big: "1.000000000000000000000000000000000000000000000000000000000000e+20"
175e-style == .1: "1.000000e-01"
176f-style >= 1: "12.340000"
177f-style >= .1: "0.123400"
178f-style < .1: "0.001234"
179g-style >= 1: "12.34"
180g-style >= .1: "0.1234"
181g-style < .1: "0.001234"
182g-style big: "100000000000000000000"
183 0.10000
184 0.10000
185x0.5000x
1860x1
187something really insane: 1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1885.87747175411143754e-39
1895.87747175411143754e-39
1905.87747175411143754e-39
1915.87747175411143754e-39
1925.87747175411143754e-39
1935.87747175411143754e-39
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
205 4.94066e-324
206| 0.0000| 0.0000e+00| 0|
207| 1.0000| 1.0000e+00| 1|
208| -1.0000| -1.0000e+00| -1|
209| 100.0000| 1.0000e+02| 100|
210| 1000.0000| 1.0000e+03| 1000|
211| 10000.0000| 1.0000e+04| 1e+04|
212| 12345.0000| 1.2345e+04| 1.234e+04|
213| 100000.0000| 1.0000e+05| 1e+05|
214| 123456.0000| 1.2346e+05| 1.235e+05|
215snprintf ("%30s", "foo") == 30, " "
216snprintf ("%.999999u", 10) == 999999
217
218Formatted output test
219prefix 6d 6o 6x 6X 6u
220%-+#0 |-123 |0377 |0xff |0XFF |4294967295 |
221 %-+# |-123 |0377 |0xff |0XFF |4294967295 |
222 %-+0 |-123 |377 |ff |FF |4294967295 |
223 %-+ |-123 |377 |ff |FF |4294967295 |
224 %-#0 |-123 |0377 |0xff |0XFF |4294967295 |
225 %-# |-123 |0377 |0xff |0XFF |4294967295 |
226 %-0 |-123 |377 |ff |FF |4294967295 |
227 %- |-123 |377 |ff |FF |4294967295 |
228 %+#0 |-00123 |000377 |0x00ff |0X00FF |4294967295 |
229 %+# | -123 | 0377 | 0xff | 0XFF |4294967295 |
230 %+0 |-00123 |000377 |0000ff |0000FF |4294967295 |
231 %+ | -123 | 377 | ff | FF |4294967295 |
232 %#0 |-00123 |000377 |0x00ff |0X00FF |4294967295 |
233 %# | -123 | 0377 | 0xff | 0XFF |4294967295 |
234 %0 |-00123 |000377 |0000ff |0000FF |4294967295 |
235 % | -123 | 377 | ff | FF |4294967295 |
236 (null)
237(null)
2381.234568e+06 should be 1.234568e+06
2391234567.800000 should be 1234567.800000
2401.23457e+06 should be 1.23457e+06
241123.456 should be 123.456
2421e+06 should be 1e+06
24310 should be 10
2440.02 should be 0.02
245Test ok.
246sprintf (buf, "%07Lo", 040000000000ll) = 40000000000
247printf ("%hhu", 257) = 1
248printf ("%hu", 65537) = 1
249--- Should be no further output. ---
250EOF
251cmp - ${common_objpfx}stdio-common/tst-printf.out > /dev/null 2>&1 ||
252{
253 status=1
254 echo "*** output comparison failed"
255}
256
257exit $status
Note: See TracBrowser for help on using the repository browser.