1 package Math
::GSL
::Combination
::Test
;
2 use base
q{Test::Class};
4 use Math
::GSL
::Combination qw
/:all/;
5 use Math
::GSL
::Errno qw
/:all/;
6 use Math
::GSL qw
/:all/;
9 sub make_fixture
: Test
(setup
) {
11 $self->{comb
} = gsl_combination_calloc
(5,5);
12 $self->{oo
} = Math
::GSL
::Combination
->new(5,5);
15 sub teardown
: Test
(teardown
) {
18 sub GSL_COMBINATION_ALLOC
: Tests
{
19 my $c = gsl_combination_alloc
(2,2);
20 isa_ok
($c, 'Math::GSL::Combination');
23 sub GSL_COMBINATION_CALLOC
: Tests
{
24 my $c = gsl_combination_calloc
(2,2);
25 isa_ok
($c, 'Math::GSL::Combination');
28 sub GSL_COMBINATION_GET
: Tests
{
30 map {ok
(gsl_combination_get
($self->{comb
}, $_) eq $_) } (0..4);
33 sub GSL_COMBINATION_NEXT
: Tests
{
34 my $c = gsl_combination_calloc
(4,2);
35 is_deeply
( [ map{ gsl_combination_get
($c,$_) } (0..1) ] , [ 0 .. 1 ] );
36 my $status = gsl_combination_next
($c);
37 ok_status
($status, $GSL_SUCCESS);
38 local $TODO = "Seems to have a problem with the gsl_combination_next function, see the gsl doc example for reference";
39 is_deeply
( [ map{ gsl_combination_get
($c,$_) } (0..1) ] , [ 0 .. 2 ] );
43 my $c = Math
::GSL
::Combination
->new(5,5);
44 isa_ok
($c, 'Math::GSL::Combination');
45 map {ok
(gsl_combination_get
($c->raw, $_) eq $_) } (0..4);
50 is_deeply
( [ $self->{oo
}->as_list ] , [ 0 .. 4 ] );
55 ok
($self->{oo
}->length eq 5);
58 sub ELEMENTS
: Tests
{
60 ok
($self->{oo
}->elements eq 5);
65 my $status = $self->{oo
}->next;
66 ok_status
($status, $GSL_FAILURE);
67 is_deeply
( [ $self->{oo
}->as_list ] , [ 0 .. 4 ] );
68 my $c = Math
::GSL
::Combination
->new(4,2);
69 is_deeply
( [ $c->as_list ] , [ 0 .. 1 ] );
71 ok_status
($status, $GSL_SUCCESS);
72 local $TODO = "Seems to have a problem with the gsl_combination_next function, see the gsl doc example for reference";
73 is_deeply
( [ $c->as_list ] , [ 0 .. 2 ] );