Adding tests to Combination with two failing and some wrappers
[Math-GSL.git] / lib / Math / GSL / Combination / Test.pm
blob8ba14ed5b67fc2bda2af3f1e7519203feeac8ac1
1 package Math::GSL::Combination::Test;
2 use base q{Test::Class};
3 use Test::More;
4 use Math::GSL::Combination qw/:all/;
5 use Math::GSL::Errno qw/:all/;
6 use Math::GSL qw/:all/;
7 use strict;
9 sub make_fixture : Test(setup) {
10 my $self = shift;
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 {
29 my $self = shift;
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 ] );
42 sub NEW : Tests {
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);
48 sub AS_LIST: Tests {
49 my $self = shift;
50 is_deeply( [ $self->{oo}->as_list ] , [ 0 .. 4 ] );
53 sub LENGTH : Tests {
54 my $self = shift;
55 ok($self->{oo}->length eq 5);
58 sub ELEMENTS : Tests {
59 my $self = shift;
60 ok($self->{oo}->elements eq 5);
63 sub NEXT : Tests {
64 my $self = shift;
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 ] );
70 $status = $c->next;
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 ] );