@INC = '../lib';
}
use warnings;
+use version;
use Config;
+use strict;
-# strictness
my @tests = ();
my ($i, $template, $data, $result, $comment, $w, $x, $evalData, $n, $p);
-while (<DATA>) {
- s/^\s*>//; s/<\s*$//;
- push @tests, [split(/<\s*>/, $_, 4)];
-}
-
-print '1..', scalar @tests, "\n";
-
-$SIG{__WARN__} = sub {
- if ($_[0] =~ /^Invalid conversion/) {
- $w = ' INVALID';
- } elsif ($_[0] =~ /^Use of uninitialized value/) {
- $w = ' UNINIT';
- } else {
- warn @_;
- }
-};
-
my $Is_VMS_VAX = 0;
# We use HW_MODEL since ARCH_NAME was not in VMS V5.*
if ($^O eq 'VMS') {
# No %Config.
my $Is_Ultrix_VAX = $^O eq 'ultrix' && `uname -m` =~ /^VAX$/;
-for ($i = 1; @tests; $i++) {
- ($template, $data, $result, $comment) = @{shift @tests};
+while (<DATA>) {
+ s/^\s*>//; s/<\s*$//;
+ ($template, $data, $result, $comment) = split(/<\s*>/, $_, 4);
if ($^O eq 'os390' || $^O eq 's390') { # non-IEEE (s390 is UTS)
$data =~ s/([eE])96$/${1}63/; # smaller exponents
$result =~ s/([eE]\+)102$/${1}69/; # " "
$data =~ s/([eE])\-101$/${1}-24/; # larger exponents
$result =~ s/([eE])\-102$/${1}-25/; # " "
}
+
$evalData = eval $data;
+ $data = ref $evalData ? $evalData : [$evalData];
+ push @tests, [$template, $data, $result, $comment];
+}
+
+print '1..', scalar @tests, "\n";
+
+$SIG{__WARN__} = sub {
+ if ($_[0] =~ /^Invalid conversion/) {
+ $w = ' INVALID';
+ } elsif ($_[0] =~ /^Use of uninitialized value/) {
+ $w = ' UNINIT';
+ } else {
+ warn @_;
+ }
+};
+
+for ($i = 1; @tests; $i++) {
+ ($template, $data, $result, $comment) = @{shift @tests};
$w = undef;
- $x = sprintf(">$template<",
- defined @$evalData ? @$evalData : $evalData);
+ $x = sprintf(">$template<", @$data);
substr($x, -1, 0) = $w if $w;
# $x may have 3 exponent digits, not 2
my $y = $x;
>%+vd< >chr(1)< >+1<
>%#vd< >chr(1)< >1<
>%vd< >"\01\02\03"< >1.2.3<
+>%vd< >v1.2.3< >1.2.3<
+>%vd< >[version::qv("1.2.3")]< >1.2.3<
+>%vd< >[version->new("1.2")]< >1.200<
+>%vd< >[version->new("1.02")]< >1.20<
+>%vd< >[version->new("1.002")]< >1.2<
+>%vd< >[version->new("1048576.5")]< >1048576.500<
+>%vd< >[version->new("50")]< >50.0<
>%v.3d< >"\01\02\03"< >001.002.003<
>%0v3d< >"\01\02\03"< >001.002.003<
+>%v.3d< >[version::qv("1.2.3")]< >001.002.003<
>%-v3d< >"\01\02\03"< >1 .2 .3 <
>%+-v3d< >"\01\02\03"< >+1 .2 .3 <
+>%+-v3d< >[version::qv("1.2.3")]< >+1 .2 .3 <
>%v4.3d< >"\01\02\03"< > 001. 002. 003<
>%0v4.3d< >"\01\02\03"< >0001.0002.0003<
>%0*v2d< >['-', "\0\7\14"]< >00-07-12<
>%v*.*d< >["\01\02\03", 4, 3]< > 001. 002. 003<
>%0v*.*d< >["\01\02\03", 4, 3]< >0001.0002.0003<
>%0*v*d< >['-', "\0\7\13", 2]< >00-07-11<
+>%0*v*d< >['-', version::qv("0.7.11"), 2]< >00-07-11<
>%e< >1234.875< >1.234875e+03<
>%e< >0.000012345< >1.234500e-05<
>%e< >1234567E96< >1.234567e+102<
>%-010x< >2**32-1< >ffffffff <
>%0-10x< >2**32-1< >ffffffff <
>%0*x< >[-10, ,2**32-1]< >ffffffff <
+>%vx< >[version::qv("1.2.3")]< >1.2.3<
+>%vx< >[version::qv("1.20.300")]< >1.14.12c<
>%y< >''< >%y INVALID<
>%z< >''< >%z INVALID<
>%2$d %1$d< >[12, 34]< >34 12<
>%#b< >0< >0<
>%#o< >0< >0<
>%#x< >0< >0<
->%2918905856$v2d< >''< ><
->%*2918905856$v2d< >''< > UNINIT<
+>%2147483647$v2d< >''< ><
+>%*2147483647$v2d< >''< > UNINIT<