From dedd7d667d543d0f08f1918e9471364bdf3b1a8f Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Tue, 17 Oct 2006 16:22:17 +0000 Subject: [PATCH] Skip over sibling tests on TEST_BAD. --- lib/ZOOM/IRSpy.pm | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/lib/ZOOM/IRSpy.pm b/lib/ZOOM/IRSpy.pm index 595d427..cd1702c 100644 --- a/lib/ZOOM/IRSpy.pm +++ b/lib/ZOOM/IRSpy.pm @@ -1,4 +1,4 @@ -# $Id: IRSpy.pm,v 1.32 2006-10-17 15:46:30 mike Exp $ +# $Id: IRSpy.pm,v 1.33 2006-10-17 16:22:17 mike Exp $ package ZOOM::IRSpy; @@ -409,9 +409,13 @@ sub check { $conn->current_task(0); $conn->next_task(0); if ($res == ZOOM::IRSpy::Status::TEST_BAD) { - ### Should skip over remaining sibling tests if TEST_BAD - ### Should count the number of skipped siblings - $nskipped += 1; + my $address = $conn->option('current_test_address'); + ($address, my $n) = $this->_last_sibling_test($address); + if (defined $address) { + $conn->log("irspy_test", "skipped $n tests"); + $conn->option(current_test_address => $address); + $nskipped += $n; + } } } } @@ -450,6 +454,7 @@ sub _gather_tests { } +# These next three should arguably be Node methods sub _next_test { my $this = shift(); my($address, $omit_child) = @_; @@ -474,6 +479,38 @@ sub _next_test { } +sub _last_sibling_test { + my $this = shift(); + my($address) = @_; + + return undef + if !defined $this->_next_sibling_test($address); + + my $nskipped = 0; + while (1) { + my $maybe = $this->_next_sibling_test($address); + last if !defined $maybe; + $nskipped++; + $this->log("irspy", "skipping $nskipped = '$address'"); + $address = $maybe; + } + + return ($address, $nskipped); +} + + +sub _next_sibling_test { + my $this = shift(); + my($address) = @_; + + my @components = split /:/, $address; + my $last = pop @components; + my $maybe = join(":", @components, $last+1); + return $maybe if $this->{tree}->select($maybe); + return undef; +} + + =head1 SEE ALSO ZOOM::IRSpy::Record, -- 1.7.10.4