Skip to content

Commit

Permalink
Fix bug with resizing downconverted signal and add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Soeren Schoenbrod committed Feb 9, 2021
1 parent 3dc74ca commit d786086
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/tracking_state.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ end

function DownconvertedSignalCPU(num_ants::NumAnts{N}) where N
DownconvertedSignalCPU(
StructArray{Complex{Float32}}(undef, 0),
StructArray{Complex{Float32}}(undef, 0, N),
StructArray{Complex{Float64}}(undef, 0, N)
)
end
Expand Down
26 changes: 26 additions & 0 deletions test/tracking_loop.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,32 @@
@test @inferred(post_corr_filter(SVector(1.0 + 0.0im, 2.0 + 0.0im))) == 1.0 + 0.0im
end

@testset "Resize downconverted signal for multiple ants" for type in (Float32, Float64)
downconverted_signal_temp = Tracking.DownconvertedSignalCPU(NumAnts(4))
signal = StructArray(ones(Complex{type}, 2500, 4))
downconverted_signal = Tracking.resize!(downconverted_signal_temp, 2500, signal)
if type == Float32
@test size(downconverted_signal.downconverted_signal_f32) == (2500, 4)
@test size(downconverted_signal.downconverted_signal_f64) == (0, 4)
else
@test size(downconverted_signal.downconverted_signal_f32) == (0, 4)
@test size(downconverted_signal.downconverted_signal_f64) == (2500, 4)
end
end

@testset "Resize downconverted signal for single ant" for type in (Float32, Float64)
downconverted_signal_temp = Tracking.DownconvertedSignalCPU(NumAnts(1))
signal = StructArray(ones(Complex{type}, 2500))
downconverted_signal = Tracking.resize!(downconverted_signal_temp, 2500, signal)
if type == Float32
@test size(downconverted_signal.downconverted_signal_f32) == (2500,)
@test size(downconverted_signal.downconverted_signal_f64) == (0,)
else
@test size(downconverted_signal.downconverted_signal_f32) == (0,)
@test size(downconverted_signal.downconverted_signal_f64) == (2500,)
end
end

@testset "Integration time" begin
gpsl1 = GPSL1()
galileo_e1b = GalileoE1B()
Expand Down

0 comments on commit d786086

Please sign in to comment.