Skip to content

Commit 0c3db06

Browse files
committed
tests
1 parent abb4c51 commit 0c3db06

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/runtests.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,23 @@ end
8181
@test AbstractFFTs.ifftshift([1 2 3; 4 5 6], 1:2) == [5 6 4; 2 3 1]
8282
end
8383

84+
@testset "FFT Frequencies" begin
85+
# N even
86+
@test fftfreq(8) == [0.0, 0.125, 0.25, 0.375, -0.5, -0.375, -0.25, -0.125]
87+
@test rfftfreq(8) == [0.0, 0.125, 0.25, 0.375, 0.5]
88+
@test fftshift(fftfreq(8)) == -0.5:0.125:0.375
89+
90+
# N odd
91+
@test fftfreq(5) == [0.0, 0.2, 0.4, -0.4, -0.2]
92+
@test rfftfreq(5) == [0.0, 0.2, 0.4]
93+
@test fftshift(fftfreq(5)) == -0.4:0.2:0.4
94+
95+
# Sampling Frequency
96+
@test fftfreq(5, 2) == [0.0, 0.4, 0.8, -0.8, -0.4]
97+
# <:Number type compatibility
98+
@test eltype(fftfreq(5, ComplexF64(2))) == ComplexF64
99+
end
100+
84101
@testset "normalization" begin
85102
# normalization should be inferable even if region is only inferred as ::Any,
86103
# need to wrap in another function to test this (note that p.region::Any for

0 commit comments

Comments
 (0)