From: H.Merijn Brand Date: Thu, 28 Jul 2005 12:22:27 +0000 (+0000) Subject: sprintf now has all but two tests enabled. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e24bffee9086641f77b10c82b8a314dbe095fbbe;p=p5sagit%2Fp5-mst-13.2.git sprintf now has all but two tests enabled. the list supports skipping of expected fails new test for %.0g from Dominic Dunlop p4raw-id: //depot/perl@25235 --- diff --git a/t/op/sprintf.t b/t/op/sprintf.t index 2045c19..254e5c9 100755 --- a/t/op/sprintf.t +++ b/t/op/sprintf.t @@ -9,10 +9,9 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; -} +} use warnings; -# we do not load %Config since this test resides in op and needs -# to run under the minitest target even without Config.pm working. +use Config; # strictness my @tests = (); @@ -20,7 +19,7 @@ my ($i, $template, $data, $result, $comment, $w, $x, $evalData, $n, $p); while () { s/^\s*>//; s/<\s*$//; - push @tests, [split(/<\s*>/, $_, 4)]; + push @tests, [split(/<\s*>/, $_, 4)]; } print '1..', scalar @tests, "\n"; @@ -55,7 +54,7 @@ for ($i = 1; @tests; $i++) { $result =~ s/([eE])\-102$/${1}-57/; # " " } if ($Is_VMS_VAX || $Is_Ultrix_VAX) { - # VAX DEC C 5.3 at least since there is no + # VAX DEC C 5.3 at least since there is no # ccflags =~ /float=ieee/ on VAX. # AXP is unaffected whether or not it's using ieee. $data =~ s/([eE])96$/${1}26/; # smaller exponents @@ -85,9 +84,30 @@ for ($i = 1; @tests; $i++) { } } + my $skip = 0; + if ($comment =~ s/\s+skip:\s*(.*)//) { + my $os = $1; + my $osv = exists $Config{osvers} ? $Config{osvers} : "0"; + # >comment skip: all< + if ($os =~ /\ball\b/i) { + $skip = 1; + # >comment skip: VMS hpux:10.20< + } elsif ($os =~ /\b$^O(?::(\S+))?\b/i) { + my $vsn = defined $1 ? $1 : "0"; + # Only compare on the the first pair of digits, as numeric + # compares don't like 2.6.10-3mdksmp or 2.6.8-24.10-default + s/^(\d+(\.\d+)?).*/$1/ for $osv, $vsn; + $vsn && $osv <= $vsn and $skip = 1; + } + $skip and $comment =~ s/$/, failure expected on $^O $osv/; + } + if ($x eq ">$result<") { print "ok $i\n"; } + elsif ($skip) { + print "ok $i # skip $comment\n"; + } elsif ($y eq ">$result<") # Some C libraries always give { # three-digit exponent print("ok $i # >$result< $x three-digit exponent accepted\n"); @@ -99,7 +119,7 @@ for ($i = 1; @tests; $i++) { (length(&POSIX::DBL_MAX) - rindex(&POSIX::DBL_MAX, '+')) == 3)) { print("ok $i # >$template< >$data< >$result<", - " Suppressed: exponent out of range?\n") + " Suppressed: exponent out of range?\n"); } else { $y = ($x eq $y ? "" : " => $y"); @@ -119,21 +139,24 @@ for ($i = 1; @tests; $i++) { # number of elements. Even so, subterfuge is sometimes required: see # tests for %n and %p. # +# Tests that are expected to fail on a certain OS can be marked as such +# by trailing the comment with a skip: section. Skips are tags separated +# bu space consisting of a $^O optionally trailed with :osvers. In the +# latter case, all os-levels below that are expected to fail. A special +# tag 'all' is allowed for todo tests that should fail on any system +# +# >%G< >1234567e96< >1.23457E+102< >exponent too big skip: os390< +# >%.0g< >-0.0< >-0< >No minus skip: VMS hpux:10.20< +# >%d< >4< >1< >4 != 1 skip: all< +# # The following tests are not currently run, for the reasons stated: =pod =begin problematic ->%.0f< >-0.1< >-0< >C library bug: no minus on VMS, HP-UX< >%.0f< >1.5< >2< >Standard vague: no rounding rules< >%.0f< >2.5< >2< >Standard vague: no rounding rules< ->%G< >1234567e96< >1.23457E+102< >exponent too big for OS/390< ->%G< >.1234567e-101< >1.23457E-102< >exponent too small for OS/390< ->%e< >1234567E96< >1.234567e+102< >exponent too big for OS/390< ->%e< >.1234567E-101< >1.234567e-102< >exponent too small for OS/390< ->%g< >.1234567E-101< >1.23457e-102< >exponent too small for OS/390< ->%g< >1234567E96< >1.23457e+102< >exponent too big for OS/390< =end problematic @@ -154,6 +177,8 @@ __END__ >%G< >1234567e96< >1.23457E+102< >%G< >.1234567e-101< >1.23457E-102< >%G< >12345.6789< >12345.7< +>%G< >1234567e96< >1.23457E+102< >exponent too big skip: os390< +>%G< >.1234567e-101< >1.23457E-102< >exponent too small skip: os390< >%H< >''< >%H INVALID< >%I< >''< >%I INVALID< >%J< >''< >%J INVALID< @@ -250,6 +275,8 @@ __END__ >%+12.4e< >1234.875< > +1.2349e+03< >%+-12.4e< >-1234.875< >-1.2349e+03 < >%+12.4e< >-1234.875< > -1.2349e+03< +>%e< >1234567E96< >1.234567e+102< >exponent too big skip: os390< +>%e< >.1234567E-101< >1.234567e-102< >exponent too small skip: os390< >%f< >1234.875< >1234.875000< >%+f< >1234.875< >+1234.875000< >%#f< >1234.875< >1234.875000< @@ -258,6 +285,7 @@ __END__ >%#f< >-1234.875< >-1234.875000< >%6f< >1234.875< >1234.875000< >%*f< >[6, 1234.875]< >1234.875000< +>%.0f< >-0.1< >-0< >C library bug: no minus skip: VMS< >%.0f< >1234.875< >1235< >%.1f< >1234.875< >1234.9< >%-8.1f< >1234.875< >1234.9 < @@ -282,6 +310,7 @@ __END__ >%g< >12345.6789< >12345.7< >%+g< >12345.6789< >+12345.7< >%#g< >12345.6789< >12345.7< +>%.0g< >-0.0< >-0< >No minus skip: VMS hpux:10.20< >%.0g< >12345.6789< >1e+04< >%#.0g< >12345.6789< >1.e+04< >%.2g< >12345.6789< >1.2e+04< @@ -307,8 +336,10 @@ __END__ >%g< >0< >0< >%13g< >1234567.89< > 1.23457e+06< >%+13g< >1234567.89< > +1.23457e+06< ->%013g< >1234567.89< >001.23457e+06< ->%-13g< >1234567.89< >1.23457e+06 < +>%013g< >1234567.89< >001.23457e+06< +>%-13g< >1234567.89< >1.23457e+06 < +>%g< >.1234567E-101< >1.23457e-102< >exponent too small skip: os390< +>%g< >1234567E96< >1.23457e+102< >exponent too big skip: os390< >%h< >''< >%h INVALID< >%i< >123456.789< >123456< >Synonym for %d< >%j< >''< >%j INVALID<