1 package Math::GSL::FFT::Test;
2 use Math::GSL::Test qw/:all/;
3 use base q{Test::Class};
5 use Math::GSL::FFT qw/:all/;
6 use Math::GSL qw/:all/;
8 use Math::GSL::Errno qw/:all/;
11 BEGIN { gsl_set_error_handler_off() }
13 sub make_fixture : Test(setup) {
16 sub teardown : Test(teardown) {
17 unlink 'fft' if -f 'fft';
19 sub FFT_REAL_RADIX2_TRANSFORM : Tests
21 my $data = [ (0) x 5, (1) x 22, (0) x 5 ];
22 my ($status1, $pass1 ) = gsl_fft_real_radix2_transform ($data, 1, 32);
60 sub FFT_COMPLEX_RADIX2_FORWARD : Tests
62 my $data = [ (1) x 10, (0) x 236, (1) x 10 ];
63 ok_status( gsl_fft_complex_radix2_forward ($data, 1, 128) );
65 sub FFT_VARS : Tests {
66 cmp_ok( $gsl_fft_forward, '==', -1, 'gsl_fft_forward' );
67 cmp_ok( $gsl_fft_backward, '==', +1, 'gsl_fft_backward' );
70 sub WAVETABLE_ALLOC_FREE: Tests {
71 my $wavetable = gsl_fft_complex_wavetable_alloc(42);
72 isa_ok($wavetable, 'Math::GSL::FFT' );
73 gsl_fft_complex_wavetable_free($wavetable);
74 ok(!$@, 'gsl_fft_complex_wavetable_free');
76 $wavetable = gsl_fft_halfcomplex_wavetable_alloc(42);
77 isa_ok($wavetable, 'Math::GSL::FFT' );
78 gsl_fft_halfcomplex_wavetable_free($wavetable);
79 ok(!$@, 'gsl_fft_halfcomplex_wavetable_free');
81 $wavetable = gsl_fft_real_wavetable_alloc(42);
82 isa_ok($wavetable, 'Math::GSL::FFT' );
83 gsl_fft_real_wavetable_free($wavetable);
84 ok(!$@, 'gsl_fft_real_wavetable_free');
88 sub WORKSPACE_ALLOC_FREE: Tests {
89 my $workspace = gsl_fft_complex_workspace_alloc(42);
90 isa_ok($workspace, 'Math::GSL::FFT' );
91 gsl_fft_complex_workspace_free($workspace);
92 ok(!$@, 'gsl_fft_complex_workspace_free');
94 # there are no gsl_fft_halfcomplex_workspace_* functions
96 $workspace = gsl_fft_real_workspace_alloc(42);
97 isa_ok($workspace, 'Math::GSL::FFT' );
98 gsl_fft_real_workspace_free($workspace);
99 ok(!$@, 'gsl_fft_real_workspace_free');
101 Test::Class->runtests;