@@ -50,7 +50,7 @@ def test_fft_buildup(self):
5050 fourier .fft_vectorized (test_input ).all ())
5151
5252
53- def test_wrong_array_size (self ):
53+ def test_fft_wrong_array_size (self ):
5454 """
5555 Tests for correct input for the FFT_vectorized function.
5656 Fails if the input is not a power of 2.
@@ -60,6 +60,16 @@ def test_wrong_array_size(self):
6060 fourier .fft_vectorized (test_input )
6161
6262
63+ def test_ifft_wrong_array_size (self ):
64+ """
65+ Tests for correct input for the ifft function.
66+ Fails if the input is not a power of 2.
67+ """
68+ test_input = np .random .random (30 ) + 1j * np .random .random (30 )
69+ with self .assertRaises (ValueError ):
70+ fourier .ifft (test_input )
71+
72+
6373 def test_fft_smaller_shape (self ):
6474 """
6575 Test for FFT_vectorized function
@@ -137,5 +147,16 @@ def test_fft_shift_multi_axes(self):
137147 test_output = [2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 1 ]
138148 self .assertSequenceEqual (fourier .fft_shift (test_input , [0 , 0 ]).tolist (), test_output )
139149
150+
151+ def test_fft_and_ifft (self ):
152+ """
153+ Test the fft and ifft
154+ and expect the same outcome and input
155+ """
156+ test_input = np .random .random (32 ) + 1j * np .random .random (32 )
157+ test_input = np .asarray (test_input )
158+ self .assertEqual (test_input .all (), fourier .fft_vectorized (fourier .ifft (test_input )).all ())
159+
160+
140161if __name__ == '__main__' :
141162 unittest .main ()
0 commit comments