Skip to content

Commit

Permalink
move some behaviour tests from pptest.t (slow) to core.t
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Feb 19, 2024
1 parent 20153ed commit a2eb40e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 46 deletions.
46 changes: 0 additions & 46 deletions t/01-pptest.t
Original file line number Diff line number Diff line change
Expand Up @@ -81,34 +81,13 @@ pp_def(
$b() = tmp;'
);
# test to set named dim with 'OtherPar'
pp_def('setdim',
Pars => '[o] a(n)',
OtherPars => 'int ns => n',
Code => 'loop(n) %{ $a() = n; %}',
);
pp_def("gelsd",
Pars => '[io,phys]A(m,n); [io,phys]B(p,q); [phys]rcond(); [o,phys]s(r); int [o,phys]rank();int [o,phys]info()',
RedoDimsCode => '$SIZE(r) = PDLMIN($SIZE(m),$SIZE(n));',
GenericTypes => ['F'],
Code => '$CROAK("croaking");'
);
pp_def('fooseg',
Pars => 'a(n); [o]b(n);',
Code => '
loop(n) %{ $b() = $a(); %}
');
# adapted from PDL::NDBin: if in=null and b is a scalar, was SEGV-ing
pp_def( '_flatten_into',
Pars => "in(m); indx b(m); [o] idx(m)",
Code => '
loop(m) %{ $idx() = $in(); %}
',
);
pp_def( 'broadcastloop_continue',
Pars => 'in(); [o] out()',
Code => q[
Expand Down Expand Up @@ -156,12 +135,6 @@ pp_add_boot pp_line_numbers(__LINE__, q{
/* nothing happening here */
});
# test fixed value for named dim, wrong Code for simplicity
pp_def('Cpow',
Pars => 'a(m=2); b(m=2); [o]c(m=2)',
Code => '$c(m => 0) = $a(m => 0) + $b(m => 0);',
);
# test XS args with OtherPars
pp_def('gl_arrows',
Pars => 'coords(tri=3,n); int indsa(); int indsb();',
Expand Down Expand Up @@ -445,10 +418,6 @@ for (byte,short,ushort,long,float,double) {
is( $y->at, 3000 );
}
setdim(($x=null),10);
is( join(',',$x->dims), "10" );
ok( tapprox($x,sequence(10)) );
{
my @msg;
local $SIG{__WARN__} = sub { push @msg, @_ };
Expand All @@ -457,19 +426,6 @@ like $@, qr/croaking/, 'right error message';
is_deeply \@msg, [], 'no warnings' or diag explain \@msg;
}
# this used to segv under solaris according to Karl
{
my $ny=7;
$x = double xvals zeroes (20,$ny);
fooseg $x, $y=null;
ok( 1 ); # if we get here at all that is alright
ok( tapprox($x,$y) )
or diag($x, "\n", $y);
}
eval { _flatten_into(null, 2) };
ok 1; #was also segfaulting
# test that continues in a broadcastloop work
{
my $in = sequence(10);
Expand All @@ -484,8 +440,6 @@ ok 1; #was also segfaulting
or do { diag "got : $got"; diag "expected: $exp" };
}
Cpow(sequence(2), 1);
polyfill_pp(zeroes(5,5), ones(2,3), 1);
eval { polyfill_pp(ones(2,3), 1) };
like $@, qr/Usage/;
Expand Down
9 changes: 9 additions & 0 deletions t/core.t
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ is $@, '', 'can "squeeze" an empty';
eval {empty->copy->make_physical};
is $@, '', 'can physicalise the copy of an empty';

# capture ancient pptest.t test for Solaris segfault
ok all(tapprox(norm(pdl 3,4), pdl(0.6,0.8))), 'vector quasi-copy works';
# pptest for null input
eval {(my $tmp=null) .= null}; like $@, qr/input.*null/;
# pptest for OtherPars=>named dim
ok all(tapprox((5*sequence(5))->maximum_n_ind(3), pdl(4,3,2))), 'named dim';
# pptest for dim with fixed value
ok all(tapprox(crossp([1..3],[4..6]), pdl(-3,6,-3))), 'named dim=3';

# test topdl

{ package # hide from PAUSE
Expand Down

0 comments on commit a2eb40e

Please sign in to comment.