|
1 | 1 | # This file was formerly a part of Julia. License is MIT: https://julialang.org/license |
2 | 2 | # TODO: parameterize conv tests |
3 | 3 | using Test, OffsetArrays |
4 | | -using DSP: filt, filt!, deconv, conv, xcorr, |
5 | | - optimalfftfiltlength, unsafe_conv_kern_os!, _conv_kern_fft! |
| 4 | +using DSP: filt, filt!, deconv, conv, conv!, xcorr, |
| 5 | + optimalfftfiltlength, unsafe_conv_kern_os!, _conv_kern_fft!, |
6 | 6 | nextfastfft |
7 | 7 |
|
8 | 8 |
|
|
38 | 38 |
|
39 | 39 | @test optimalfftfiltlength(1, 3) == 1 # Should be at least the first input |
40 | 40 |
|
| 41 | + # check that empty arrays are handled correctly (issue #168) |
| 42 | + for N in (1, 2, 3), algorithm in (:direct, :fft, :fft_simple, :fft_overlapsave) |
| 43 | + A = rand(ntuple(_ -> 5, N)...) |
| 44 | + B = Array{Float64}(undef, ntuple(_ -> 0, N)) |
| 45 | + out = zeros(ntuple(_ -> 4, N)) |
| 46 | + @test conv(A, B; algorithm) == out |
| 47 | + @test conv(B, A; algorithm) == out |
| 48 | + @test conv(B, B; algorithm) == B |
| 49 | + end |
| 50 | + |
41 | 51 | @testset "conv-1D" begin |
42 | 52 | # Convolution |
43 | 53 | a = [1, 2, 1, 2] |
|
0 commit comments