core.t (PDL-2.075) | : | core.t (PDL-2.076) | ||
---|---|---|---|---|
skipping to change at line 276 | skipping to change at line 276 | |||
my $null = null; | my $null = null; | |||
is $null->info, 'PDL->null', "null ndarray's info is 'PDL->null'"; | is $null->info, 'PDL->null', "null ndarray's info is 'PDL->null'"; | |||
my $mt_info = $empty->info; | my $mt_info = $empty->info; | |||
$mt_info =~m/\[([\d,]+)\]/; | $mt_info =~m/\[([\d,]+)\]/; | |||
my $mt_info_dims = pdl("$1"); | my $mt_info_dims = pdl("$1"); | |||
ok(any($mt_info_dims==0), "empty ndarray's info contains a 0 dimension"); | ok(any($mt_info_dims==0), "empty ndarray's info contains a 0 dimension"); | |||
ok($null->isnull, "a null ndarray is null"); | ok($null->isnull, "a null ndarray is null"); | |||
ok($null->isempty, "a null ndarray is empty") or diag $null->info; | ok($null->isempty, "a null ndarray is empty") or diag $null->info; | |||
ok(!$empty->isnull, "an empty ndarray is not null"); | ok(!$empty->isnull, "an empty ndarray is not null"); | |||
ok($empty->isempty, "an empty ndarray is empty"); | ok($empty->isempty, "an empty ndarray is empty"); | |||
eval { $null->long }; | ||||
like $@, qr/null/, 'null->long gives right error'; | ||||
$x = short pdl(3,4,5,6); | $x = short pdl(3,4,5,6); | |||
eval { $x->reshape(2,2);}; | eval { $x->reshape(2,2);}; | |||
is($@, '', "reshape succeeded in the normal case"); | is($@, '', "reshape succeeded in the normal case"); | |||
ok( ( $x->ndims==2 and $x->dim(0)==2 and $x->dim(1)==2 ), "reshape did the right thing"); | ok( ( $x->ndims==2 and $x->dim(0)==2 and $x->dim(1)==2 ), "reshape did the right thing"); | |||
ok(all($x == short pdl([[3,4],[5,6]])), "reshape moved the elements to the right place"); | ok(all($x == short pdl([[3,4],[5,6]])), "reshape moved the elements to the right place"); | |||
$y = $x->slice(":,:"); | $y = $x->slice(":,:"); | |||
eval { $y->reshape(4); }; | eval { $y->reshape(4); }; | |||
ok( $@ !~ m/Can\'t/, "reshape doesn't fail on a PDL with a parent" ); | ok( $@ !~ m/Can\'t/, "reshape doesn't fail on a PDL with a parent" ); | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 2 lines changed or added |