Skip to content

Commit

Permalink
use Test::PDL, rename t/func.pdl
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Jan 5, 2025
1 parent f749564 commit 318f023
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ script/pptemplate
t/00-report-prereqs.t
t/01-pptest.t
t/autoload.t
t/autoload_func.pdl
t/bad.t
t/basic.t
t/bigmem.t
Expand All @@ -197,7 +198,6 @@ t/fits.t
t/flexraw-iotypes.t
t/flexraw.t
t/flexraw_fortran.t
t/func.pdl
t/func.t
t/image2d.t
t/imagend.t
Expand Down
7 changes: 3 additions & 4 deletions t/autoload.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ use warnings;
use Test::More;
use PDL::LiteF;
use PDL::NiceSlice;
use Test::PDL;

plan skip_all => 'This test must be run from t/..' if !-f 't/func.pdl';
plan skip_all => 'This test must be run from t/..' if !-f 't/autoload_func.pdl';

use_ok('PDL::AutoLoader');

Expand All @@ -15,9 +16,7 @@ our @PDLLIB = ("./t"); # this means you have to run the test from t/..

my $x = long(2 + ones(2,2));

my $y = func($x);

ok approx(sum($y), 4*29), 'Check autoload of func.pdl' or diag "got=$y";
is_pdl autoload_func($x), pdl('29 29; 29 29'), 'autoloaded func worked';
{ no warnings 'once';
is $::GLOBAL_VAR, '$'.'COMP(max_it)', "NiceSlice didn't mangle text";
}
Expand Down
2 changes: 1 addition & 1 deletion t/func.pdl → t/autoload_func.pdl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Test file for autoloader.t

no PDL::NiceSlice;
sub func {
sub autoload_func {
my $x = shift;
$::GLOBAL_VAR = '$COMP(max_it)';
return ($x**3 + 2);
Expand Down

0 comments on commit 318f023

Please sign in to comment.