Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 61 lines (54 sloc) 2.081 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
package Math::GSL::GSL::Test;
use base q{Test::Class};
use Test::More tests => 18;
use Math::GSL::SF qw/:all/;
use Math::GSL::BLAS qw/:all/;
use Math::GSL::Vector qw/:all/;
use Math::GSL::Complex qw/:all/;
use Math::GSL::Matrix qw/:all/;
use Math::GSL::CBLAS qw/:all/;
use Math::GSL qw/:all/;
use Math::GSL::Test qw/:all/;
use Math::GSL::Errno qw/:all/;
use Data::Dumper;
use strict;

BEGIN { gsl_set_error_handler_off(); }

sub make_fixture : Test(setup) {
}

sub teardown : Test(teardown) {
}

sub TEST_STUFF : Tests {
    {
        my $results = {
                    q{is_similar(undef, [1,2,3]) } => [ 0 ],
                    q{is_similar(0.10005,0.1000501, 1e-5)} => [ 1 ],
                    q{is_similar(0.10005,0.1000501, 1e-7)} => [ 0 ],
                    q{is_similar([1,2,3 ], [1,2,3.001])} => [ 0 ],
                    q{is_similar([1,2,3.001], [1,2,3.001])} => [ 1 ],
                    q{is_similar([1,2,3.001], [1,2,3.001],1e-2)} => [ 1 ],
                    q{is_similar([1,2,3.0010001], [1,2,3.0010002], 1e-5)} => [ 1 ],
                    q{is_similar([1,2,3.0010001], [1,2,3.0010002] )} => [ 0 ],
                    q{is_similar_relative( 1e8, 1e8 + 1, 1e-7) } => [ 1 ],
                    q{is_similar_relative( 1e8, 1e8 + 1e3, 1e-7) } => [ 0 ],
                    q{is_status_ok($GSL_SUCCESS)} => [ 1 ],
                    q{is_status_ok($GSL_EDOM)} => [ 0 ],
        };

        verify($results, 'Math::GSL');
    }
    {
            ok_status(0,$GSL_SUCCESS);
            ok_status(0);
    }
    {
        my $fh = gsl_fopen('mrfuji','w');
        ok(defined $fh, 'gsl_fopen can create files');
        ok_status(gsl_fclose($fh));
    }
    {
        my $fh = gsl_fopen('mrfuji','r');
        ok(defined $fh, 'gsl_fopen can read files');
        ok_status(gsl_fclose($fh));
        unlink 'mrfuji' if -e 'mrfuji';
    }

}

Test::Class->runtests;
Something went wrong with that request. Please try again.