#358 one2nd() has unexpected behaviour when given a Perl scalar rather than a piddle

critical
closed
None
1
2014-08-25
2014-08-13
Zakariyya Mughal
No

This may be one bug against a larger classes of bugs where topdl() should be
used more often for POLA.

I see the following behaviour if the $indices argument is not a piddle:

use PDL;
use Test::Most tests => 2;

my $t = sequence(3,3);

my $flatidx = 6;
is( ref [ $t->one2nd(pdl($flatidx)) ]->[0], 'PDL', 'passing in $indices as a piddle works as expected' );
is( ref [ $t->one2nd($flatidx) ]->[0], 'PDL', 'passing in a perl scalar makes the first item in the list a simple Perl scalar (not an array of 1-element piddles)' );

done_testing;

Cheers,
- zaki

Discussion

  • This appears to have been fixed in bb5774. Sorry for the noise.

    The tests above could still be used for regression testing.

     
  • Chris Marshall
    Chris Marshall
    2014-08-25

    • status: open --> closed
    • assigned_to: Chris Marshall
     
  • Chris Marshall
    Chris Marshall
    2014-08-25

    The test passes for current PDL git on master. Closing the ticket. The fix will be available in the next release of PDL (or one of the current git snapshot releases).

     
  • Chris Marshall
    Chris Marshall
    2014-08-25

    The standard test framework for PDL is using Test::More. It simplifies things if your test code uses that module. Thanks.

     
    • The tests should work with Test::More. I just use Test::Most out of
      habit. I'll keep that in mind for my future PDL contributions.

      Cheers,
      - Zaki Mughal