Skip to content

Commit 4977633

Browse files
committed
add tests
1 parent 8a88755 commit 4977633

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

Project.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ version = "1.6.0"
44

55
[deps]
66
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
7+
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
78
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
89
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
910

@@ -22,6 +23,7 @@ Aqua = "0.8"
2223
ChainRulesCore = "1"
2324
ChainRulesTestUtils = "1"
2425
FiniteDifferences = "0.12"
26+
ForwardDiff = "0.10"
2527
LinearAlgebra = "<0.0.1, 1"
2628
Random = "<0.0.1, 1"
2729
Test = "<0.0.1, 1"
@@ -33,9 +35,10 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
3335
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
3436
ChainRulesTestUtils = "cdddcdb0-9152-4a09-a978-84456f9df70a"
3537
FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000"
38+
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
3639
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
3740
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
3841
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
3942

4043
[targets]
41-
test = ["Aqua", "ChainRulesCore", "ChainRulesTestUtils", "FiniteDifferences", "Random", "Test", "Unitful"]
44+
test = ["Aqua", "ChainRulesCore", "ChainRulesTestUtils", "FiniteDifferences", "ForwardDiff", "Random", "Test", "Unitful"]

ext/AbstractFFTsForwardDiffExt.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import AbstractFFTs: Plan
88
for P in (:Plan, :ScaledPlan) # need ScaledPlan to avoid ambiguities
99
@eval begin
1010
Base.:*(p::AbstractFFTs.$P, x::AbstractArray{DT}) where DT<:Dual = array2dual(DT, p * dual2array(x))
11-
Base.:*(p::AbstractFFTs.$P, x::AbstractArray{<:Complex{DT}}) where DT<:Dual = array2dual(DT, p * dual2array(x))
11+
Base.:*(p::AbstractFFTs.$P, x::AbstractArray{Complex{DT}}) where DT<:Dual = array2dual(DT, p * dual2array(x))
1212
end
1313
end
1414

src/AbstractFFTs.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ include("TestUtils.jl")
1111
if !isdefined(Base, :get_extension)
1212
include("../ext/AbstractFFTsChainRulesCoreExt.jl")
1313
include("../ext/AbstractFFTsTestExt.jl")
14+
include("../ext/AbstractFFTsForwardDiffExt.jl")
1415
end
1516

1617
end # module

test/TestPlans.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ function LinearAlgebra.mul!(y::AbstractArray{<:Complex, N}, p::TestRPlan, x::Abs
219219
return y
220220
end
221221

222-
function Base.:*(p::TestRPlan{T}, x::AbstractArray{T}) where T
222+
function Base.:*(p::TestRPlan{Typ}, x::AbstractArray{Typ}) where Typ
223223
# create output array
224224
firstdim = first(p.region)::Int
225225
d = size(x, firstdim)
@@ -241,7 +241,7 @@ function LinearAlgebra.mul!(y::AbstractArray{<:Real, N}, p::InverseTestRPlan, x:
241241
real_invdft!(y, x, p.region)
242242
end
243243

244-
function Base.:*(p::InverseTestRPlan{T}, x::AbstractArray{T}) where T
244+
function Base.:*(p::InverseTestRPlan{T}, x::AbstractArray{Complex{T}}) where T
245245
# create output array
246246
firstdim = first(p.region)::Int
247247
d = p.d

test/abstractfftsforwarddiff.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ using ForwardDiff: Dual, partials, value
5252
end
5353

5454
c1 = complex.(x1)
55-
@test mul!(similar(c1), FFTW.plan_fft(x1), x1) == fft(x1)
56-
@test mul!(similar(c1), FFTW.plan_fft(c1), c1) == fft(c1)
55+
@test mul!(similar(c1), plan_fft(x1), x1) == fft(x1)
56+
@test mul!(similar(c1), plan_fft(c1), c1) == fft(c1)
5757
end

0 commit comments

Comments
 (0)