Re-enables NTuple tests, which fail by returning a non-zero Wstat
[Math-GSL.git] / t / NTuple.t
blob5887f1f75abe75da12bc28a539077fac58a52fbf
1 package Math::GSL::NTuple::Test;
2 use base q{Test::Class};
3 use Test::More;
4 use Test::Exception;
5 use Math::GSL::NTuple qw/:all/; 
6 use Math::GSL::Const qw/:all/; 
7 use Math::GSL::Errno qw/:all/; 
8 use Math::GSL qw/:all/;
9 use Math::GSL::Test qw/:all/;
10 use Data::Dumper;
11 use strict;
13 BEGIN{ gsl_set_error_handler_off(); }
15 END { warn "This is the end" }
17 sub make_fixture : Test(setup) {
18     my $self = shift;
19     my $size = int rand(100);
20     $self->{size}   = $size;
21     my $stuff       = [1..$size];
23     $self->{ntuple} = gsl_ntuple_create('ntuple', $stuff ,$size);
24     gsl_ntuple_write($self->{ntuple});
25     gsl_ntuple_close($self->{ntuple});
28 sub teardown : Test(teardown) {
29     unlink 'ntuple' if -f 'ntuple';
30     unlink 'ntuple2' if -f 'ntuple2';
33 sub GSL_NTUPLE_CREATE : Tests {
34     my $self = shift;
35     isa_ok ($self->{ntuple}, 'Math::GSL::NTuple::gsl_ntuple');
36     ok( -e 'ntuple', 'ntuple file created');
39 sub GSL_NTUPLE_OPEN_CLOSE : Tests {
40     my $self = shift;
41     my $stuff = [];
42     my $ntuple = gsl_ntuple_open('ntuple',$stuff, $self->{size} );
43     isa_ok($ntuple,'Math::GSL::NTuple');
44     ok_status(gsl_ntuple_close($ntuple));
47 sub GSL_NTUPLE_WRITE: Tests {
48     my $self = shift; 
49     my $data = [1..100];
50     my $base = gsl_ntuple_create('ntuple', $data, 100);
51     ok_status(gsl_ntuple_write($base));
52     ok_status(gsl_ntuple_close($base));
55 sub GSL_NTUPLE_READ: Tests {
56     my $self = shift; 
57     my $data = [1..100];
58     my $ntuple = gsl_ntuple_open('ntuple', $data, 100 );
59     # why does this return an EOF?
60     # perhaps gsl_ntuple_write is not doing it's job, so the file is empty...
61     ok_status(gsl_ntuple_read($ntuple),$GSL_EOF);
62     ok_status(gsl_ntuple_close($ntuple));
65 Test::Class->runtests;