-
Notifications
You must be signed in to change notification settings - Fork 25
/
PowInt.t
44 lines (40 loc) · 1.37 KB
/
PowInt.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package Math::GSL::PowInt::Test;
use base q{Test::Class};
use Test::More tests => 14;
use Math::GSL::Sys qw/gsl_posinf gsl_nan/;
use Math::GSL::Test qw/:all/;
use Math::GSL::PowInt qw/:all/;
use Math::GSL::Errno qw/:all/;
use Data::Dumper;
use strict;
BEGIN { gsl_set_error_handler_off() }
sub make_fixture : Test(setup) { }
sub teardown : Test(teardown) { }
sub TEST_BASIC: Tests {
my %results = (
'gsl_pow_2(3.14)' => [ (3.14)**2 ],
'gsl_pow_2(3)' => [ 3 ** 2 ],
'gsl_pow_2(0)' => [ 0 ** 2 ],
'gsl_pow_2(-1)' => [ (-1) ** 2 ],
'gsl_pow_3(4)' => [ 4 ** 3 ],
'gsl_pow_4(5)' => [ 5 ** 4 ],
'gsl_pow_5(6)' => [ 6 ** 5 ],
'gsl_pow_6(7)' => [ 7 ** 6 ],
'gsl_pow_7(8)' => [ 8 ** 7 ],
'gsl_pow_8(-4)' => [ (-4) ** 8 ],
'gsl_pow_9(4)' => [ 4 ** 9 ],
'gsl_pow_int(5,10)'=> [ 5 ** 10 ],
);
verify(\%results, 'Math::GSL::PowInt');
}
sub TEST_NAN_INF : Tests {
my $self = shift;
$main::nan = gsl_nan();
$main::posinf = gsl_posinf();
my %results = (
q{gsl_pow_2($main::nan)} => [ $main::nan ],
q{gsl_pow_2($main::posinf)} => [ $main::posinf ],
);
verify(\%results,'Math::GSL::PowInt');
}
Test::Class->runtests;