Commit | Line | Data |
8d063cd8 |
1 | #!./perl |
2 | |
be3174d2 |
3 | # Tests sprintf, excluding handling of 64-bit integers or long |
4 | # doubles (if supported), of machine-specific short and long |
5 | # integers, machine-specific floating point exceptions (infinity, |
6 | # not-a-number ...), of the effects of locale, and of features |
169da838 |
7 | # specific to multi-byte characters (under the utf8 pragma and such). |
8d063cd8 |
8 | |
9f1b1f2d |
9 | BEGIN { |
10 | chdir 't' if -d 't'; |
20822f61 |
11 | @INC = '../lib'; |
e24bffee |
12 | } |
9f1b1f2d |
13 | use warnings; |
34ba6322 |
14 | use version; |
e24bffee |
15 | use Config; |
0a52d15b |
16 | use strict; |
8234e14b |
17 | |
8234e14b |
18 | my @tests = (); |
19 | my ($i, $template, $data, $result, $comment, $w, $x, $evalData, $n, $p); |
9f1b1f2d |
20 | |
8234e14b |
21 | my $Is_VMS_VAX = 0; |
2fba3065 |
22 | # We use HW_MODEL since ARCH_NAME was not in VMS V5.* |
23 | if ($^O eq 'VMS') { |
24 | my $hw_model; |
25 | chomp($hw_model = `write sys\$output f\$getsyi("HW_MODEL")`); |
26 | $Is_VMS_VAX = $hw_model < 1024 ? 1 : 0; |
8234e14b |
27 | } |
28 | |
eaf637cf |
29 | # No %Config. |
30 | my $Is_Ultrix_VAX = $^O eq 'ultrix' && `uname -m` =~ /^VAX$/; |
31 | |
0a52d15b |
32 | while (<DATA>) { |
33 | s/^\s*>//; s/<\s*$//; |
34 | ($template, $data, $result, $comment) = split(/<\s*>/, $_, 4); |
e95e2653 |
35 | if ($^O eq 'os390' || $^O eq 's390') { # non-IEEE (s390 is UTS) |
12ebcc11 |
36 | $data =~ s/([eE])96$/${1}63/; # smaller exponents |
37 | $result =~ s/([eE]\+)102$/${1}69/; # " " |
38 | $data =~ s/([eE])\-101$/${1}-56/; # larger exponents |
39 | $result =~ s/([eE])\-102$/${1}-57/; # " " |
40 | } |
eaf637cf |
41 | if ($Is_VMS_VAX || $Is_Ultrix_VAX) { |
e24bffee |
42 | # VAX DEC C 5.3 at least since there is no |
eaf637cf |
43 | # ccflags =~ /float=ieee/ on VAX. |
44 | # AXP is unaffected whether or not it's using ieee. |
8234e14b |
45 | $data =~ s/([eE])96$/${1}26/; # smaller exponents |
46 | $result =~ s/([eE]\+)102$/${1}32/; # " " |
47 | $data =~ s/([eE])\-101$/${1}-24/; # larger exponents |
48 | $result =~ s/([eE])\-102$/${1}-25/; # " " |
49 | } |
57c348a9 |
50 | |
51 | $evalData = eval $data; |
52 | $data = ref $evalData ? $evalData : [$evalData]; |
0a52d15b |
53 | push @tests, [$template, $data, $result, $comment]; |
54 | } |
55 | |
56 | print '1..', scalar @tests, "\n"; |
57 | |
58 | $SIG{__WARN__} = sub { |
59 | if ($_[0] =~ /^Invalid conversion/) { |
60 | $w = ' INVALID'; |
61 | } elsif ($_[0] =~ /^Use of uninitialized value/) { |
62 | $w = ' UNINIT'; |
63 | } else { |
64 | warn @_; |
65 | } |
66 | }; |
67 | |
68 | for ($i = 1; @tests; $i++) { |
69 | ($template, $data, $result, $comment) = @{shift @tests}; |
be3174d2 |
70 | $w = undef; |
57c348a9 |
71 | $x = sprintf(">$template<", @$data); |
be3174d2 |
72 | substr($x, -1, 0) = $w if $w; |
48237dde |
73 | # $x may have 3 exponent digits, not 2 |
74 | my $y = $x; |
75 | if ($y =~ s/([Ee][-+])0(\d)/$1$2/) { |
76 | # if result is left-adjusted, append extra space |
77 | if ($template =~ /%\+?\-/ and $result =~ / $/) { |
78 | $y =~ s/<$/ </; |
79 | } |
80 | # if result is zero-filled, add extra zero |
81 | elsif ($template =~ /%\+?0/ and $result =~ /^0/) { |
82 | $y =~ s/^>0/>00/; |
83 | } |
84 | # if result is right-adjusted, prepend extra space |
85 | elsif ($result =~ /^ /) { |
86 | $y =~ s/^>/> /; |
87 | } |
65c97e0f |
88 | } |
89 | |
e24bffee |
90 | my $skip = 0; |
91 | if ($comment =~ s/\s+skip:\s*(.*)//) { |
92 | my $os = $1; |
93 | my $osv = exists $Config{osvers} ? $Config{osvers} : "0"; |
94 | # >comment skip: all< |
95 | if ($os =~ /\ball\b/i) { |
96 | $skip = 1; |
97 | # >comment skip: VMS hpux:10.20< |
98 | } elsif ($os =~ /\b$^O(?::(\S+))?\b/i) { |
99 | my $vsn = defined $1 ? $1 : "0"; |
100 | # Only compare on the the first pair of digits, as numeric |
101 | # compares don't like 2.6.10-3mdksmp or 2.6.8-24.10-default |
102 | s/^(\d+(\.\d+)?).*/$1/ for $osv, $vsn; |
6f1f3b4a |
103 | $skip = $vsn ? ($osv <= $vsn ? 1 : 0) : 1; |
e24bffee |
104 | } |
105 | $skip and $comment =~ s/$/, failure expected on $^O $osv/; |
106 | } |
107 | |
be3174d2 |
108 | if ($x eq ">$result<") { |
109 | print "ok $i\n"; |
110 | } |
e24bffee |
111 | elsif ($skip) { |
112 | print "ok $i # skip $comment\n"; |
113 | } |
48237dde |
114 | elsif ($y eq ">$result<") # Some C libraries always give |
65c97e0f |
115 | { # three-digit exponent |
00b6c67e |
116 | print("ok $i # >$result< $x three-digit exponent accepted\n"); |
65c97e0f |
117 | } |
f7137e37 |
118 | elsif ($result =~ /[-+]\d{3}$/ && |
119 | # Suppress tests with modulo of exponent >= 100 on platforms |
120 | # which can't handle such magnitudes (or where we can't tell). |
121 | ((!eval {require POSIX}) || # Costly: only do this if we must! |
122 | (length(&POSIX::DBL_MAX) - rindex(&POSIX::DBL_MAX, '+')) == 3)) |
123 | { |
00b6c67e |
124 | print("ok $i # >$template< >$data< >$result<", |
e24bffee |
125 | " Suppressed: exponent out of range?\n"); |
f7137e37 |
126 | } |
be3174d2 |
127 | else { |
48237dde |
128 | $y = ($x eq $y ? "" : " => $y"); |
129 | print("not ok $i >$template< >$data< >$result< $x$y", |
65c97e0f |
130 | $comment ? " # $comment\n" : "\n"); |
fb73857a |
131 | } |
132 | } |
48237dde |
133 | |
a6d05634 |
134 | # In each of the following lines, there are three required fields: |
be3174d2 |
135 | # printf template, data to be formatted (as a Perl expression), and |
136 | # expected result of formatting. An optional fourth field can contain |
137 | # a comment. Each field is delimited by a starting '>' and a |
138 | # finishing '<'; any whitespace outside these start and end marks is |
139 | # not part of the field. If formatting requires more than one data |
140 | # item (for example, if variable field widths are used), the Perl data |
141 | # expression should return a reference to an array having the requisite |
142 | # number of elements. Even so, subterfuge is sometimes required: see |
143 | # tests for %n and %p. |
144 | # |
e24bffee |
145 | # Tests that are expected to fail on a certain OS can be marked as such |
146 | # by trailing the comment with a skip: section. Skips are tags separated |
147 | # bu space consisting of a $^O optionally trailed with :osvers. In the |
148 | # latter case, all os-levels below that are expected to fail. A special |
149 | # tag 'all' is allowed for todo tests that should fail on any system |
150 | # |
151 | # >%G< >1234567e96< >1.23457E+102< >exponent too big skip: os390< |
6f1f3b4a |
152 | # >%.0g< >-0.0< >-0< >No minus skip: MSWin32 VMS hpux:10.20< |
e24bffee |
153 | # >%d< >4< >1< >4 != 1 skip: all< |
154 | # |
02a4ca6d |
155 | # The following tests are not currently run, for the reasons stated: |
156 | |
157 | =pod |
158 | |
159 | =begin problematic |
160 | |
02a4ca6d |
161 | >%.0f< >1.5< >2< >Standard vague: no rounding rules< |
162 | >%.0f< >2.5< >2< >Standard vague: no rounding rules< |
163 | |
164 | =end problematic |
165 | |
166 | =cut |
167 | |
be3174d2 |
168 | # template data result |
169 | __END__ |
be3174d2 |
170 | >%6. 6s< >''< >%6. 6s INVALID< >(See use of $w in code above)< |
c2e66d9e |
171 | >%6 .6s< >''< >%6 .6s INVALID< |
be3174d2 |
172 | >%6.6 s< >''< >%6.6 s INVALID< |
c2e66d9e |
173 | >%A< >''< >%A INVALID< |
be3174d2 |
174 | >%B< >''< >%B INVALID< |
175 | >%C< >''< >%C INVALID< |
176 | >%D< >0x7fffffff< >2147483647< >Synonym for %ld< |
177 | >%E< >123456.789< >1.234568E+05< >Like %e, but using upper-case "E"< |
178 | >%F< >123456.789< >123456.789000< >Synonym for %f< |
179 | >%G< >1234567.89< >1.23457E+06< >Like %g, but using upper-case "E"< |
c2e66d9e |
180 | >%G< >1234567e96< >1.23457E+102< |
181 | >%G< >.1234567e-101< >1.23457E-102< |
be3174d2 |
182 | >%G< >12345.6789< >12345.7< |
e24bffee |
183 | >%G< >1234567e96< >1.23457E+102< >exponent too big skip: os390< |
184 | >%G< >.1234567e-101< >1.23457E-102< >exponent too small skip: os390< |
be3174d2 |
185 | >%H< >''< >%H INVALID< |
186 | >%I< >''< >%I INVALID< |
187 | >%J< >''< >%J INVALID< |
188 | >%K< >''< >%K INVALID< |
189 | >%L< >''< >%L INVALID< |
190 | >%M< >''< >%M INVALID< |
191 | >%N< >''< >%N INVALID< |
8234e14b |
192 | >%O< >2**32-1< >37777777777< >Synonym for %lo< |
be3174d2 |
193 | >%P< >''< >%P INVALID< |
194 | >%Q< >''< >%Q INVALID< |
195 | >%R< >''< >%R INVALID< |
196 | >%S< >''< >%S INVALID< |
197 | >%T< >''< >%T INVALID< |
8234e14b |
198 | >%U< >2**32-1< >4294967295< >Synonym for %lu< |
be3174d2 |
199 | >%V< >''< >%V INVALID< |
200 | >%W< >''< >%W INVALID< |
201 | >%X< >2**32-1< >FFFFFFFF< >Like %x, but with u/c letters< |
202 | >%#X< >2**32-1< >0XFFFFFFFF< |
203 | >%Y< >''< >%Y INVALID< |
204 | >%Z< >''< >%Z INVALID< |
205 | >%a< >''< >%a INVALID< |
206 | >%b< >2**32-1< >11111111111111111111111111111111< |
207 | >%+b< >2**32-1< >11111111111111111111111111111111< |
208 | >%#b< >2**32-1< >0b11111111111111111111111111111111< |
209 | >%34b< >2**32-1< > 11111111111111111111111111111111< |
210 | >%034b< >2**32-1< >0011111111111111111111111111111111< |
211 | >%-34b< >2**32-1< >11111111111111111111111111111111 < |
212 | >%-034b< >2**32-1< >11111111111111111111111111111111 < |
213 | >%c< >ord('A')< >A< |
214 | >%10c< >ord('A')< > A< |
215 | >%#10c< >ord('A')< > A< ># modifier: no effect< |
216 | >%010c< >ord('A')< >000000000A< |
217 | >%10lc< >ord('A')< > A< >l modifier: no effect< |
218 | >%10hc< >ord('A')< > A< >h modifier: no effect< |
219 | >%10.5c< >ord('A')< > A< >precision: no effect< |
220 | >%-10c< >ord('A')< >A < |
221 | >%d< >123456.789< >123456< |
222 | >%d< >-123456.789< >-123456< |
223 | >%d< >0< >0< |
224 | >%+d< >0< >+0< |
225 | >%0d< >0< >0< |
226 | >%.0d< >0< >< |
227 | >%+.0d< >0< >+< |
228 | >%.0d< >1< >1< |
229 | >%d< >1< >1< |
230 | >%+d< >1< >+1< |
231 | >%#3.2d< >1< > 01< ># modifier: no effect< |
232 | >%3.2d< >1< > 01< |
233 | >%03.2d< >1< >001< |
234 | >%-3.2d< >1< >01 < |
235 | >%-03.2d< >1< >01 < >zero pad + left just.: no effect< |
236 | >%d< >-1< >-1< |
237 | >%+d< >-1< >-1< |
238 | >%hd< >1< >1< >More extensive testing of< |
239 | >%ld< >1< >1< >length modifiers would be< |
240 | >%Vd< >1< >1< >platform-specific< |
241 | >%vd< >chr(1)< >1< |
242 | >%+vd< >chr(1)< >+1< |
243 | >%#vd< >chr(1)< >1< |
244 | >%vd< >"\01\02\03"< >1.2.3< |
18eaf740 |
245 | >%vd< >v1.2.3< >1.2.3< |
246 | >%vd< >[version::qv("1.2.3")]< >1.2.3< |
34ba6322 |
247 | >%vd< >[version->new("1.2")]< >1.200< |
248 | >%vd< >[version->new("1.02")]< >1.20< |
249 | >%vd< >[version->new("1.002")]< >1.2< |
250 | >%vd< >[version->new("1048576.5")]< >1048576.500< |
251 | >%vd< >[version->new("50")]< >50.0< |
be3174d2 |
252 | >%v.3d< >"\01\02\03"< >001.002.003< |
211dfcf1 |
253 | >%0v3d< >"\01\02\03"< >001.002.003< |
96b8f7ce |
254 | >%v.3d< >[version::qv("1.2.3")]< >001.002.003< |
211dfcf1 |
255 | >%-v3d< >"\01\02\03"< >1 .2 .3 < |
256 | >%+-v3d< >"\01\02\03"< >+1 .2 .3 < |
96b8f7ce |
257 | >%+-v3d< >[version::qv("1.2.3")]< >+1 .2 .3 < |
be3174d2 |
258 | >%v4.3d< >"\01\02\03"< > 001. 002. 003< |
211dfcf1 |
259 | >%0v4.3d< >"\01\02\03"< >0001.0002.0003< |
260 | >%0*v2d< >['-', "\0\7\14"]< >00-07-12< |
261 | >%v.*d< >["\01\02\03", 3]< >001.002.003< |
262 | >%0v*d< >["\01\02\03", 3]< >001.002.003< |
263 | >%-v*d< >["\01\02\03", 3]< >1 .2 .3 < |
264 | >%+-v*d< >["\01\02\03", 3]< >+1 .2 .3 < |
265 | >%v*.*d< >["\01\02\03", 4, 3]< > 001. 002. 003< |
266 | >%0v*.*d< >["\01\02\03", 4, 3]< >0001.0002.0003< |
267 | >%0*v*d< >['-', "\0\7\13", 2]< >00-07-11< |
96b8f7ce |
268 | >%0*v*d< >['-', version::qv("0.7.11"), 2]< >00-07-11< |
be3174d2 |
269 | >%e< >1234.875< >1.234875e+03< |
c2e66d9e |
270 | >%e< >0.000012345< >1.234500e-05< |
271 | >%e< >1234567E96< >1.234567e+102< |
272 | >%e< >0< >0.000000e+00< |
273 | >%e< >.1234567E-101< >1.234567e-102< |
be3174d2 |
274 | >%+e< >1234.875< >+1.234875e+03< |
275 | >%#e< >1234.875< >1.234875e+03< |
276 | >%e< >-1234.875< >-1.234875e+03< |
277 | >%+e< >-1234.875< >-1.234875e+03< |
278 | >%#e< >-1234.875< >-1.234875e+03< |
279 | >%.0e< >1234.875< >1e+03< |
02a4ca6d |
280 | >%#.0e< >1234.875< >1.e+03< |
20f6aaab |
281 | >%.0e< >1.875< >2e+00< |
282 | >%.0e< >0.875< >9e-01< |
be3174d2 |
283 | >%.*e< >[0, 1234.875]< >1e+03< |
284 | >%.1e< >1234.875< >1.2e+03< |
285 | >%-12.4e< >1234.875< >1.2349e+03 < |
286 | >%12.4e< >1234.875< > 1.2349e+03< |
287 | >%+-12.4e< >1234.875< >+1.2349e+03 < |
288 | >%+12.4e< >1234.875< > +1.2349e+03< |
289 | >%+-12.4e< >-1234.875< >-1.2349e+03 < |
290 | >%+12.4e< >-1234.875< > -1.2349e+03< |
e24bffee |
291 | >%e< >1234567E96< >1.234567e+102< >exponent too big skip: os390< |
292 | >%e< >.1234567E-101< >1.234567e-102< >exponent too small skip: os390< |
be3174d2 |
293 | >%f< >1234.875< >1234.875000< |
294 | >%+f< >1234.875< >+1234.875000< |
295 | >%#f< >1234.875< >1234.875000< |
296 | >%f< >-1234.875< >-1234.875000< |
297 | >%+f< >-1234.875< >-1234.875000< |
298 | >%#f< >-1234.875< >-1234.875000< |
299 | >%6f< >1234.875< >1234.875000< |
300 | >%*f< >[6, 1234.875]< >1234.875000< |
e24bffee |
301 | >%.0f< >-0.1< >-0< >C library bug: no minus skip: VMS< |
be3174d2 |
302 | >%.0f< >1234.875< >1235< |
303 | >%.1f< >1234.875< >1234.9< |
304 | >%-8.1f< >1234.875< >1234.9 < |
305 | >%8.1f< >1234.875< > 1234.9< |
306 | >%+-8.1f< >1234.875< >+1234.9 < |
307 | >%+8.1f< >1234.875< > +1234.9< |
308 | >%+-8.1f< >-1234.875< >-1234.9 < |
309 | >%+8.1f< >-1234.875< > -1234.9< |
310 | >%*.*f< >[5, 2, 12.3456]< >12.35< |
c2e66d9e |
311 | >%f< >0< >0.000000< |
312 | >%.0f< >0< >0< |
313 | >%.0f< >2**38< >274877906944< >Should have exact int'l rep'n< |
d5365ef1 |
314 | >%.0f< >0.1< >0< |
20f6aaab |
315 | >%.0f< >0.6< >1< >Known to fail with sfio, (irix|nonstop-ux|powerux); -DHAS_LDBL_SPRINTF_BUG may fix< |
316 | >%.0f< >-0.6< >-1< >Known to fail with sfio, (irix|nonstop-ux|powerux); -DHAS_LDBL_SPRINTF_BUG may fix< |
317 | >%.0f< >1.6< >2< |
318 | >%.0f< >-1.6< >-2< |
02a4ca6d |
319 | >%.0f< >1< >1< |
320 | >%#.0f< >1< >1.< |
00e17364 |
321 | >%.0lf< >1< >1< >'l' should have no effect< |
322 | >%.0hf< >1< >%.0hf INVALID< >'h' should be rejected< |
be3174d2 |
323 | >%g< >12345.6789< >12345.7< |
324 | >%+g< >12345.6789< >+12345.7< |
325 | >%#g< >12345.6789< >12345.7< |
65ff66fc |
326 | >%.0g< >-0.0< >-0< >C99 standard mandates minus sign but C89 does not skip: MSWin32 VMS hpux:10.20 openbsd netbsd:1.5 irix< |
be3174d2 |
327 | >%.0g< >12345.6789< >1e+04< |
02a4ca6d |
328 | >%#.0g< >12345.6789< >1.e+04< |
be3174d2 |
329 | >%.2g< >12345.6789< >1.2e+04< |
330 | >%.*g< >[2, 12345.6789]< >1.2e+04< |
331 | >%.9g< >12345.6789< >12345.6789< |
332 | >%12.9g< >12345.6789< > 12345.6789< |
333 | >%012.9g< >12345.6789< >0012345.6789< |
334 | >%-12.9g< >12345.6789< >12345.6789 < |
335 | >%*.*g< >[-12, 9, 12345.6789]< >12345.6789 < |
336 | >%-012.9g< >12345.6789< >12345.6789 < |
337 | >%g< >-12345.6789< >-12345.7< |
338 | >%+g< >-12345.6789< >-12345.7< |
339 | >%g< >1234567.89< >1.23457e+06< |
340 | >%+g< >1234567.89< >+1.23457e+06< |
341 | >%#g< >1234567.89< >1.23457e+06< |
342 | >%g< >-1234567.89< >-1.23457e+06< |
343 | >%+g< >-1234567.89< >-1.23457e+06< |
344 | >%#g< >-1234567.89< >-1.23457e+06< |
c2e66d9e |
345 | >%g< >0.00012345< >0.00012345< |
346 | >%g< >0.000012345< >1.2345e-05< |
347 | >%g< >1234567E96< >1.23457e+102< |
348 | >%g< >.1234567E-101< >1.23457e-102< |
349 | >%g< >0< >0< |
be3174d2 |
350 | >%13g< >1234567.89< > 1.23457e+06< |
351 | >%+13g< >1234567.89< > +1.23457e+06< |
e24bffee |
352 | >%013g< >1234567.89< >001.23457e+06< |
353 | >%-13g< >1234567.89< >1.23457e+06 < |
354 | >%g< >.1234567E-101< >1.23457e-102< >exponent too small skip: os390< |
355 | >%g< >1234567E96< >1.23457e+102< >exponent too big skip: os390< |
be3174d2 |
356 | >%h< >''< >%h INVALID< |
357 | >%i< >123456.789< >123456< >Synonym for %d< |
358 | >%j< >''< >%j INVALID< |
359 | >%k< >''< >%k INVALID< |
360 | >%l< >''< >%l INVALID< |
361 | >%m< >''< >%m INVALID< |
362 | >%s< >sprintf('%%n%n %d', $n, $n)< >%n 2< >Slight sneakiness to test %n< |
363 | >%o< >2**32-1< >37777777777< |
364 | >%+o< >2**32-1< >37777777777< |
365 | >%#o< >2**32-1< >037777777777< |
8234e14b |
366 | >%o< >642< >1202< >check smaller octals across platforms< |
367 | >%+o< >642< >1202< |
368 | >%#o< >642< >01202< |
be3174d2 |
369 | >%d< >$p=sprintf('%p',$p);$p=~/^[0-9a-f]+$/< >1< >Coarse hack: hex from %p?< |
0dbb1585 |
370 | >%d< >$p=sprintf('%-8p',$p);$p=~/^[0-9a-f]+\s*$/< >1< >Coarse hack: hex from %p?< |
d5365ef1 |
371 | >%#p< >''< >%#p INVALID< |
be3174d2 |
372 | >%q< >''< >%q INVALID< |
373 | >%r< >''< >%r INVALID< |
374 | >%s< >'string'< >string< |
375 | >%10s< >'string'< > string< |
376 | >%+10s< >'string'< > string< |
377 | >%#10s< >'string'< > string< |
378 | >%010s< >'string'< >0000string< |
379 | >%0*s< >[10, 'string']< >0000string< |
380 | >%-10s< >'string'< >string < |
381 | >%3s< >'string'< >string< |
382 | >%.3s< >'string'< >str< |
383 | >%.*s< >[3, 'string']< >str< |
384 | >%t< >''< >%t INVALID< |
385 | >%u< >2**32-1< >4294967295< |
386 | >%+u< >2**32-1< >4294967295< |
387 | >%#u< >2**32-1< >4294967295< |
388 | >%12u< >2**32-1< > 4294967295< |
389 | >%012u< >2**32-1< >004294967295< |
390 | >%-12u< >2**32-1< >4294967295 < |
391 | >%-012u< >2**32-1< >4294967295 < |
392 | >%v< >''< >%v INVALID< |
393 | >%w< >''< >%w INVALID< |
394 | >%x< >2**32-1< >ffffffff< |
395 | >%+x< >2**32-1< >ffffffff< |
396 | >%#x< >2**32-1< >0xffffffff< |
397 | >%10x< >2**32-1< > ffffffff< |
398 | >%010x< >2**32-1< >00ffffffff< |
399 | >%-10x< >2**32-1< >ffffffff < |
400 | >%-010x< >2**32-1< >ffffffff < |
401 | >%0-10x< >2**32-1< >ffffffff < |
402 | >%0*x< >[-10, ,2**32-1]< >ffffffff < |
96b8f7ce |
403 | >%vx< >[version::qv("1.2.3")]< >1.2.3< |
404 | >%vx< >[version::qv("1.20.300")]< >1.14.12c< |
be3174d2 |
405 | >%y< >''< >%y INVALID< |
406 | >%z< >''< >%z INVALID< |
eb3fce90 |
407 | >%2$d %1$d< >[12, 34]< >34 12< |
408 | >%*2$d< >[12, 3]< > 12< |
409 | >%2$d %d< >[12, 34]< >34 12< |
410 | >%2$d %d %d< >[12, 34]< >34 12 34< |
411 | >%3$d %d %d< >[12, 34, 56]< >56 12 34< |
412 | >%2$*3$d %d< >[12, 34, 3]< > 34 12< |
58e33a90 |
413 | >%*3$2$d %d< >[12, 34, 3]< >%*3$2$d 12 INVALID< |
211dfcf1 |
414 | >%2$d< >12< >0 UNINIT< |
eb3fce90 |
415 | >%0$d< >12< >%0$d INVALID< |
416 | >%1$$d< >12< >%1$$d INVALID< |
417 | >%1$1$d< >12< >%1$1$d INVALID< |
418 | >%*2$*2$d< >[12, 3]< >%*2$*2$d INVALID< |
419 | >%*2*2$d< >[12, 3]< >%*2*2$d INVALID< |
8896765a |
420 | >%*2$1d< >[12, 3]< >%*2$1d INVALID< |
211dfcf1 |
421 | >%0v2.2d< >''< >< |
26372e71 |
422 | >%vc,%d< >[63, 64, 65]< >%vc,63 INVALID< |
423 | >%v%,%d< >[63, 64, 65]< >%v%,63 INVALID< |
be75b157 |
424 | >%vd,%d< >[1, 2, 3]< >49,2< |
26372e71 |
425 | >%vf,%d< >[1, 2, 3]< >%vf,1 INVALID< |
426 | >%vF,%d< >[1, 2, 3]< >%vF,1 INVALID< |
427 | >%ve,%d< >[1, 2, 3]< >%ve,1 INVALID< |
428 | >%vE,%d< >[1, 2, 3]< >%vE,1 INVALID< |
429 | >%vg,%d< >[1, 2, 3]< >%vg,1 INVALID< |
430 | >%vG,%d< >[1, 2, 3]< >%vG,1 INVALID< |
be75b157 |
431 | >%vp< >''< >%vp INVALID< |
26372e71 |
432 | >%vn< >''< >%vn INVALID< |
433 | >%vs,%d< >[1, 2, 3]< >%vs,1 INVALID< |
be75b157 |
434 | >%v_< >''< >%v_ INVALID< |
f3583277 |
435 | >%v#x< >''< >%v#x INVALID< |
63c6dcc1 |
436 | >%v02x< >"foo\012"< >66.6f.6f.0a< |
1387f30c |
437 | >%#v.8b< >"a\000b"< >0b01100001.00000000.0b01100010< |
438 | >%#v.4o< >"a\000b"< >0141.0000.0142< |
439 | >%#v.3i< >"a\000b"< >097.000.098< |
440 | >%#v.2x< >"a\000b"< >0x61.00.0x62< |
441 | >%#*v.8b< >["][", "a\000b"]< >0b01100001][00000000][0b01100010< |
442 | >%#*v.4o< >["][", "a\000b"]< >0141][0000][0142< |
443 | >%#*v.3i< >["][", "a\000b"]< >097][000][098< |
444 | >%#*v.2x< >["][", "a\000b"]< >0x61][00][0x62< |
445 | >%#v.8b< >"a\x{1e01}\000b\x{1e03}"< >0b01100001.0b1111000000001.00000000.0b01100010.0b1111000000011< |
446 | >%#v.4o< >"a\x{1e01}\000b\x{1e03}"< >0141.017001.0000.0142.017003< |
447 | >%#v.3i< >"a\x{1e01}\000b\x{1e03}"< >097.7681.000.098.7683< |
448 | >%#v.2x< >"a\x{1e01}\000b\x{1e03}"< >0x61.0x1e01.00.0x62.0x1e03< |
58e33a90 |
449 | >%V-%s< >["Hello"]< >%V-Hello INVALID< |
450 | >%K %d %d< >[13, 29]< >%K 13 29 INVALID< |
451 | >%*.*K %d< >[13, 29, 76]< >%*.*K 13 INVALID< |
452 | >%4$K %d< >[45, 67]< >%4$K 45 INVALID< |
453 | >%d %K %d< >[23, 45]< >23 %K 45 INVALID< |
3a7a539e |
454 | >%*v*999\$d %d %d< >[11, 22, 33]< >%*v*999\$d 11 22 INVALID< |
ed2b91d2 |
455 | >%#b< >0< >0< |
456 | >%#o< >0< >0< |
457 | >%#x< >0< >0< |
2fba7546 |
458 | >%2147483647$v2d< >''< >< |
459 | >%*2147483647$v2d< >''< > UNINIT< |