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