Skip to content

Commit 0ff5ea0

Browse files
committed
Fixing Test formatting
1 parent 7fdcb4e commit 0ff5ea0

File tree

6 files changed

+43
-17
lines changed

6 files changed

+43
-17
lines changed

src/algos.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ end
9090
Power of 2 FFT in place, real
9191
9292
"""
93-
function fft_pow2!(out::AbstractVector{T}, in::AbstractVector{T}, N::Int, start_out::Int, stride_out::Int, start_in::Int, stride_in::Int, d::Direction) where {T<:Real}
93+
function fft_pow2!(out::AbstractVector{Complex{T}}, in::AbstractVector{T}, N::Int, start_out::Int, stride_out::Int, start_in::Int, stride_in::Int, d::Direction) where {T<:Real}
9494
if N == 2
9595
out[1] = in[1] + in[2]
9696
out[2] = in[1] - in[2]

test/complex_backward.jl

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
using FFTA, Test
2-
3-
@testset verbose = true "bfft 1D complex, size $N" for N in [8, 11, 15, 100]
4-
x = ones(ComplexF64, N)
5-
y = bfft(x)
6-
b1 = isapprox(y[1], N, atol=1e-12)
7-
b2 = isapprox(y[2:end], 0*x[2:end], atol=1e-12)
8-
@test b1 && b2
2+
test_nums = [8, 11, 15, 100]
3+
@testset "backward" begin
4+
for N in test_nums
5+
x = ones(ComplexF64, N)
6+
y = bfft(x)
7+
b1 = isapprox(y[1], N, atol=1e-12)
8+
b2 = isapprox(y[2:end], 0*x[2:end], atol=1e-12)
9+
@test b1 && b2
10+
end
911
end

test/complex_forward.jl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
using FFTA, Test
2-
3-
@testset verbose = true "fft 1D complex, size $N" for N in [8, 11, 15, 100]
4-
x = zeros(ComplexF64, N)
5-
x[1] = 1
6-
y = fft(x)
7-
@test y ones(size(x))
2+
test_nums = [8, 11, 15, 100]
3+
@testset verbose = true " forward" begin
4+
for N in test_nums
5+
x = zeros(ComplexF64, N)
6+
x[1] = 1
7+
y = fft(x)
8+
@test y ones(size(x))
9+
end
810
end

test/real_backward.jl

Whitespace-only changes.

test/real_forward.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using FFTA, Test
2+
test_nums = [8, 11, 15, 100]
3+
@testset verbose = true "fft 1D real, size $(padnum(maximum(test_nums),N))" for N in test_nums
4+
x = zeros(Float64, N)
5+
x[1] = 1
6+
y = fft(x)
7+
@test y ones(size(x))
8+
end

test/runtests.jl

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
using Test
22

3-
@testset verbose = true "Unit Tests" begin
4-
include("complex_forward.jl")
5-
include("complex_backward.jl")
3+
function padnum(m,x)
4+
digs = floor(Int, log10(m))
5+
digs_x = floor(Int, log10(x))
6+
v = fill(' ', digs-digs_x)
7+
for d in digits(x)[end:-1:1] push!(v, '0' + d) end
8+
String(v)
9+
end
10+
11+
@testset verbose = true "1D" begin
12+
@testset verbose = true "Complex" begin
13+
include("complex_forward.jl")
14+
include("complex_backward.jl")
15+
end
16+
@testset verbose = true "Real" begin
17+
# include("real_forward.jl")
18+
include("real_backward.jl")
19+
end
620
end

0 commit comments

Comments
 (0)