Upgrade to Tie::File 0.20.
[p5sagit/p5-mst-13.2.git] / t / op / ver.t
index f64cf47..4f79acf 100755 (executable)
@@ -2,17 +2,16 @@
 
 BEGIN {
     chdir 't' if -d 't';
-    @INC = '../lib';
+    @INC = qw(. ../lib);
     $SIG{'__WARN__'} = sub { warn $_[0] if $DOWARN };
 }
 
 $DOWARN = 1; # enable run-time warnings now
 
 use Config;
-$tests = $Config{'uvsize'} == 8 ? 47 : 44;
 
-require Test::More;
-Test::More->import( tests => $tests );
+require "test.pl";
+plan( tests => 47 );
 
 eval { use v5.5.640; };
 is( $@, '', "use v5.5.640; $@");
@@ -32,7 +31,7 @@ else { # EBCDIC
 
     # hash keys too
     $h{v150.146} = "ok";
-    is('ok',$h{v111.107},'ASCII hash keys');
+    is('ok',$h{v150.146},'EBCDIC hash keys');
 }
 
 # poetry optimization should also
@@ -191,7 +190,7 @@ SKIP: {
     my $ip   = v2004.148.0.1;
     my $host;
     eval { $host = gethostbyaddr($ip,Socket::AF_INET) };
-    ok($@ =~ /Wide character/,"Non-bytes leak to gethostbyaddr");
+    like($@, qr/Wide character/, "Non-bytes leak to gethostbyaddr");
 }
 
 # Chapter 28, pp671
@@ -208,21 +207,30 @@ my ($revision,$version,$subversion) = split '\.', sprintf("%vd",$^V);
 
 my $v = sprintf("%d.%.3d%.3d",$revision,$version,$subversion);
 
-ok( $v eq "$]", "\$^V eq \$] (string)");
+ok( $v eq "$]", qq{"\$^V eq "\$]"});
 
 $v = $revision + $version/1000 + $subversion/1000000;
 
 ok( $v == $], "\$^V == \$] (numeric)" );
 
-# [ID 20010902.001] check if v-strings handle full UV range or not
-if ( $Config{'uvsize'} >= 4 ) {
-    is(  sprintf("%vd", v2147483647.2147483648),   '2147483647.2147483648', 'v-string > IV_MAX[32-bit]' );
-    is(  sprintf("%vd", v3141592653),              '3141592653',            'IV_MAX < v-string < UV_MAX[32-bit]');
-    is(  sprintf("%vd", v4294967295),              '4294967295',            'v-string == UV_MAX[32-bit] - 1');
-}
-
-if ( $Config{'uvsize'} >= 8 ) {
-    is(  sprintf("%vd", v9223372036854775807.9223372036854775808),   '9223372036854775807.9223372036854775808', 'v-string > IV_MAX[64-bit]' );
-    is(  sprintf("%vd", v17446744073709551615),                      '17446744073709551615',                    'IV_MAX < v-string < UV_MAX[64-bit]');
-    is(  sprintf("%vd", v18446744073709551615),                      '18446744073709551615',                    'v-string == UV_MAX[64-bit] - 1');
+SKIP: {
+  skip("In EBCDIC the v-string components cannot exceed 2147483647", 6)
+    if ord "A" == 193;
+
+  # [ID 20010902.001] check if v-strings handle full UV range or not
+  if ( $Config{'uvsize'} >= 4 ) {
+    is(  sprintf("%vd", eval 'v2147483647.2147483648'),   '2147483647.2147483648', 'v-string > IV_MAX[32-bit]' );
+    is(  sprintf("%vd", eval 'v3141592653'),              '3141592653',            'IV_MAX < v-string < UV_MAX[32-bit]');
+    is(  sprintf("%vd", eval 'v4294967295'),              '4294967295',            'v-string == UV_MAX[32-bit] - 1');
+  }
+
+  SKIP: {
+    skip("No quads", 3) if $Config{uvsize} < 8;
+
+    if ( $Config{'uvsize'} >= 8 ) {
+      is(  sprintf("%vd", eval 'v9223372036854775807.9223372036854775808'),   '9223372036854775807.9223372036854775808', 'v-string > IV_MAX[64-bit]' );
+      is(  sprintf("%vd", eval 'v17446744073709551615'),                      '17446744073709551615',                    'IV_MAX < v-string < UV_MAX[64-bit]');
+      is(  sprintf("%vd", eval 'v18446744073709551615'),                      '18446744073709551615',                    'v-string == UV_MAX[64-bit] - 1');
+    }
+  }
 }