Change 15226 by jhi@alpha on 2002/03/14 15:12:19

        Subject: [PATCH] Better patch for Benchmark.t and arith.t
        From: [EMAIL PROTECTED]
        Date: Tue, 12 Mar 02 19:22 est   
        Message-Id: <[EMAIL PROTECTED]>

Affected files ...

.... //depot/perl/lib/Benchmark.t#8 edit
.... //depot/perl/t/op/arith.t#15 edit

Differences ...

==== //depot/perl/lib/Benchmark.t#8 (text) ====
Index: perl/lib/Benchmark.t
--- perl/lib/Benchmark.t.~1~    Thu Mar 14 08:15:05 2002
+++ perl/lib/Benchmark.t        Thu Mar 14 08:15:05 2002
@@ -319,7 +319,7 @@
 {
     select(OUT);
     my $start = times;
-    my $chart = cmpthese( -0.1, { a => "++\$i", b => "\$i *= 2" } ) ;
+    my $chart = cmpthese( -0.1, { a => "++\$i", b => "\$i = sqrt(\$i++)" } ) ;
     my $end = times;
     select(STDOUT);
     ok (($end - $start) > 0.05, "benchmarked code ran for over 0.05 seconds");

==== //depot/perl/t/op/arith.t#15 (xtext) ====
Index: perl/t/op/arith.t
--- perl/t/op/arith.t.~1~       Thu Mar 14 08:15:05 2002
+++ perl/t/op/arith.t   Thu Mar 14 08:15:05 2002
@@ -1,6 +1,11 @@
 #!./perl -w
 
-print "1..133\n";
+BEGIN {
+    chdir 't' if -d 't';
+    @INC = '../lib';
+}
+
+print "1..134\n";
 
 sub try ($$) {
    print +($_[1] ? "ok" : "not ok"), " $_[0]\n";
@@ -269,3 +274,25 @@
   my $t1000 = time() * 1000;
   try 133, abs($t1000 -1000 * $t) <= 2000;
 }
+
+if ($^O eq 'vos') {
+  print "not ok 134 # TODO VOS raises SIGFPE instead of producing infinity.\n";
+} else {
+  # The computation of $v should overflow and produce "infinity"
+  # on any system whose max exponent is less than 10**1506.
+  # The exact string used to represent infinity varies by OS,
+  # so we don't test for it; all we care is that we don't die.
+  #
+  # Perl considers it to be an error if SIGFPE is raised.
+  # Chances are the interpreter will die, since it doesn't set
+  # up a handler for SIGFPE.  That's why this test is last; to
+  # minimize the number of test failures.  --PG
+
+  my $n = 5000;
+  my $v = 2;
+  while (--$n)
+  {
+    $v *= 2;
+  }
+  print "ok 134\n";
+}
End of Patch.

Reply via email to