Added is_valid_double() and is_valid_float() and tweaked a PowInt test.
[Math-GSL.git] / t / PowInt.t
blob5503f0bb616ac49bfca1bd3ac588ab1a46105985
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     Math::GSL::_assert_dies( sub { gsl_pow_2() } , 'gsl_pow args');
14     Math::GSL::_assert_dies( sub { gsl_pow_2(1,2) } , 'gsl_pow args');
15     Math::GSL::_assert_dies( sub { gsl_pow_2(qw(1 2)) } , 'gsl_pow args');
18     my $results = { 
19                 'gsl_pow_2(3.14)'   => (3.14) ** 2,
20                 'gsl_pow_2(3)'      =>      3 ** 2,
21                 'gsl_pow_2(0)'      =>      0 ** 2,
22                 'gsl_pow_2(-1)'     =>   (-1) ** 2,
23                 'gsl_pow_3(4)'      =>      4 ** 3,
24                 'gsl_pow_4(5)'      =>      5 ** 4,
25                 'gsl_pow_5(6)'      =>      6 ** 5,
26                 'gsl_pow_6(7)'      =>      7 ** 6,
27                 'gsl_pow_7(8)'      =>      8 ** 7,
28                 'gsl_pow_8(-4)'     =>   (-4) ** 8,
29                 'gsl_pow_9(4)'      =>      4 ** 9,
30                 q{gsl_pow_2('nan')} =>      q{nan},
31                 q{gsl_pow_2('inf')} =>      q{inf},
32               };
33     my $gsl = Math::GSL->new;
34     $gsl->verify_results($results, $class);