1 package Math
::GSL
::Combination
::Test
;
2 use Math
::GSL
::Test qw
/:all/;
3 use base
q{Test::Class};
5 use Math
::GSL
::Combination qw
/:all/;
6 use Math
::GSL
::Errno qw
/:all/;
7 use Math
::GSL qw
/:all/;
10 sub make_fixture
: Test
(setup
) {
12 $self->{comb
} = gsl_combination_calloc
(5,5);
13 $self->{oo
} = Math
::GSL
::Combination
->new(5,5);
16 sub teardown
: Test
(teardown
) {
19 sub GSL_COMBINATION_ALLOC
: Tests
{
20 my $c = gsl_combination_alloc
(2,2);
21 isa_ok
($c, 'Math::GSL::Combination');
24 sub GSL_COMBINATION_CALLOC
: Tests
{
25 my $c = gsl_combination_calloc
(2,2);
26 isa_ok
($c, 'Math::GSL::Combination');
29 sub GSL_COMBINATION_GET
: Tests
{
31 map {ok
(gsl_combination_get
($self->{comb
}, $_) eq $_) } (0..4);
34 sub GSL_COMBINATION_NEXT
: Tests
{
35 my $c = gsl_combination_calloc
(4,2);
36 is_deeply
( [ map{ gsl_combination_get
($c,$_) } (0..1) ] , [ 0 .. 1 ] );
37 my $status = gsl_combination_next
($c);
38 ok_status
($status, $GSL_SUCCESS);
39 local $TODO = "Seems to have a problem with the gsl_combination_next function, see the gsl doc example for reference";
40 is_deeply
( [ map{ gsl_combination_get
($c,$_) } (0..1) ] , [ 0 .. 2 ] );
44 my $c = Math
::GSL
::Combination
->new(5,5);
45 isa_ok
($c, 'Math::GSL::Combination');
46 map {ok
(gsl_combination_get
($c->raw, $_) eq $_) } (0..4);
51 is_deeply
( [ $self->{oo
}->as_list ] , [ 0 .. 4 ] );
56 ok
($self->{oo
}->length eq 5);
59 sub ELEMENTS
: Tests
{
61 ok
($self->{oo
}->elements eq 5);
66 my $status = $self->{oo
}->next;
67 ok_status
($status, $GSL_FAILURE);
68 is_deeply
( [ $self->{oo
}->as_list ] , [ 0 .. 4 ] );
69 my $c = Math
::GSL
::Combination
->new(4,2);
70 is_deeply
( [ $c->as_list ] , [ 0 .. 1 ] );
72 ok_status
($status, $GSL_SUCCESS);
73 local $TODO = "Seems to have a problem with the gsl_combination_next function, see the gsl doc example for reference";
74 is_deeply
( [ $c->as_list ] , [ 0 .. 2 ] );