1 package Math
::GSL
::Deriv
::Test
;
2 use Math
::GSL
::Test qw
/:all/;
3 use base
'Test::Class';
4 use Test
::More
'no_plan';
5 use Math
::GSL qw
/:all/;
6 use Math
::GSL
::Deriv qw
/:all/;
7 use Math
::GSL
::Errno qw
/:all/;
13 BEGIN{ gsl_set_error_handler_off
() };
15 sub make_fixture
: Test
(setup
) {
17 $self->{gsl_func
} = Math
::GSL
::Deriv
::gsl_function_struct
->new;
20 sub teardown
: Test
(teardown
) {
23 sub TEST_FUNCTION_STRUCT
: Tests
{
26 isa_ok
( $self->{gsl_func
},'Math::GSL::Deriv::gsl_function_struct');
29 sub TEST_DERIV_CENTRAL_DIES
: Tests
{
32 gsl_deriv_central
( 'IAMNOTACODEREF', $x, $h);
33 },qr/not a reference value/, 'gsl_deriv_central borks when first arg is not a coderef');
36 sub AAA_TEST_DERIV_CENTRAL
: Tests
{
37 my ($status, $result, $abserr);
43 ($status, $result, $abserr, @other) = gsl_deriv_central
(
45 print "IN ANON SUB in perl\n";
52 warn Dumper
[ $status , $result, $abserr, \
@other ];
55 local $TODO = 'return value is not correct';
56 ok_similar
( [$result], [3*$x], 'gsl_deriv_central returns correct value for anon sub' );
59 sub TEST_DERIV_CENTRAL_CALLS_THE_SUB
: Tests
{
60 my ($status, $result, $abserr);
65 gsl_deriv_central
( sub { die "CALL ME BACK!"} , $x, $h)
66 }, qr/CALL ME BACK/, 'gsl_deriv_central can call anon sub' );