Testing pushing command
[Math-GSL.git] / t / PowInt.t
blob898529b96c8edf4e01dc1277fe3181ad032a51b0
1 use Test::More 'no_plan';
2 use Math::GSL;
3 use Math::GSL::PowInt qw/:all/;
4 use Data::Dumper;
5 use strict;
6 use warnings;
7 my $class = qw{Math::GSL::PowInt};
10     ok( gsl_pow_4(2) == gsl_pow_2(4) , q{%EXPORT_TAGS works} );
13     # SWIG takes care of arg checking, but it's still nice to check
14     Math::GSL::_assert_dies( sub { gsl_pow_2() } ,       'Invalid gsl_pow args');
15     Math::GSL::_assert_dies( sub { gsl_pow_2(1,2) } ,    'Invalid gsl_pow args');
16     Math::GSL::_assert_dies( sub { gsl_pow_2( () ) } ,   'Invalid gsl_pow args');
17     Math::GSL::_assert_dies( sub { gsl_pow_2(qw(1 2)) } ,'Invalid gsl_pow args');
20     my $results = { 
21                 'gsl_pow_2(3.14)'   => (3.14) ** 2,
22                 'gsl_pow_2(3)'      =>      3 ** 2,
23                 'gsl_pow_2(0)'      =>      0 ** 2,
24                 'gsl_pow_2(-1)'     =>   (-1) ** 2,
25                 'gsl_pow_3(4)'      =>      4 ** 3,
26                 'gsl_pow_4(5)'      =>      5 ** 4,
27                 'gsl_pow_5(6)'      =>      6 ** 5,
28                 'gsl_pow_6(7)'      =>      7 ** 6,
29                 'gsl_pow_7(8)'      =>      8 ** 7,
30                 'gsl_pow_8(-4)'     =>   (-4) ** 8,
31                 'gsl_pow_9(4)'      =>      4 ** 9,
32                 q{gsl_pow_2('nan')} =>      q{nan},
33                 q{gsl_pow_2('inf')} =>      q{inf},
34                 q{gsl_pow_3('nan')} =>      q{nan},
35                 q{gsl_pow_3('inf')} =>      q{inf},
36               };
37     my $gsl = Math::GSL->new;
38     $gsl->verify_results($results, $class);