Navigation Menu

Skip to content

Commit

Permalink
t/image2d.t: skip tests if no bad value support
Browse files Browse the repository at this point in the history
  • Loading branch information
zmughal committed May 26, 2015
1 parent e5b309c commit ca86c7d
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions t/image2d.t
Expand Up @@ -30,15 +30,15 @@ ok all approx( $pc, $ans ); # 1

{
# conv2d
my $pa = zeroes(3,3);
my $pa = zeroes(3,3);
$pa->set(1,1,1);
my $pb = sequence(3,3);
ok all approx( conv2d($pa,$pb), $pb ); # 2
}

{
# conv2d: boundary => reflect
my $pa = ones(3,3);
my $pa = ones(3,3);
my $pb = sequence(3,3);
{
my $ans = pdl ([12,18,24],[30,36,42],[48,54,60]);
Expand Down Expand Up @@ -93,18 +93,20 @@ my $mask = zeroes(5,5);
$mask->set(2,2,1);
ok all approx( patch2d($pa,$mask), $pa ); # 6

# note:
# note:
# with no bad values, any bad pixel which has no good neighbours
# has its value copied
#
#
my $m = $mask->slice('1:3,1:3');
$m .= 1;
my $ans = $pa->copy;
note $pa, $mask, patch2d($pa,$mask);
ok all approx( patch2d($pa,$mask), $ans ); # 7
}

if ( $PDL::Bad::Status ) {
SKIP: {
skip "PDL::Bad support not available.", 5 unless $PDL::Bad::Status;

my $pa = ones(5,5);
# patchbad2d: bad data
my $m = $pa->slice('1:3,1:3');
Expand Down Expand Up @@ -136,9 +138,6 @@ if ( $PDL::Bad::Status ) {
@ans = $pa->centroid2d( 10, 10, 20 );
ok all approx( $ans[0], 8.432946 ); # numbers should be same as when set < 9 to 0
ok all approx( $ans[1], 11.756724 );

} else {
skip "PDL::Bad support not available.", 5;
}

{
Expand Down

0 comments on commit ca86c7d

Please sign in to comment.