Skip to content

Commit 07cc78b

Browse files
committed
Fix some tests and coverage
1 parent 3f3c8f1 commit 07cc78b

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

test/fftshift_alternatives.jl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,26 @@
2020
end
2121

2222

23+
@testset "fftshift and ifftshift in-place" begin
24+
function f(arr, dims)
25+
arr3 = copy(arr)
26+
@test fftshift(arr, dims) == FourierTools._fftshift!(copy(arr), arr, dims)
27+
@test arr3 == arr
28+
@test ifftshift(arr, dims) == FourierTools._ifftshift!(copy(arr), arr, dims)
29+
@test arr3 == arr
30+
@test FourierTools._fftshift!(copy(arr), arr, dims) != arr
31+
end
32+
33+
f(randn((8,)), 1)
34+
f(randn((2,)), 1)
35+
f(randn((3,)), 1)
36+
f(randn((3,4)), 1)
37+
f(randn((3,4)), 2)
38+
f(randn((4,4)), (1,2))
39+
f(randn((5,5)), (1, 2))
40+
f(randn((5,5)), (1,))
41+
f(randn((8, 7, 6,4,1)), (1,2))
42+
f(randn((8, 7, 6,4,1)), (2,3))
43+
f(randn((8, 7, 6,4,1)), 3)
44+
f(randn((8, 7, 6,4,1)), (1,2,3,4,5))
45+
end

test/fractional_fourier_transform.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
1 .+ abs.(frfft(frfft(box1d_, 0.5, shift=true), 0.5, shift=true)[30:70]), rtol=7e-3))
1616

1717

18-
for frac in [0, -1, 1, 2,-3, -4,4,-2, 1.1, 2.2, 3.3, 4.4, 5.5, -1.1, -2.2, -3.3, -4.4]
18+
for frac in [0, -0.999, 0.99, 2.001,-3.001, -3.999,4,-2, 1.1, 2.2, 3.3, 4.4, 5.5, -1.1, -2.2, -3.3, -4.4]
1919
@test all(.≈(10 .+ abs.(FractionalTransforms.frft(collect(box1d_), frac))[30:70],
2020
10 .+ abs.(frfft(box1d_, frac, shift=true))[30:70], rtol=9e-3))
2121

@@ -39,6 +39,7 @@
3939

4040
x = randn((12,))
4141
x2 = randn((13,))
42-
@test frft(x, 0.5) frft(reshape(x, 12,1,1,1,1), 0.5)
43-
@test frft(x, 0.5) reshape(frft(reshape(x, 1,12,1,1), 0.5), 12)
42+
@test frfft(x, 0.5) frfft(reshape(x, 12,1,1,1,1), 0.5)
43+
@test frfft(x, 0.5) reshape(frfft(collect(reshape(x, 1,12,1,1)), 0.5), 12)
44+
@test reshape(frfft(reshape(x, 1,12,1,1), 0.43), 12) frfft(x, 0.43)
4445
end

0 commit comments

Comments
 (0)