summaryrefslogtreecommitdiff
path: root/lib/Benchmark.t
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2002-04-13 22:43:04 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2002-04-13 19:58:15 +0000
commit23c50b2317bf99c4b3f1bb9cbebbbab2199fd11a (patch)
tree5fb1de4c6732811aa7da272b16a3258d83e6883d /lib/Benchmark.t
parent046f36bf3704c511ef3805d7e85e91c163efa516 (diff)
downloadperl-23c50b2317bf99c4b3f1bb9cbebbbab2199fd11a.tar.gz
Benchmark.t 75,90,109
Message-ID: <20020413204303.GB12835@Bagpuss.unfortu.net> p4raw-id: //depot/perl@15897
Diffstat (limited to 'lib/Benchmark.t')
-rw-r--r--lib/Benchmark.t67
1 files changed, 45 insertions, 22 deletions
diff --git a/lib/Benchmark.t b/lib/Benchmark.t
index 53d4efcb67..a12ae6ed28 100644
--- a/lib/Benchmark.t
+++ b/lib/Benchmark.t
@@ -252,10 +252,15 @@ sub check_graph_consistency {
$slowr, $slowratet, $slowslow, $slowfastt,
$fastr, $fastratet, $fastslowt, $fastfast)
= @_;
- is ($slowc, $slowr, "left col tag should be top row tag");
- is ($fastc, $fastr, "right col tag should be bottom row tag");
- like ($slowslow, qr/^-+/, "should be dash for comparing slow with slow");
- is ($slowslow, $fastfast, "slow v slow should be same as fast v fast");
+ my $all_passed = 1;
+ $all_passed
+ &= is ($slowc, $slowr, "left col tag should be top row tag");
+ $all_passed
+ &= is ($fastc, $fastr, "right col tag should be bottom row tag");
+ $all_passed &=
+ like ($slowslow, qr/^-+/, "should be dash for comparing slow with slow");
+ $all_passed
+ &= is ($slowslow, $fastfast, "slow v slow should be same as fast v fast");
my $slowrate = $slowratet;
my $fastrate = $fastratet;
my ($slow_is_rate, $fast_is_rate);
@@ -268,28 +273,40 @@ sub check_graph_consistency {
$fastrate = 1/$fastrate if $fastrate;
}
if ($ratetext =~ /rate/i) {
- ok ($slow_is_rate, "slow should be expressed as a rate");
- ok ($fast_is_rate, "fast should be expressed as a rate");
+ $all_passed
+ &= ok ($slow_is_rate, "slow should be expressed as a rate");
+ $all_passed
+ &= ok ($fast_is_rate, "fast should be expressed as a rate");
} else {
- ok (!$slow_is_rate, "slow should be expressed as a iters per second");
- ok (!$fast_is_rate, "fast should be expressed as a iters per second");
+ $all_passed &=
+ ok (!$slow_is_rate, "slow should be expressed as a iters per second");
+ $all_passed &=
+ ok (!$fast_is_rate, "fast should be expressed as a iters per second");
}
(my $slowfast = $slowfastt) =~ s!%!!;
(my $fastslow = $fastslowt) =~ s!%!!;
if ($slowrate < $fastrate) {
pass ("slow rate is less than fast rate");
- ok ($slowfast < 0 && $slowfast > -100,
- "slowfast should be less than zero, and > -100") ||
+ unless (ok ($slowfast < 0 && $slowfast >= -100,
+ "slowfast should be less than zero, and >= -100")) {
print STDERR "# slowfast $slowfast\n";
- ok ($fastslow > 0, "fastslow should be > 0") ||
+ $all_passed = 0;
+ }
+ unless (ok ($fastslow > 0, "fastslow should be > 0")) {
print STDERR "# fastslow $fastslow\n";
+ $all_passed = 0;
+ }
} else {
- is ($slowrate, $fastrate,
- "slow rate isn't less than fast rate, so should be the same");
- is ($slowfast, 0, "slowfast should be zero");
- is ($fastslow, 0, "fastslow should be zero");
+ $all_passed
+ &= is ($slowrate, $fastrate,
+ "slow rate isn't less than fast rate, so should be the same");
+ $all_passed
+ &= is ($slowfast, 0, "slowfast should be zero");
+ $all_passed
+ &= is ($fastslow, 0, "fastslow should be zero");
}
+ return $all_passed;
}
sub check_graph_vs_output {
@@ -298,13 +315,19 @@ sub check_graph_vs_output {
$slowr, $slowratet, $slowslow, $slowfastt,
$fastr, $fastratet, $fastslowt, $fastfast)
= $got =~ $graph_dissassembly;
- check_graph_consistency ( $ratetext, $slowc, $fastc,
- $slowr, $slowratet, $slowslow, $slowfastt,
- $fastr, $fastratet, $fastslowt, $fastfast);
- is_deeply ($chart, [['', $ratetext, $slowc, $fastc],
- [$slowr, $slowratet, $slowslow, $slowfastt],
- [$fastr, $fastratet, $fastslowt, $fastfast]],
- "check the chart layout matches the formatted output");
+ my $all_passed
+ = check_graph_consistency ( $ratetext, $slowc, $fastc,
+ $slowr, $slowratet, $slowslow, $slowfastt,
+ $fastr, $fastratet, $fastslowt, $fastfast);
+ $all_passed
+ &= is_deeply ($chart, [['', $ratetext, $slowc, $fastc],
+ [$slowr, $slowratet, $slowslow, $slowfastt],
+ [$fastr, $fastratet, $fastslowt, $fastfast]],
+ "check the chart layout matches the formatted output");
+ unless ($all_passed) {
+ print STDERR "# Something went wrong there. I got this chart:\n";
+ print STDERR "# $_\n" foreach split /\n/, $got;
+ }
}
sub check_graph {