Move tests out of lib/Math/GSL/*/Test.pm into t/*.t directly
[Math-GSL.git] / t / FFT.t
blob78d397a5e461f6105040e6376bd952d239caa398
1 package Math::GSL::FFT::Test;
2 use Math::GSL::Test qw/:all/;
3 use base q{Test::Class};
4 use Test::More;
5 use Math::GSL::FFT qw/:all/;
6 use Math::GSL qw/:all/;
7 use Data::Dumper;
8 use Math::GSL::Errno qw/:all/;
9 use strict;
11 BEGIN { gsl_set_error_handler_off(); }
12 sub make_fixture : Test(setup) {
15 sub teardown : Test(teardown) {
16     unlink 'fft' if -f 'fft';
18 sub FFT_REAL_RADIX2_TRANSFORM : Tests 
20     my $data = [ (0) x 5, (1) x 22, (0) x 5 ];
21     ok_status( gsl_fft_real_radix2_transform ($data, 1, 32));
22     print Dumper [ $data ];
25 sub FFT_COMPLEX_RADIX2_FORWARD : Tests 
27     my $data = [ (1) x 10, (0) x 236, (1) x 10 ];
28     ok_status( gsl_fft_complex_radix2_forward ($data, 1, 128) );
30 sub FFT_VARS : Tests {
31     cmp_ok( $gsl_fft_forward, '==', -1, 'gsl_fft_forward' );
32     cmp_ok( $gsl_fft_backward, '==', +1, 'gsl_fft_backward' );
34 sub WAVETABLE_ALLOC_FREE: Tests {
35     my $wavetable = gsl_fft_complex_wavetable_alloc(42);
36     isa_ok($wavetable, 'Math::GSL::FFT' );
37     gsl_fft_complex_wavetable_free($wavetable);
38     ok(!$@, 'gsl_fft_complex_wavetable_free');
40     $wavetable = gsl_fft_halfcomplex_wavetable_alloc(42);
41     isa_ok($wavetable, 'Math::GSL::FFT' );
42     gsl_fft_halfcomplex_wavetable_free($wavetable);
43     ok(!$@, 'gsl_fft_halfcomplex_wavetable_free');
45     $wavetable = gsl_fft_real_wavetable_alloc(42);
46     isa_ok($wavetable, 'Math::GSL::FFT' );
47     gsl_fft_real_wavetable_free($wavetable);
48     ok(!$@, 'gsl_fft_real_wavetable_free');
52 sub WORKSPACE_ALLOC_FREE: Tests {
53     my $workspace = gsl_fft_complex_workspace_alloc(42);
54     isa_ok($workspace, 'Math::GSL::FFT' );
55     gsl_fft_complex_workspace_free($workspace);
56     ok(!$@, 'gsl_fft_complex_workspace_free');
58     # there are no gsl_fft_halfcomplex_workspace_* functions
60     $workspace = gsl_fft_real_workspace_alloc(42);
61     isa_ok($workspace, 'Math::GSL::FFT' );
62     gsl_fft_real_workspace_free($workspace);
63     ok(!$@, 'gsl_fft_real_workspace_free');
65 Test::Class->runtests;