Fix typo in File::Find POD
[p5sagit/p5-mst-13.2.git] / t / op / sprintf.t
CommitLineData
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 9BEGIN {
10 chdir 't' if -d 't';
20822f61 11 @INC = '../lib';
e24bffee 12}
9f1b1f2d 13use warnings;
34ba6322 14use version;
e24bffee 15use Config;
0a52d15b 16use strict;
8234e14b 17
8234e14b 18my @tests = ();
19my ($i, $template, $data, $result, $comment, $w, $x, $evalData, $n, $p);
9f1b1f2d 20
8234e14b 21my $Is_VMS_VAX = 0;
2fba3065 22# We use HW_MODEL since ARCH_NAME was not in VMS V5.*
23if ($^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.
30my $Is_Ultrix_VAX = $^O eq 'ultrix' && `uname -m` =~ /^VAX$/;
31
0a52d15b 32while (<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
56print '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
68for ($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<
7ff06cc7 174>%B< >2**32-1< >11111111111111111111111111111111<
175>%+B< >2**32-1< >11111111111111111111111111111111<
176>%#B< >2**32-1< >0B11111111111111111111111111111111<
be3174d2 177>%C< >''< >%C INVALID<
178>%D< >0x7fffffff< >2147483647< >Synonym for %ld<
179>%E< >123456.789< >1.234568E+05< >Like %e, but using upper-case "E"<
180>%F< >123456.789< >123456.789000< >Synonym for %f<
181>%G< >1234567.89< >1.23457E+06< >Like %g, but using upper-case "E"<
c2e66d9e 182>%G< >1234567e96< >1.23457E+102<
183>%G< >.1234567e-101< >1.23457E-102<
be3174d2 184>%G< >12345.6789< >12345.7<
e24bffee 185>%G< >1234567e96< >1.23457E+102< >exponent too big skip: os390<
186>%G< >.1234567e-101< >1.23457E-102< >exponent too small skip: os390<
be3174d2 187>%H< >''< >%H INVALID<
188>%I< >''< >%I INVALID<
189>%J< >''< >%J INVALID<
190>%K< >''< >%K INVALID<
191>%L< >''< >%L INVALID<
192>%M< >''< >%M INVALID<
193>%N< >''< >%N INVALID<
8234e14b 194>%O< >2**32-1< >37777777777< >Synonym for %lo<
be3174d2 195>%P< >''< >%P INVALID<
196>%Q< >''< >%Q INVALID<
197>%R< >''< >%R INVALID<
198>%S< >''< >%S INVALID<
199>%T< >''< >%T INVALID<
8234e14b 200>%U< >2**32-1< >4294967295< >Synonym for %lu<
be3174d2 201>%V< >''< >%V INVALID<
202>%W< >''< >%W INVALID<
203>%X< >2**32-1< >FFFFFFFF< >Like %x, but with u/c letters<
204>%#X< >2**32-1< >0XFFFFFFFF<
205>%Y< >''< >%Y INVALID<
206>%Z< >''< >%Z INVALID<
207>%a< >''< >%a INVALID<
208>%b< >2**32-1< >11111111111111111111111111111111<
209>%+b< >2**32-1< >11111111111111111111111111111111<
210>%#b< >2**32-1< >0b11111111111111111111111111111111<
211>%34b< >2**32-1< > 11111111111111111111111111111111<
212>%034b< >2**32-1< >0011111111111111111111111111111111<
213>%-34b< >2**32-1< >11111111111111111111111111111111 <
214>%-034b< >2**32-1< >11111111111111111111111111111111 <
9911cee9 215>%6b< >12< > 1100<
216>%6.5b< >12< > 01100<
217>%-6.5b< >12< >01100 <
218>%+6.5b< >12< > 01100<
219>% 6.5b< >12< > 01100<
220>%06.5b< >12< > 01100< >0 flag with precision: no effect<
221>%.5b< >12< >01100<
be3174d2 222>%c< >ord('A')< >A<
223>%10c< >ord('A')< > A<
224>%#10c< >ord('A')< > A< ># modifier: no effect<
225>%010c< >ord('A')< >000000000A<
226>%10lc< >ord('A')< > A< >l modifier: no effect<
227>%10hc< >ord('A')< > A< >h modifier: no effect<
228>%10.5c< >ord('A')< > A< >precision: no effect<
229>%-10c< >ord('A')< >A <
230>%d< >123456.789< >123456<
231>%d< >-123456.789< >-123456<
232>%d< >0< >0<
9911cee9 233>%-d< >0< >0<
be3174d2 234>%+d< >0< >+0<
9911cee9 235>% d< >0< > 0<
be3174d2 236>%0d< >0< >0<
9911cee9 237>%-3d< >1< >1 <
238>%+3d< >1< > +1<
239>% 3d< >1< > 1<
240>%03d< >1< >001<
241>%+ 3d< >1< > +1<
242>% +3d< >1< > +1<
be3174d2 243>%.0d< >0< ><
244>%+.0d< >0< >+<
9911cee9 245>% .0d< >0< > <
246>%-.0d< >0< ><
247>%#.0d< >0< ><
be3174d2 248>%.0d< >1< >1<
249>%d< >1< >1<
250>%+d< >1< >+1<
251>%#3.2d< >1< > 01< ># modifier: no effect<
252>%3.2d< >1< > 01<
9911cee9 253>%03.2d< >1< > 01< >0 flag with precision: no effect<
be3174d2 254>%-3.2d< >1< >01 <
9911cee9 255>%+3.2d< >1< >+01<
256>% 3.2d< >1< > 01<
be3174d2 257>%-03.2d< >1< >01 < >zero pad + left just.: no effect<
9911cee9 258>%3.*d< >[2,1]< > 01<
259>%3.*d< >[1,1]< > 1<
260>%3.*d< >[0,1]< > 1<
261>%3.*d< >[-1,1]< > 1<
262>%.*d< >[0,0]< ><
263>%-.*d< >[0,0]< ><
264>%+.*d< >[0,0]< >+<
265>% .*d< >[0,0]< > <
266>%0.*d< >[0,0]< ><
267>%.*d< >[-2,0]< >0<
268>%-.*d< >[-2,0]< >0<
269>%+.*d< >[-2,0]< >+0<
270>% .*d< >[-2,0]< > 0<
271>%0.*d< >[-2,0]< >0<
be3174d2 272>%d< >-1< >-1<
9911cee9 273>%-d< >-1< >-1<
be3174d2 274>%+d< >-1< >-1<
9911cee9 275>% d< >-1< >-1<
276>%-3d< >-1< >-1 <
277>%+3d< >-1< > -1<
278>% 3d< >-1< > -1<
279>%03d< >-1< >-01<
be3174d2 280>%hd< >1< >1< >More extensive testing of<
281>%ld< >1< >1< >length modifiers would be<
282>%Vd< >1< >1< >platform-specific<
283>%vd< >chr(1)< >1<
284>%+vd< >chr(1)< >+1<
285>%#vd< >chr(1)< >1<
286>%vd< >"\01\02\03"< >1.2.3<
18eaf740 287>%vd< >v1.2.3< >1.2.3<
288>%vd< >[version::qv("1.2.3")]< >1.2.3<
34ba6322 289>%vd< >[version->new("1.2")]< >1.200<
290>%vd< >[version->new("1.02")]< >1.20<
291>%vd< >[version->new("1.002")]< >1.2<
292>%vd< >[version->new("1048576.5")]< >1048576.500<
293>%vd< >[version->new("50")]< >50.0<
be3174d2 294>%v.3d< >"\01\02\03"< >001.002.003<
211dfcf1 295>%0v3d< >"\01\02\03"< >001.002.003<
96b8f7ce 296>%v.3d< >[version::qv("1.2.3")]< >001.002.003<
211dfcf1 297>%-v3d< >"\01\02\03"< >1 .2 .3 <
298>%+-v3d< >"\01\02\03"< >+1 .2 .3 <
96b8f7ce 299>%+-v3d< >[version::qv("1.2.3")]< >+1 .2 .3 <
be3174d2 300>%v4.3d< >"\01\02\03"< > 001. 002. 003<
9911cee9 301>%0v4.3d< >"\01\02\03"< > 001. 002. 003<
211dfcf1 302>%0*v2d< >['-', "\0\7\14"]< >00-07-12<
303>%v.*d< >["\01\02\03", 3]< >001.002.003<
304>%0v*d< >["\01\02\03", 3]< >001.002.003<
305>%-v*d< >["\01\02\03", 3]< >1 .2 .3 <
306>%+-v*d< >["\01\02\03", 3]< >+1 .2 .3 <
307>%v*.*d< >["\01\02\03", 4, 3]< > 001. 002. 003<
9911cee9 308>%0v*.*d< >["\01\02\03", 4, 3]< > 001. 002. 003<
211dfcf1 309>%0*v*d< >['-', "\0\7\13", 2]< >00-07-11<
96b8f7ce 310>%0*v*d< >['-', version::qv("0.7.11"), 2]< >00-07-11<
be3174d2 311>%e< >1234.875< >1.234875e+03<
c2e66d9e 312>%e< >0.000012345< >1.234500e-05<
313>%e< >1234567E96< >1.234567e+102<
314>%e< >0< >0.000000e+00<
315>%e< >.1234567E-101< >1.234567e-102<
be3174d2 316>%+e< >1234.875< >+1.234875e+03<
317>%#e< >1234.875< >1.234875e+03<
318>%e< >-1234.875< >-1.234875e+03<
319>%+e< >-1234.875< >-1.234875e+03<
320>%#e< >-1234.875< >-1.234875e+03<
321>%.0e< >1234.875< >1e+03<
02a4ca6d 322>%#.0e< >1234.875< >1.e+03<
20f6aaab 323>%.0e< >1.875< >2e+00<
324>%.0e< >0.875< >9e-01<
be3174d2 325>%.*e< >[0, 1234.875]< >1e+03<
326>%.1e< >1234.875< >1.2e+03<
327>%-12.4e< >1234.875< >1.2349e+03 <
328>%12.4e< >1234.875< > 1.2349e+03<
329>%+-12.4e< >1234.875< >+1.2349e+03 <
330>%+12.4e< >1234.875< > +1.2349e+03<
331>%+-12.4e< >-1234.875< >-1.2349e+03 <
332>%+12.4e< >-1234.875< > -1.2349e+03<
e24bffee 333>%e< >1234567E96< >1.234567e+102< >exponent too big skip: os390<
334>%e< >.1234567E-101< >1.234567e-102< >exponent too small skip: os390<
be3174d2 335>%f< >1234.875< >1234.875000<
336>%+f< >1234.875< >+1234.875000<
337>%#f< >1234.875< >1234.875000<
338>%f< >-1234.875< >-1234.875000<
339>%+f< >-1234.875< >-1234.875000<
340>%#f< >-1234.875< >-1234.875000<
341>%6f< >1234.875< >1234.875000<
342>%*f< >[6, 1234.875]< >1234.875000<
e24bffee 343>%.0f< >-0.1< >-0< >C library bug: no minus skip: VMS<
be3174d2 344>%.0f< >1234.875< >1235<
345>%.1f< >1234.875< >1234.9<
346>%-8.1f< >1234.875< >1234.9 <
347>%8.1f< >1234.875< > 1234.9<
348>%+-8.1f< >1234.875< >+1234.9 <
349>%+8.1f< >1234.875< > +1234.9<
350>%+-8.1f< >-1234.875< >-1234.9 <
351>%+8.1f< >-1234.875< > -1234.9<
352>%*.*f< >[5, 2, 12.3456]< >12.35<
c2e66d9e 353>%f< >0< >0.000000<
354>%.0f< >0< >0<
355>%.0f< >2**38< >274877906944< >Should have exact int'l rep'n<
d5365ef1 356>%.0f< >0.1< >0<
20f6aaab 357>%.0f< >0.6< >1< >Known to fail with sfio, (irix|nonstop-ux|powerux); -DHAS_LDBL_SPRINTF_BUG may fix<
358>%.0f< >-0.6< >-1< >Known to fail with sfio, (irix|nonstop-ux|powerux); -DHAS_LDBL_SPRINTF_BUG may fix<
359>%.0f< >1.6< >2<
360>%.0f< >-1.6< >-2<
02a4ca6d 361>%.0f< >1< >1<
362>%#.0f< >1< >1.<
00e17364 363>%.0lf< >1< >1< >'l' should have no effect<
364>%.0hf< >1< >%.0hf INVALID< >'h' should be rejected<
be3174d2 365>%g< >12345.6789< >12345.7<
366>%+g< >12345.6789< >+12345.7<
367>%#g< >12345.6789< >12345.7<
4c749b6f 368>%.0g< >-0.0< >-0< >C99 standard mandates minus sign but C89 does not skip: MSWin32 VMS hpux:10.20 openbsd netbsd:1.5 irix darwin<
be3174d2 369>%.0g< >12345.6789< >1e+04<
02a4ca6d 370>%#.0g< >12345.6789< >1.e+04<
be3174d2 371>%.2g< >12345.6789< >1.2e+04<
372>%.*g< >[2, 12345.6789]< >1.2e+04<
373>%.9g< >12345.6789< >12345.6789<
374>%12.9g< >12345.6789< > 12345.6789<
375>%012.9g< >12345.6789< >0012345.6789<
376>%-12.9g< >12345.6789< >12345.6789 <
377>%*.*g< >[-12, 9, 12345.6789]< >12345.6789 <
378>%-012.9g< >12345.6789< >12345.6789 <
379>%g< >-12345.6789< >-12345.7<
380>%+g< >-12345.6789< >-12345.7<
381>%g< >1234567.89< >1.23457e+06<
382>%+g< >1234567.89< >+1.23457e+06<
383>%#g< >1234567.89< >1.23457e+06<
384>%g< >-1234567.89< >-1.23457e+06<
385>%+g< >-1234567.89< >-1.23457e+06<
386>%#g< >-1234567.89< >-1.23457e+06<
c2e66d9e 387>%g< >0.00012345< >0.00012345<
388>%g< >0.000012345< >1.2345e-05<
389>%g< >1234567E96< >1.23457e+102<
390>%g< >.1234567E-101< >1.23457e-102<
391>%g< >0< >0<
be3174d2 392>%13g< >1234567.89< > 1.23457e+06<
393>%+13g< >1234567.89< > +1.23457e+06<
e24bffee 394>%013g< >1234567.89< >001.23457e+06<
395>%-13g< >1234567.89< >1.23457e+06 <
396>%g< >.1234567E-101< >1.23457e-102< >exponent too small skip: os390<
397>%g< >1234567E96< >1.23457e+102< >exponent too big skip: os390<
be3174d2 398>%h< >''< >%h INVALID<
399>%i< >123456.789< >123456< >Synonym for %d<
400>%j< >''< >%j INVALID<
401>%k< >''< >%k INVALID<
402>%l< >''< >%l INVALID<
403>%m< >''< >%m INVALID<
404>%s< >sprintf('%%n%n %d', $n, $n)< >%n 2< >Slight sneakiness to test %n<
405>%o< >2**32-1< >37777777777<
406>%+o< >2**32-1< >37777777777<
407>%#o< >2**32-1< >037777777777<
8234e14b 408>%o< >642< >1202< >check smaller octals across platforms<
409>%+o< >642< >1202<
9911cee9 410>% o< >642< >1202<
8234e14b 411>%#o< >642< >01202<
9911cee9 412>%4o< >18< > 22<
413>%4.3o< >18< > 022<
414>%-4.3o< >18< >022 <
415>%+4.3o< >18< > 022<
416>% 4.3o< >18< > 022<
417>%04.3o< >18< > 022< >0 flag with precision: no effect<
418>%4.o< >36< > 44<
419>%-4.o< >36< >44 <
420>%+4.o< >36< > 44<
421>% 4.o< >36< > 44<
422>%04.o< >36< > 44< >0 flag with precision: no effect<
423>%.3o< >18< >022<
424>%#4o< >17< > 021<
425>%#-4o< >17< >021 <
426>%-#4o< >17< >021 <
427>%#+4o< >17< > 021<
428>%# 4o< >17< > 021<
429>%#04o< >17< >0021<
430>%#4.o< >16< > 020<
431>%#-4.o< >16< >020 <
432>%-#4.o< >16< >020 <
433>%#+4.o< >16< > 020<
434>%# 4.o< >16< > 020<
435>%#04.o< >16< > 020< >0 flag with precision: no effect<
436>%#4.3o< >18< > 022<
437>%#-4.3o< >18< >022 <
438>%-#4.3o< >18< >022 <
439>%#+4.3o< >18< > 022<
440>%# 4.3o< >18< > 022<
441>%#04.3o< >18< > 022< >0 flag with precision: no effect<
442>%#6.4o< >18< > 0022<
443>%#-6.4o< >18< >0022 <
444>%-#6.4o< >18< >0022 <
445>%#+6.4o< >18< > 0022<
446>%# 6.4o< >18< > 0022<
447>%#06.4o< >18< > 0022< >0 flag with precision: no effect<
be3174d2 448>%d< >$p=sprintf('%p',$p);$p=~/^[0-9a-f]+$/< >1< >Coarse hack: hex from %p?<
0dbb1585 449>%d< >$p=sprintf('%-8p',$p);$p=~/^[0-9a-f]+\s*$/< >1< >Coarse hack: hex from %p?<
d5365ef1 450>%#p< >''< >%#p INVALID<
be3174d2 451>%q< >''< >%q INVALID<
452>%r< >''< >%r INVALID<
453>%s< >'string'< >string<
454>%10s< >'string'< > string<
455>%+10s< >'string'< > string<
456>%#10s< >'string'< > string<
457>%010s< >'string'< >0000string<
458>%0*s< >[10, 'string']< >0000string<
459>%-10s< >'string'< >string <
460>%3s< >'string'< >string<
461>%.3s< >'string'< >str<
462>%.*s< >[3, 'string']< >str<
9911cee9 463>%.*s< >[2, 'string']< >st<
464>%.*s< >[1, 'string']< >s<
465>%.*s< >[0, 'string']< ><
466>%.*s< >[-1,'string']< >string< >negative precision to be ignored<
467>%3.*s< >[3, 'string']< >str<
468>%3.*s< >[2, 'string']< > st<
469>%3.*s< >[1, 'string']< > s<
470>%3.*s< >[0, 'string']< > <
471>%3.*s< >[-1,'string']< >string< >negative precision to be ignored<
be3174d2 472>%t< >''< >%t INVALID<
473>%u< >2**32-1< >4294967295<
474>%+u< >2**32-1< >4294967295<
475>%#u< >2**32-1< >4294967295<
476>%12u< >2**32-1< > 4294967295<
477>%012u< >2**32-1< >004294967295<
478>%-12u< >2**32-1< >4294967295 <
479>%-012u< >2**32-1< >4294967295 <
9911cee9 480>%4u< >18< > 18<
481>%4.3u< >18< > 018<
482>%-4.3u< >18< >018 <
483>%+4.3u< >18< > 018<
484>% 4.3u< >18< > 018<
485>%04.3u< >18< > 018< >0 flag with precision: no effect<
486>%.3u< >18< >018<
be3174d2 487>%v< >''< >%v INVALID<
488>%w< >''< >%w INVALID<
489>%x< >2**32-1< >ffffffff<
490>%+x< >2**32-1< >ffffffff<
491>%#x< >2**32-1< >0xffffffff<
492>%10x< >2**32-1< > ffffffff<
493>%010x< >2**32-1< >00ffffffff<
494>%-10x< >2**32-1< >ffffffff <
495>%-010x< >2**32-1< >ffffffff <
496>%0-10x< >2**32-1< >ffffffff <
9911cee9 497>%4x< >18< > 12<
498>%4.3x< >18< > 012<
499>%-4.3x< >18< >012 <
500>%+4.3x< >18< > 012<
501>% 4.3x< >18< > 012<
502>%04.3x< >18< > 012< >0 flag with precision: no effect<
503>%.3x< >18< >012<
504>%4X< >28< > 1C<
505>%4.3X< >28< > 01C<
506>%-4.3X< >28< >01C <
507>%+4.3X< >28< > 01C<
508>% 4.3X< >28< > 01C<
509>%04.3X< >28< > 01C< >0 flag with precision: no effect<
510>%.3X< >28< >01C<
511>%.0x< >0< ><
512>%+.0x< >0< ><
513>% .0x< >0< ><
514>%-.0x< >0< ><
515>%#.0x< >0< ><
516>%#4x< >28< >0x1c<
517>%#4.3x< >28< >0x01c<
518>%#-4.3x< >28< >0x01c<
519>%#+4.3x< >28< >0x01c<
520>%# 4.3x< >28< >0x01c<
521>%#04.3x< >28< >0x01c< >0 flag with precision: no effect<
522>%#.3x< >28< >0x01c<
523>%#6.3x< >28< > 0x01c<
524>%#-6.3x< >28< >0x01c <
525>%-#6.3x< >28< >0x01c <
526>%#+6.3x< >28< > 0x01c<
527>%+#6.3x< >28< > 0x01c<
528>%# 6.3x< >28< > 0x01c<
529>% #6.3x< >28< > 0x01c<
be3174d2 530>%0*x< >[-10, ,2**32-1]< >ffffffff <
96b8f7ce 531>%vx< >[version::qv("1.2.3")]< >1.2.3<
532>%vx< >[version::qv("1.20.300")]< >1.14.12c<
9911cee9 533>%.*x< >[0,0]< ><
534>%-.*x< >[0,0]< ><
535>%+.*x< >[0,0]< ><
536>% .*x< >[0,0]< ><
537>%0.*x< >[0,0]< ><
538>%.*x< >[-3,0]< >0<
539>%-.*x< >[-3,0]< >0<
540>%+.*x< >[-3,0]< >0<
541>% .*x< >[-3,0]< >0<
542>%0.*x< >[-3,0]< >0<
543>%#.*x< >[0,0]< ><
544>%#-.*x< >[0,0]< ><
545>%#+.*x< >[0,0]< ><
546>%# .*x< >[0,0]< ><
547>%#0.*x< >[0,0]< ><
548>%#.*x< >[-1,0]< >0<
549>%#-.*x< >[-1,0]< >0<
550>%#+.*x< >[-1,0]< >0<
551>%# .*x< >[-1,0]< >0<
552>%#0.*x< >[-1,0]< >0<
be3174d2 553>%y< >''< >%y INVALID<
554>%z< >''< >%z INVALID<
eb3fce90 555>%2$d %1$d< >[12, 34]< >34 12<
556>%*2$d< >[12, 3]< > 12<
557>%2$d %d< >[12, 34]< >34 12<
558>%2$d %d %d< >[12, 34]< >34 12 34<
559>%3$d %d %d< >[12, 34, 56]< >56 12 34<
560>%2$*3$d %d< >[12, 34, 3]< > 34 12<
58e33a90 561>%*3$2$d %d< >[12, 34, 3]< >%*3$2$d 12 INVALID<
211dfcf1 562>%2$d< >12< >0 UNINIT<
eb3fce90 563>%0$d< >12< >%0$d INVALID<
564>%1$$d< >12< >%1$$d INVALID<
565>%1$1$d< >12< >%1$1$d INVALID<
566>%*2$*2$d< >[12, 3]< >%*2$*2$d INVALID<
567>%*2*2$d< >[12, 3]< >%*2*2$d INVALID<
8896765a 568>%*2$1d< >[12, 3]< >%*2$1d INVALID<
211dfcf1 569>%0v2.2d< >''< ><
26372e71 570>%vc,%d< >[63, 64, 65]< >%vc,63 INVALID<
571>%v%,%d< >[63, 64, 65]< >%v%,63 INVALID<
250d67eb 572>%vd,%d< >["\x1", 2, 3]< >1,2<
26372e71 573>%vf,%d< >[1, 2, 3]< >%vf,1 INVALID<
574>%vF,%d< >[1, 2, 3]< >%vF,1 INVALID<
575>%ve,%d< >[1, 2, 3]< >%ve,1 INVALID<
576>%vE,%d< >[1, 2, 3]< >%vE,1 INVALID<
577>%vg,%d< >[1, 2, 3]< >%vg,1 INVALID<
578>%vG,%d< >[1, 2, 3]< >%vG,1 INVALID<
be75b157 579>%vp< >''< >%vp INVALID<
26372e71 580>%vn< >''< >%vn INVALID<
581>%vs,%d< >[1, 2, 3]< >%vs,1 INVALID<
be75b157 582>%v_< >''< >%v_ INVALID<
f3583277 583>%v#x< >''< >%v#x INVALID<
250d67eb 584>%v02x< >"\x66\x6f\x6f\012"< >66.6f.6f.0a<
52e1aa67 585>%#v.8b< >"\141\000\142"< >0b01100001.00000000.0b01100010< >perl #39530<
586>%#v.4o< >"\141\000\142"< >0141.0000.0142< >perl #39530<
587>%#v.3i< >"\141\000\142"< >097.000.098< >perl #39530<
588>%#v.2x< >"\141\000\142"< >0x61.00.0x62< >perl #39530<
589>%#v.2X< >"\141\000\142"< >0X61.00.0X62< >perl #39530<
590>%#v.8b< >"\141\017\142"< >0b01100001.0b00001111.0b01100010< >perl #39530<
591>%#v.4o< >"\141\017\142"< >0141.0017.0142< >perl #39530<
592>%#v.3i< >"\141\017\142"< >097.015.098< >perl #39530<
593>%#v.2x< >"\141\017\142"< >0x61.0x0f.0x62< >perl #39530<
594>%#v.2X< >"\141\017\142"< >0X61.0X0F.0X62< >perl #39530<
595>%#*v.8b< >["][", "\141\000\142"]< >0b01100001][00000000][0b01100010< >perl #39530<
596>%#*v.4o< >["][", "\141\000\142"]< >0141][0000][0142< >perl #39530<
597>%#*v.3i< >["][", "\141\000\142"]< >097][000][098< >perl #39530<
598>%#*v.2x< >["][", "\141\000\142"]< >0x61][00][0x62< >perl #39530<
599>%#*v.2X< >["][", "\141\000\142"]< >0X61][00][0X62< >perl #39530<
600>%#*v.8b< >["][", "\141\017\142"]< >0b01100001][0b00001111][0b01100010< >perl #39530<
601>%#*v.4o< >["][", "\141\017\142"]< >0141][0017][0142< >perl #39530<
602>%#*v.3i< >["][", "\141\017\142"]< >097][015][098< >perl #39530<
603>%#*v.2x< >["][", "\141\017\142"]< >0x61][0x0f][0x62< >perl #39530<
604>%#*v.2X< >["][", "\141\017\142"]< >0X61][0X0F][0X62< >perl #39530<
605>%#v.8b< >"\141\x{1e01}\000\142\x{1e03}"< >0b01100001.0b1111000000001.00000000.0b01100010.0b1111000000011< >perl #39530<
606>%#v.4o< >"\141\x{1e01}\000\142\x{1e03}"< >0141.017001.0000.0142.017003< >perl #39530<
607>%#v.3i< >"\141\x{1e01}\000\142\x{1e03}"< >097.7681.000.098.7683< >perl #39530<
608>%#v.2x< >"\141\x{1e01}\000\142\x{1e03}"< >0x61.0x1e01.00.0x62.0x1e03< >perl #39530<
609>%#v.2X< >"\141\x{1e01}\000\142\x{1e03}"< >0X61.0X1E01.00.0X62.0X1E03< >perl #39530<
610>%#v.8b< >"\141\x{1e01}\017\142\x{1e03}"< >0b01100001.0b1111000000001.0b00001111.0b01100010.0b1111000000011< >perl #39530<
611>%#v.4o< >"\141\x{1e01}\017\142\x{1e03}"< >0141.017001.0017.0142.017003< >perl #39530<
612>%#v.3i< >"\141\x{1e01}\017\142\x{1e03}"< >097.7681.015.098.7683< >perl #39530<
613>%#v.2x< >"\141\x{1e01}\017\142\x{1e03}"< >0x61.0x1e01.0x0f.0x62.0x1e03< >perl #39530<
614>%#v.2X< >"\141\x{1e01}\017\142\x{1e03}"< >0X61.0X1E01.0X0F.0X62.0X1E03< >perl #39530<
58e33a90 615>%V-%s< >["Hello"]< >%V-Hello INVALID<
616>%K %d %d< >[13, 29]< >%K 13 29 INVALID<
617>%*.*K %d< >[13, 29, 76]< >%*.*K 13 INVALID<
618>%4$K %d< >[45, 67]< >%4$K 45 INVALID<
619>%d %K %d< >[23, 45]< >23 %K 45 INVALID<
3a7a539e 620>%*v*999\$d %d %d< >[11, 22, 33]< >%*v*999\$d 11 22 INVALID<
ed2b91d2 621>%#b< >0< >0<
622>%#o< >0< >0<
623>%#x< >0< >0<
2fba7546 624>%2147483647$v2d< >''< ><
625>%*2147483647$v2d< >''< > UNINIT<