The following test code may be a bit hard to follow. We're basically trying to ensure that
my @vals = ( ... );
my $got = { data => long( @vals ) };
my $expected = { data => test_long( @vals ) };
cmp_deeply $got, $expected;
passes for every conceivable type of ndarray (not only long), and for different sets of values @vals, some of which may contain bad values. We also test that
{ data => test_long( @vals ) }
{ data => test_pdl( long(@vals) ) }
{ data => code( sub { eq_pdl shift, long(@vals) } ) }
yield the same results.