1 # template data expected description (optional)
2 %6. 6s '' %6. 6s INVALID (See use of $w in code above)
3 %6 .6s '' %6 .6s INVALID
4 %6.6 s '' %6.6 s INVALID
8 %D 0x7fffffff 2147483647 Synonym for %ld
9 %E 123456.789 1.234568E+05 Like %e, but using upper-case "E"
10 %F 123456.789 123456.789000 Synonym for %f
11 %G 1234567.89 1.23457E+06 Like %g, but using upper-case "E"
12 %G 1234567e96 1.23457E+102
13 %G .1234567e-101 1.23457E-102
15 %G 1234567e96 1.23457E+102 exponent too big skip: os390
16 %G .1234567e-101 1.23457E-102 exponent too small skip: os390
24 %O 2**32-1 37777777777 Synonym for %lo
30 %U 2**32-1 4294967295 Synonym for %lu
33 %X 2**32-1 FFFFFFFF Like %x, but with u/c letters
34 %#X 2**32-1 0XFFFFFFFF
38 %b 2**32-1 11111111111111111111111111111111
39 %+b 2**32-1 11111111111111111111111111111111
40 %#b 2**32-1 0b11111111111111111111111111111111
41 %34b 2**32-1 11111111111111111111111111111111
42 %034b 2**32-1 0011111111111111111111111111111111
43 %-34b 2**32-1 11111111111111111111111111111111
44 %-034b 2**32-1 11111111111111111111111111111111
47 %#10c 65 A # modifier: no effect
49 %10lc 65 A l modifier: no effect
50 %10hc 65 A h modifier: no effect
51 %10.5c 65 A precision: no effect
54 %d -123456.789 -123456
63 %#3.2d 1 01 # modifier: no effect
67 %-03.2d 1 01 zero pad + left just.: no effect
70 %hd 1 1 More extensive testing of
71 %ld 1 1 length modifiers would be
72 %Vd 1 1 platform-specific
78 %vd [version::qv("1.2.3")] 1.2.3
79 %vd [version->new("1.2")] 1.200
80 %vd [version->new("1.02")] 1.20
81 %vd [version->new("1.002")] 1.2
82 %vd [version->new("1048576.5")] 1048576.500
83 %vd [version->new("50")] 50.0
84 %v.3d "\01\02\03" 001.002.003
85 %0v3d "\01\02\03" 001.002.003
86 %v.3d [version::qv("1.2.3")] 001.002.003
87 %-v3d "\01\02\03" 1 .2 .3
88 %+-v3d "\01\02\03" +1 .2 .3
89 %+-v3d [version::qv("1.2.3")] +1 .2 .3
90 %v4.3d "\01\02\03" 001. 002. 003
91 %0v4.3d "\01\02\03" 0001.0002.0003
92 %0*v2d ['-', "\0\7\14"] 00-07-12
93 %v.*d ["\01\02\03", 3] 001.002.003
94 %0v*d ["\01\02\03", 3] 001.002.003
95 %-v*d ["\01\02\03", 3] 1 .2 .3
96 %+-v*d ["\01\02\03", 3] +1 .2 .3
97 %v*.*d ["\01\02\03", 4, 3] 001. 002. 003
98 %0v*.*d ["\01\02\03", 4, 3] 0001.0002.0003
99 %0*v*d ['-', "\0\7\13", 2] 00-07-11
100 %0*v*d ['-', version::qv("0.7.11"), 2] 00-07-11
101 %e 1234.875 1.234875e+03
102 %e 0.000012345 1.234500e-05
103 %e 1234567E96 1.234567e+102
105 %e .1234567E-101 1.234567e-102
106 %+e 1234.875 +1.234875e+03
107 %#e 1234.875 1.234875e+03
108 %e -1234.875 -1.234875e+03
109 %+e -1234.875 -1.234875e+03
110 %#e -1234.875 -1.234875e+03
112 %#.0e 1234.875 1.e+03
115 %.*e [0, 1234.875] 1e+03
116 %.1e 1234.875 1.2e+03
117 %-12.4e 1234.875 1.2349e+03
118 %12.4e 1234.875 1.2349e+03
119 %+-12.4e 1234.875 +1.2349e+03
120 %+12.4e 1234.875 +1.2349e+03
121 %+-12.4e -1234.875 -1.2349e+03
122 %+12.4e -1234.875 -1.2349e+03
123 %e 1234567E96 1.234567e+102 exponent too big skip: os390
124 %e .1234567E-101 1.234567e-102 exponent too small skip: os390
125 %f 1234.875 1234.875000
126 %+f 1234.875 +1234.875000
127 %#f 1234.875 1234.875000
128 %f -1234.875 -1234.875000
129 %+f -1234.875 -1234.875000
130 %#f -1234.875 -1234.875000
131 %6f 1234.875 1234.875000
132 %*f [6, 1234.875] 1234.875000
133 %.0f -0.1 -0 C library bug: no minus skip: VMS
136 %-8.1f 1234.875 1234.9
137 %8.1f 1234.875 1234.9
138 %+-8.1f 1234.875 +1234.9
139 %+8.1f 1234.875 +1234.9
140 %+-8.1f -1234.875 -1234.9
141 %+8.1f -1234.875 -1234.9
142 %*.*f [5, 2, 12.3456] 12.35
145 %.0f 2**38 274877906944 Should have exact int'l rep'n
147 %.0f 0.6 1 Known to fail with sfio, (irix|nonstop-ux|powerux); -DHAS_LDBL_SPRINTF_BUG may fix
148 %.0f -0.6 -1 Known to fail with sfio, (irix|nonstop-ux|powerux); -DHAS_LDBL_SPRINTF_BUG may fix
153 %.0lf 1 1 'l' should have no effect
154 %.0hf 1 %.0hf INVALID 'h' should be rejected
155 %g 12345.6789 12345.7
156 %+g 12345.6789 +12345.7
157 %#g 12345.6789 12345.7
158 %.0g -0.0 -0 C99 standard mandates minus sign but C89 does not skip: MSWin32 VMS hpux:10.20 openbsd netbsd:1.5 irix
159 %.0g 12345.6789 1e+04
160 %#.0g 12345.6789 1.e+04
161 %.2g 12345.6789 1.2e+04
162 %.*g [2, 12345.6789] 1.2e+04
163 %.9g 12345.6789 12345.6789
164 %12.9g 12345.6789 12345.6789
165 %012.9g 12345.6789 0012345.6789
166 %-12.9g 12345.6789 12345.6789
167 %*.*g [-12, 9, 12345.6789] 12345.6789
168 %-012.9g 12345.6789 12345.6789
169 %g -12345.6789 -12345.7
170 %+g -12345.6789 -12345.7
171 %g 1234567.89 1.23457e+06
172 %+g 1234567.89 +1.23457e+06
173 %#g 1234567.89 1.23457e+06
174 %g -1234567.89 -1.23457e+06
175 %+g -1234567.89 -1.23457e+06
176 %#g -1234567.89 -1.23457e+06
177 %g 0.00012345 0.00012345
178 %g 0.000012345 1.2345e-05
179 %g 1234567E96 1.23457e+102
180 %g .1234567E-101 1.23457e-102
182 %13g 1234567.89 1.23457e+06
183 %+13g 1234567.89 +1.23457e+06
184 %013g 1234567.89 001.23457e+06
185 %-13g 1234567.89 1.23457e+06
186 %g .1234567E-101 1.23457e-102 exponent too small skip: os390
187 %g 1234567E96 1.23457e+102 exponent too big skip: os390
189 %i 123456.789 123456 Synonym for %d
194 %s sprintf('%%n%n %d', $n, $n) %n 2 Slight sneakiness to test %n
195 %o 2**32-1 37777777777
196 %+o 2**32-1 37777777777
197 %#o 2**32-1 037777777777
198 %o 642 1202 check smaller octals across platforms
201 %d $p=sprintf('%p',$p);$p=~/^[0-9a-f]+$/ 1 Coarse hack: hex from %p?
202 %d $p=sprintf('%-8p',$p);$p=~/^[0-9a-f]+\s*$/ 1 Coarse hack: hex from %p?
208 %+10s 'string' string
209 %#10s 'string' string
210 %010s 'string' 0000string
211 %0*s [10, 'string'] 0000string
212 %-10s 'string' string
215 %.*s [3, 'string'] str
217 %u 2**32-1 4294967295
218 %+u 2**32-1 4294967295
219 %#u 2**32-1 4294967295
220 %12u 2**32-1 4294967295
221 %012u 2**32-1 004294967295
222 %-12u 2**32-1 4294967295
223 %-012u 2**32-1 4294967295
228 %#x 2**32-1 0xffffffff
229 %10x 2**32-1 ffffffff
230 %010x 2**32-1 00ffffffff
231 %-10x 2**32-1 ffffffff
232 %-010x 2**32-1 ffffffff
233 %0-10x 2**32-1 ffffffff
234 %0*x [-10, ,2**32-1] ffffffff
235 %vx [version::qv("1.2.3")] 1.2.3
236 %vx [version::qv("1.20.300")] 1.14.12c
239 %2$d %1$d [12, 34] 34 12
241 %2$d %d [12, 34] 34 12
242 %2$d %d %d [12, 34] 34 12 34
243 %3$d %d %d [12, 34, 56] 56 12 34
244 %2$*3$d %d [12, 34, 3] 34 12
245 %*3$2$d %d [12, 34, 3] %*3$2$d 12 INVALID
248 %1$$d 12 %1$$d INVALID
249 %1$1$d 12 %1$1$d INVALID
250 %*2$*2$d [12, 3] %*2$*2$d INVALID
251 %*2*2$d [12, 3] %*2*2$d INVALID
252 %*2$1d [12, 3] %*2$1d INVALID
254 %vc,%d [63, 64, 65] %vc,63 INVALID
255 %v%,%d [63, 64, 65] %v%,63 INVALID
256 %vd,%d ["\x1", 2, 3] 1,2
257 %vf,%d [1, 2, 3] %vf,1 INVALID
258 %vF,%d [1, 2, 3] %vF,1 INVALID
259 %ve,%d [1, 2, 3] %ve,1 INVALID
260 %vE,%d [1, 2, 3] %vE,1 INVALID
261 %vg,%d [1, 2, 3] %vg,1 INVALID
262 %vG,%d [1, 2, 3] %vG,1 INVALID
265 %vs,%d [1, 2, 3] %vs,1 INVALID
268 %v02x "\x66\x6f\x6f\012" 66.6f.6f.0a
269 %#v.8b "\141\000\142" 0b01100001.00000000.0b01100010 perl #39530
270 %#v.4o "\141\000\142" 0141.0000.0142 perl #39530
271 %#v.3i "\141\000\142" 097.000.098 perl #39530
272 %#v.2x "\141\000\142" 0x61.00.0x62 perl #39530
273 %#v.2X "\141\000\142" 0X61.00.0X62 perl #39530
274 %#v.8b "\141\017\142" 0b01100001.0b00001111.0b01100010 perl #39530
275 %#v.4o "\141\017\142" 0141.0017.0142 perl #39530
276 %#v.3i "\141\017\142" 097.015.098 perl #39530
277 %#v.2x "\141\017\142" 0x61.0x0f.0x62 perl #39530
278 %#v.2X "\141\017\142" 0X61.0X0F.0X62 perl #39530
279 %#*v.8b ["][", "\141\000\142"] 0b01100001][00000000][0b01100010 perl #39530
280 %#*v.4o ["][", "\141\000\142"] 0141][0000][0142 perl #39530
281 %#*v.3i ["][", "\141\000\142"] 097][000][098 perl #39530
282 %#*v.2x ["][", "\141\000\142"] 0x61][00][0x62 perl #39530
283 %#*v.2X ["][", "\141\000\142"] 0X61][00][0X62 perl #39530
284 %#*v.8b ["][", "\141\017\142"] 0b01100001][0b00001111][0b01100010 perl #39530
285 %#*v.4o ["][", "\141\017\142"] 0141][0017][0142 perl #39530
286 %#*v.3i ["][", "\141\017\142"] 097][015][098 perl #39530
287 %#*v.2x ["][", "\141\017\142"] 0x61][0x0f][0x62 perl #39530
288 %#*v.2X ["][", "\141\017\142"] 0X61][0X0F][0X62 perl #39530
289 %#v.8b "\141\x{1e01}\000\142\x{1e03}" 0b01100001.0b1111000000001.00000000.0b01100010.0b1111000000011 perl #39530
290 %#v.4o "\141\x{1e01}\000\142\x{1e03}" 0141.017001.0000.0142.017003 perl #39530
291 %#v.3i "\141\x{1e01}\000\142\x{1e03}" 097.7681.000.098.7683 perl #39530
292 %#v.2x "\141\x{1e01}\000\142\x{1e03}" 0x61.0x1e01.00.0x62.0x1e03 perl #39530
293 %#v.2X "\141\x{1e01}\000\142\x{1e03}" 0X61.0X1E01.00.0X62.0X1E03 perl #39530
294 %#v.8b "\141\x{1e01}\017\142\x{1e03}" 0b01100001.0b1111000000001.0b00001111.0b01100010.0b1111000000011 perl #39530
295 %#v.4o "\141\x{1e01}\017\142\x{1e03}" 0141.017001.0017.0142.017003 perl #39530
296 %#v.3i "\141\x{1e01}\017\142\x{1e03}" 097.7681.015.098.7683 perl #39530
297 %#v.2x "\141\x{1e01}\017\142\x{1e03}" 0x61.0x1e01.0x0f.0x62.0x1e03 perl #39530
298 %#v.2X "\141\x{1e01}\017\142\x{1e03}" 0X61.0X1E01.0X0F.0X62.0X1E03 perl #39530
299 %V-%s ["Hello"] %V-Hello INVALID
300 %K %d %d [13, 29] %K 13 29 INVALID
301 %*.*K %d [13, 29, 76] %*.*K 13 INVALID
302 %4$K %d [45, 67] %4$K 45 INVALID
303 %d %K %d [23, 45] 23 %K 45 INVALID
304 %*v*999\$d %d %d [11, 22, 33] %*v*999\$d 11 22 INVALID
309 %*2147483647$v2d '' UNINIT