TEST_NAME(test_fftcircshift)1 int TEST_NAME(test_fftcircshift)()
2 {
3     ltfatInt L[] = {111, 1, 100};
4     ltfatInt shift[] = { -5, 0, 1, -1000, 10540, 5660};
5 
6     for (unsigned int lId = 0; lId < ARRAYLEN(L); lId++)
7     {
8         LTFAT_COMPLEX* fin = LTFAT_NAME_COMPLEX(malloc)(L[lId]);
9         TEST_NAME_COMPLEX(fillRand)(fin, L[lId]);
10         LTFAT_COMPLEX* fout = LTFAT_NAME_COMPLEX(malloc)(L[lId]);
11         TEST_NAME_COMPLEX(fillRand)(fout, L[lId]);
12 
13         for (unsigned int shiftId = 0; shiftId < ARRAYLEN(shift); shiftId++)
14         {
15             mu_assert( LTFAT_NAME_COMPLEX(fftcircshift)(fin, L[lId], shift[shiftId],
16                        fout) == 0,
17                        "fftcirschift");
18             mu_assert( LTFAT_NAME_COMPLEX(fftcircshift)(fin, L[lId], shift[shiftId],
19                        fin) == 0,
20                        "fftcirschift inplace");
21         }
22 
23         ltfat_free(fin);
24         ltfat_free(fout);
25     }
26 
27     LTFAT_COMPLEX* fin = LTFAT_NAME_COMPLEX(malloc)(L[0]);
28     TEST_NAME_COMPLEX(fillRand)(fin, L[0]);
29     LTFAT_COMPLEX* fout = LTFAT_NAME_COMPLEX(malloc)(L[0]);
30     TEST_NAME_COMPLEX(fillRand)(fout, L[0]);
31 
32 
33     // Inputs can be checked only once
34     mu_assert( LTFAT_NAME_COMPLEX(fftcircshift)(NULL, L[0], shift[0],
35                fin) == LTFATERR_NULLPOINTER,
36                "First is null");
37     mu_assert( LTFAT_NAME_COMPLEX(fftcircshift)(fin, L[0], shift[0],
38                NULL) == LTFATERR_NULLPOINTER,
39                "Last is null");
40     mu_assert( LTFAT_NAME_COMPLEX(fftcircshift)(fin, 0, shift[0],
41                                         fout) == LTFATERR_BADSIZE,
42                "Zero length");
43     mu_assert( LTFAT_NAME_COMPLEX(fftcircshift)(fin, -1, shift[0],
44                fout) == LTFATERR_BADSIZE,
45                "Negative length");
46 
47     mu_assert( LTFAT_NAME_COMPLEX(fftcircshift)(NULL, -1, shift[0],
48                fout) < LTFATERR_SUCCESS,
49                "Multiple wrong inputs");
50 
51 
52     ltfat_free(fin);
53     ltfat_free(fout);
54     return 0;
55 }
56