Skip to content

Commit

Permalink
skip tests in t/ica.t if Slatec/ICA can not be loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
zmughal committed Mar 4, 2015
1 parent 437682f commit 43a44b3
Showing 1 changed file with 51 additions and 33 deletions.
84 changes: 51 additions & 33 deletions t/ica.t
Expand Up @@ -3,37 +3,46 @@ use PDL::LiteF;

# TODO This file does not currently test anything beyond loading PDL::Slatec.

#use strict; # TODO fix the disabled code and enable strict
use strict; # TODO fix the disabled code and enable strict
use warnings;
use Test::More tests => 1;
use Test::More tests => 2;

our $HAVE_PDL_SLATEC = 0;
our $HAVE_PDL_ICA = 0;
BEGIN {

eval " use PDL::Slatec; ";
$loaded = ($@ ? 0 : 1);
eval " use PDL::ICA; ";
$loaded++ unless $@;
eval {
require PDL::Slatec;
$HAVE_PDL_SLATEC = 1;
};

eval {
require PDL::ICA;
$HAVE_PDL_ICA = 1;
};
}

SKIP: {
skip "Could not load PDL::Slatec", 1 unless $HAVE_PDL_SLATEC;
pass("PDL::Slatec loads");
}

SKIP: {
skip "Could not load PDL::ICA", 1 unless $HAVE_PDL_ICA;
pass("PDL::ICA loads");
}

# use PDL::Graphics::PG;
# dev "/XSERVE",2,2;

$|=1;

kill INT,$$ if $ENV{UNDER_DEBUGGER}; # Useful for debugging.
kill 'INT',$$ if $ENV{UNDER_DEBUGGER}; # Useful for debugging.

use Carp;

$SIG{__DIE__} = sub {print Carp::longmess(@_); die FOO;};
$SIG{__DIE__} = sub {print Carp::longmess(@_); die 'FOO';};

unless ($loaded) {
#print STDERR "PDL::Slatec not installed. Skipping all tests.\n";
for (1..1) {
print "ok $_ # Skipped: PDL::Slatec not available\n";
}
exit;
}
ok($loaded);

#DEFERRED

Expand All @@ -45,32 +54,39 @@ if(0) {

# Generate data: oblique lattice

$pars = pdl 2,3,4;
$rot = PDL::LinICA::_cayleygen({NVars=>3},$pars);
{
my $pars = pdl 2,3,4;
my $rot = PDL::LinICA::_cayleygen({NVars=>3},$pars);

print $rot;
print $rot;

$inv = inv($rot);
print $inv;
my $inv = inv($rot);
print $inv;
}

if(0) {

if(0) {
$data = long zeroes(2,36);
axisvalues($data->xchg(0,1));
($xx = $data->slice('(0)')) %= 6;
($xx = $data->slice('(1)')) /= 6;
print $data;
$data = float $data;
my ($data, $xx);

$data = long zeroes(2,36);
axisvalues($data->xchg(0,1));
($xx = $data->slice('(0)')) %= 6;
($xx = $data->slice('(1)')) /= 6;
print $data;
$data = float $data;
} else {
$data = long zeroes(2,9);
axisvalues($data->xchg(0,1));
($xx = $data->slice('(0)')) %= 3;
($xx = $data->slice('(1)')) /= 3;
print $data;
$data = float $data;
my ($data, $xx);

$data = long zeroes(2,9);
axisvalues($data->xchg(0,1));
($xx = $data->slice('(0)')) %= 3;
($xx = $data->slice('(1)')) /= 3;
print $data;
$data = float $data;
}

my ($data, $xx, $ica, $newdata, $pcadata);
$data *= 0.1;
($xx = $data->slice('(0)')) *= 2;
($xx = $data->slice('(0)')) += $data->slice('(1)') * 0.3;
Expand Down Expand Up @@ -100,6 +116,8 @@ pdata($newdata);

print "NEWLATT\n";

my ($data, $data0, $ica, $newdata);

$data0 = zeroes(3,4,4,4);
axisvalues($data0->slice('(0)'));
axisvalues($data0->slice('(1)')->xchg(1,0));
Expand Down

0 comments on commit 43a44b3

Please sign in to comment.