Refactor Linalg tests and make them pass on FreeBSD 6.2/perl 5.10.0.
[Math-GSL.git] / t / PowInt.t
blob78f6a2a005d29b0c4fc15d8752595083955a8992
1 use Test::More 'no_plan';
2 use Math::GSL qw/:all/;
3 use Math::GSL::PowInt qw/:all/;
4 use Data::Dumper;
5 use strict;
6 use warnings;
7 use Test::Exception;
11     ok( gsl_pow_4(2) == gsl_pow_2(4) , q{%EXPORT_TAGS works} );
14     # SWIG takes care of arg checking, but it's still nice to check
15     dies_ok( sub { gsl_pow_2() } ,       'Invalid gsl_pow args');
16     dies_ok( sub { gsl_pow_2(1,2) } ,    'Invalid gsl_pow args');
17     dies_ok( sub { gsl_pow_2( () ) } ,   'Invalid gsl_pow args');
18     dies_ok( sub { gsl_pow_2(qw(1 2)) } ,'Invalid gsl_pow args');
21     ok_similar( [ map { eval $_ } (
22                 'gsl_pow_2(3.14)'   ,
23                 'gsl_pow_2(3)'      ,
24                 'gsl_pow_2(0)'      ,
25                 'gsl_pow_2(-1)'     ,
26                 'gsl_pow_3(4)'      ,
27                 'gsl_pow_4(5)'      ,
28                 'gsl_pow_5(6)'      ,
29                 'gsl_pow_6(7)'      ,
30                 'gsl_pow_7(8)'      ,
31                 'gsl_pow_8(-4)'     ,
32                 'gsl_pow_9(4)'      ,
33                 q{gsl_pow_2('nan')} ,
34                 q{gsl_pow_2('inf')} ,
35                 'gsl_pow_int(5,10)' ,
36             ) ], [
37                     (3.14) ** 2, 3 ** 2, 0 ** 2, (-1) ** 2, 4 ** 3, 5 ** 4, 6 ** 5, 7 ** 6,
38                         8 ** 7, (-4) ** 8, 4 ** 9, q{nan}, q{inf}, 5 ** 10,
39                 ],
40     "basic power tests",
41     );