constructor.t (PDL-2.078) | : | constructor.t (PDL-2.079) | ||
---|---|---|---|---|

skipping to change at line 156 | skipping to change at line 156 | |||

############################## | ############################## | |||

# test empty PDLs. | # test empty PDLs. | |||

$p = pdl($pdl_e); | $p = pdl($pdl_e); | |||

is $p->nelem, 0, "piddlifying an empty ndarray yields 0 elements"; | is $p->nelem, 0, "piddlifying an empty ndarray yields 0 elements"; | |||

$p = pdl($pdl_e, $pdl_e); | $p = pdl($pdl_e, $pdl_e); | |||

is $p->ndims, 2, "piddlifying two 0-PDLs makes a 2D-PDL"; | is $p->ndims, 2, "piddlifying two 0-PDLs makes a 2D-PDL"; | |||

is $p->dim(0),0, "piddlifying two empty ndarrays makes a 0x2-PDL"; | is $p->dim(0),0, "piddlifying two empty ndarrays makes a 0x2-PDL"; | |||

is $p->dim(1),2, "piddlifying two empty ndarrays makes a 0x2-PDL"; | is $p->dim(1),2, "piddlifying two empty ndarrays makes a 0x2-PDL"; | |||

eval { $p->at(0,0) }; | eval { $p->at(0,0) }; | |||

like $@, qr/^Position\s*\d+\s*out of range/, "can't index an empty PDL with at"; | like $@, qr/^Position.*out of range/, "can't index an empty PDL with at"; | |||

$p = pdl(pdl([4]),5); | $p = pdl(pdl([4]),5); | |||

is $p->ndims, 2, "catenating a 1-PDL and a scalar yields a 2D PDL"; | is $p->ndims, 2, "catenating a 1-PDL and a scalar yields a 2D PDL"; | |||

is $p->dim(0), 1, "catenating a 1-PDL and a scalar yields a 1x2-PDL"; | is $p->dim(0), 1, "catenating a 1-PDL and a scalar yields a 1x2-PDL"; | |||

is $p->dim(1), 2, "catenating a 1-PDL and a scalar yields a 1x2-PDL"; | is $p->dim(1), 2, "catenating a 1-PDL and a scalar yields a 1x2-PDL"; | |||

is $p->at(0,0), 4, "catenating a 1-PDL and a scalar does the Right Thing"; | is $p->at(0,0), 4, "catenating a 1-PDL and a scalar does the Right Thing"; | |||

is $p->at(0,1), 5, "catenating a 1-PDL and a scalar does the Right Thing, redux" ; | is $p->at(0,1), 5, "catenating a 1-PDL and a scalar does the Right Thing, redux" ; | |||

$p = pdl($pdl_e, 5); | $p = pdl($pdl_e, 5); | |||

is $p->ndims, 2, "catenating an empty and a scalar yields a 2D PDL"; | is $p->ndims, 2, "catenating an empty and a scalar yields a 2D PDL"; | |||

End of changes. 1 change blocks. | ||||

1 lines changed or deleted | | 1 lines changed or added |