"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "t/core.t" between
PDL-2.076.tar.gz and PDL-2.077.tar.gz

About: PDL (Perl Data Language) aims to turn perl into an efficient numerical language for scientific computing (similar to IDL and MatLab).

core.t  (PDL-2.076):core.t  (PDL-2.077)
skipping to change at line 19 skipping to change at line 19
sub tapprox ($$) { sub tapprox ($$) {
my ( $x, $y ) = @_; my ( $x, $y ) = @_;
my $d = abs( $x - $y ); my $d = abs( $x - $y );
return $d <= 0.0001; return $d <= 0.0001;
} }
for my $type (PDL::Types::types()) { for my $type (PDL::Types::types()) {
ok defined pdl($type, 0), "constructing PDL of type $type"; ok defined pdl($type, 0), "constructing PDL of type $type";
} }
is sequence(3,2)->dup(0, 2).'', '
[
[0 1 2 0 1 2]
[3 4 5 3 4 5]
]
', 'dup';
is sequence(3,2)->dupN(2, 3).'', '
[
[0 1 2 0 1 2]
[3 4 5 3 4 5]
[0 1 2 0 1 2]
[3 4 5 3 4 5]
[0 1 2 0 1 2]
[3 4 5 3 4 5]
]
', 'dupN';
my $a_long = sequence long, 10; my $a_long = sequence long, 10;
my $a_dbl = sequence 10; my $a_dbl = sequence 10;
my $b_long = $a_long->slice('5'); my $b_long = $a_long->slice('5');
my $b_dbl = $a_dbl->slice('5'); my $b_dbl = $a_dbl->slice('5');
my $c_long = $a_long->slice('4:7'); my $c_long = $a_long->slice('4:7');
my $c_dbl = $a_dbl->slice('4:7'); my $c_dbl = $a_dbl->slice('4:7');
# test 'sclr' method # test 'sclr' method
skipping to change at line 40 skipping to change at line 58
is $b_long->sclr, 5, "sclr test of 1-elem pdl (long)"; is $b_long->sclr, 5, "sclr test of 1-elem pdl (long)";
ok tapprox( $b_dbl->sclr, 5 ), "sclr test of 1-elem pdl (dbl)"; ok tapprox( $b_dbl->sclr, 5 ), "sclr test of 1-elem pdl (dbl)";
eval { $c_long->sclr }; eval { $c_long->sclr };
like $@, qr/multielement ndarray in 'sclr' call/, "sclr failed on multi-element ndarray (long)"; like $@, qr/multielement ndarray in 'sclr' call/, "sclr failed on multi-element ndarray (long)";
eval { $c_dbl->sclr }; eval { $c_dbl->sclr };
like $@, qr/multielement ndarray in 'sclr' call/, "sclr failed on multi-element ndarray (dbl)"; like $@, qr/multielement ndarray in 'sclr' call/, "sclr failed on multi-element ndarray (dbl)";
eval { zeroes(0)->max ? 1 : 0 };
like $@, qr/bad.*conditional/, 'badvalue as boolean is error';
# test reshape barfing with negative args # test reshape barfing with negative args
# #
eval 'my $d_long = $a_long->reshape(0,-3);'; eval 'my $d_long = $a_long->reshape(0,-3);';
like $@, qr/invalid dim size/, "reshape() failed with negative args (long)"; like $@, qr/invalid dim size/, "reshape() failed with negative args (long)";
eval 'my $d_dbl = $a_dbl->reshape(0,-3);'; eval 'my $d_dbl = $a_dbl->reshape(0,-3);';
like $@, qr/invalid dim size/, "reshape() failed with negative args (dbl)"; like $@, qr/invalid dim size/, "reshape() failed with negative args (dbl)";
# test reshape with no args # test reshape with no args
my ( $x, $y, $c ); my ( $x, $y, $c );
 End of changes. 2 change blocks. 
0 lines changed or deleted 21 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)