bad.t (PDL-2.077) | : | bad.t (PDL-2.078) | ||
---|---|---|---|---|
skipping to change at line 173 | skipping to change at line 173 | |||
$x = pdl( qw(42 47 98 13 22 96 74 41 79 76 96 3 32 76 25 59 5 96 32 6) ); | $x = pdl( qw(42 47 98 13 22 96 74 41 79 76 96 3 32 76 25 59 5 96 32 6) ); | |||
$y = $x->setbadif( $x < 20 ); | $y = $x->setbadif( $x < 20 ); | |||
my @s = $y->stats(); | my @s = $y->stats(); | |||
ok( approx( $s[0], 61.9375, ABSTOL ), "setbadif/stats test 1" ); | ok( approx( $s[0], 61.9375, ABSTOL ), "setbadif/stats test 1" ); | |||
ok( approx( $s[1], 27.6079, ABSTOL ), "setbadif/stats test 2" ); | ok( approx( $s[1], 27.6079, ABSTOL ), "setbadif/stats test 2" ); | |||
is( $s[2], 66.5, "setbadif/stats test 3" ); | is( $s[2], 66.5, "setbadif/stats test 3" ); | |||
is( $s[3], 22, "setbadif/stats test 4" ); | is( $s[3], 22, "setbadif/stats test 4" ); | |||
is( $s[4], 98, "setbadif/stats test 5" ); | is( $s[4], 98, "setbadif/stats test 5" ); | |||
ok( approx( $s[6], 26.7312, ABSTOL ), "setbadif/stats test 6" ); | ok( approx( $s[6], 26.7312, ABSTOL ), "setbadif/stats test 6" ); | |||
# how about setbadtoval (was replacebad) | # how about setbadtoval | |||
empty()->setbadtoval(20); # shouldn't segfault | ||||
$x = $y->setbadtoval(20) - pdl(qw(42 47 98 20 22 96 74 41 79 76 96 20 32 76 25 5 9 20 96 32 20)); | $x = $y->setbadtoval(20) - pdl(qw(42 47 98 20 22 96 74 41 79 76 96 20 32 76 25 5 9 20 96 32 20)); | |||
ok( all($x == 0), "setbadtoval() worked" ); | ok( all($x == 0), "setbadtoval() worked" ); | |||
# and inplace? | # and inplace? | |||
$x = pdl( qw(42 47 98 13 22 96 74 41 79 76 96 3 32 76 25 59 5 96 32 6) ); | $x = pdl( qw(42 47 98 13 22 96 74 41 79 76 96 3 32 76 25 59 5 96 32 6) ); | |||
$y = $x->setbadif( $x < 20 ); | $y = $x->setbadif( $x < 20 ); | |||
$y->inplace->setbadtoval(20); | $y->inplace->setbadtoval(20); | |||
$x = $y - pdl(qw(42 47 98 20 22 96 74 41 79 76 96 20 32 76 25 59 20 96 32 20)); | $x = $y - pdl(qw(42 47 98 20 22 96 74 41 79 76 96 20 32 76 25 59 20 96 32 20)); | |||
ok( all($x == 0), " and inplace" ); | ok( all($x == 0), " and inplace" ); | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added |