Enable exception handling for genops, wgenops, fileops, and wfileops.
[glibc.git] / stdio-common / tst-printf.sh
blobdbf15d436cb5d1369bce1e8bf14957615e12b33c
1 #! /bin/sh
2 # Testing of printf.
3 # Copyright (C) 2000 Free Software Foundation, Inc.
4 # This file is part of the GNU C Library.
6 # The GNU C Library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Library General Public License as
8 # published by the Free Software Foundation; either version 2 of the
9 # License, or (at your option) any later version.
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 # Library General Public License for more details.
16 # You should have received a copy of the GNU Library General Public
17 # License along with the GNU C Library; see the file COPYING.LIB. If
18 # not, write to the Free Software Foundation, Inc.,
19 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 common_objpfx=$1; shift
22 run_program_prefix=$1; shift
24 status=0
26 LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
27 ${run_program_prefix} \
28 ${common_objpfx}stdio-common/tst-printf \
29 > ${common_objpfx}stdio-common/tst-printf.out || status=1
31 cat <<'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'
42 bad format: "%b"
43 nil pointer (padded): " (nil)"
44 decimal negative: "-2345"
45 octal negative: "37777773327"
46 hex negative: "fffff6d7"
47 long decimal number: "-123456"
48 long octal negative: "37777773327"
49 long unsigned decimal number: "4294843840"
50 zero-padded LDN: "-000123456"
51 left-adjusted ZLDN: "-123456 "
52 space-padded LDN: " -123456"
53 left-adjusted SLDN: "-123456 "
54 zero-padded string: " Hi, Z."
55 left-adjusted Z string: "Hi, Z. "
56 space-padded string: " Hi, Z."
57 left-adjusted S string: "Hi, Z. "
58 null string: "(null)"
59 limited string: "Good morning, Doctor C"
60 e-style >= 1: "1.234000e+01"
61 e-style >= .1: "1.234000e-01"
62 e-style < .1: "1.234000e-03"
63 e-style big: "1.000000000000000000000000000000000000000000000000000000000000e+20"
64 e-style == .1: "1.000000e-01"
65 f-style >= 1: "12.340000"
66 f-style >= .1: "0.123400"
67 f-style < .1: "0.001234"
68 g-style >= 1: "12.34"
69 g-style >= .1: "0.1234"
70 g-style < .1: "0.001234"
71 g-style big: "100000000000000000000"
72 0.10000
73 0.10000
74 x0.5000x
75 0x1
76 something really insane: 1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
77 5.87747175411143754e-39
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 4.94066e-324
95 | 0.0000| 0.0000e+00| 0|
96 | 1.0000| 1.0000e+00| 1|
97 | -1.0000| -1.0000e+00| -1|
98 | 100.0000| 1.0000e+02| 100|
99 | 1000.0000| 1.0000e+03| 1000|
100 | 10000.0000| 1.0000e+04| 1e+04|
101 | 12345.0000| 1.2345e+04| 1.234e+04|
102 | 100000.0000| 1.0000e+05| 1e+05|
103 | 123456.0000| 1.2346e+05| 1.235e+05|
104 snprintf ("%30s", "foo") == 30, " "
105 snprintf ("%.999999u", 10)
107 Formatted output test
108 prefix 6d 6o 6x 6X 6u
109 %-+#0 |-123 |0377 |0xff |0XFF |4294967295 |
110 %-+# |-123 |0377 |0xff |0XFF |4294967295 |
111 %-+0 |-123 |377 |ff |FF |4294967295 |
112 %-+ |-123 |377 |ff |FF |4294967295 |
113 %-#0 |-123 |0377 |0xff |0XFF |4294967295 |
114 %-# |-123 |0377 |0xff |0XFF |4294967295 |
115 %-0 |-123 |377 |ff |FF |4294967295 |
116 %- |-123 |377 |ff |FF |4294967295 |
117 %+#0 |-00123 |000377 |0x00ff |0X00FF |4294967295 |
118 %+# | -123 | 0377 | 0xff | 0XFF |4294967295 |
119 %+0 |-00123 |000377 |0000ff |0000FF |4294967295 |
120 %+ | -123 | 377 | ff | FF |4294967295 |
121 %#0 |-00123 |000377 |0x00ff |0X00FF |4294967295 |
122 %# | -123 | 0377 | 0xff | 0XFF |4294967295 |
123 %0 |-00123 |000377 |0000ff |0000FF |4294967295 |
124 % | -123 | 377 | ff | FF |4294967295 |
125 (null)
126 (null)
127 1.234568e+06 should be 1.234568e+06
128 1234567.800000 should be 1234567.800000
129 1.23457e+06 should be 1.23457e+06
130 123.456 should be 123.456
131 1e+06 should be 1e+06
132 10 should be 10
133 0.02 should be 0.02
134 0.10000000000000009
135 Test ok.
136 sprintf (buf, "%07Lo", 040000000000ll) = 40000000000
137 --- Should be no further output. ---
139 cmp - ${common_objpfx}stdio-common/tst-printf.out || status=1
141 exit $status