Skip to content

Commit

Permalink
Add versioning checks to gsl_sf.t.
Browse files Browse the repository at this point in the history
Obviously the new functions don't work with old gsl, and shouldn't
be tested.  Thanks Travis-CI!
  • Loading branch information
d-lamb committed Apr 24, 2016
1 parent 14da91f commit 9204959
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions t/gsl_sf.t
Expand Up @@ -15,6 +15,7 @@ BEGIN
{
use PDL::Config;
if ( $PDL::Config{WITH_GSL} ) {
my $v = `gsl-config --version`;
eval "
use PDL::GSLSF::AIRY;
use PDL::GSLSF::BESSEL;
Expand Down Expand Up @@ -46,7 +47,8 @@ BEGIN
use PDL::GSLSF::ZETA;
";
unless ($@) {
plan tests => 3;
plan tests => 3 if $v>=2.0;
plan tests => 1 if $v<2.0;
} else {
warn "Warning: $@\n\n";
plan skip_all => "PDL::GSLSF modules not installed.";
Expand All @@ -56,6 +58,7 @@ BEGIN
}
}

my $version = `gsl-config --version`;
my $arg = 5.0;
my $expected = -0.17759677131433830434739701;

Expand All @@ -65,6 +68,8 @@ my ($y,$err) = gsl_sf_bessel_Jn($arg, 0);

ok(abs($y-$expected) < 1e-6,"GSL SF Bessel function");

my $Ylm = gsl_sf_legendre_array(xvals(21)/10-1,'Y',4,-1);
ok($Ylm->slice("(0)")->uniq->nelem == 1, "Legendre Y00 is constant");
ok(approx($Ylm->slice("(0),(0)"),0.5/sqrt(3.141592654),1E-6), "Y00 value is corect");
if ($version >= 2.0){
my $Ylm = gsl_sf_legendre_array(xvals(21)/10-1,'Y',4,-1);
ok($Ylm->slice("(0)")->uniq->nelem == 1, "Legendre Y00 is constant");
ok(approx($Ylm->slice("(0),(0)"),0.5/sqrt(3.141592654),1E-6), "Y00 value is corect");
}

0 comments on commit 9204959

Please sign in to comment.