Skip to content

Commit

Permalink
Document test_wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
gaurav-arya committed Sep 4, 2023
1 parent 22dc932 commit f3a843f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/TestUtils.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module TestUtils

"""
TestUtils.test_complex_ffts(ArrayType=Array; test_inplace=true, test_adjoint=true)
TestUtils.test_complex_ffts(ArrayType=Array; test_inplace=true, test_adjoint=true, test_wrappers=true)
Run tests to verify correctness of FFT, BFFT, and IFFT functionality using a particular backend plan implementation.
The backend implementation is assumed to be loaded prior to calling this function.
Expand All @@ -13,11 +13,12 @@ The backend implementation is assumed to be loaded prior to calling this functio
`convert(ArrayType, ...)`.
- `test_inplace=true`: whether to test in-place plans.
- `test_adjoint=true`: whether to test [plan adjoints](api.md#Base.adjoint).
- `test_wrappers=true`: whether to test any wrapper array inputs such as views.
"""
function test_complex_ffts end

"""
TestUtils.test_real_ffts(ArrayType=Array; test_adjoint=true, copy_input=false)
TestUtils.test_real_ffts(ArrayType=Array; test_adjoint=true, copy_input=false, test_wrappers=true)
Run tests to verify correctness of RFFT, BRFFT, and IRFFT functionality using a particular backend plan implementation.
The backend implementation is assumed to be loaded prior to calling this function.
Expand All @@ -30,18 +31,21 @@ The backend implementation is assumed to be loaded prior to calling this functio
- `test_adjoint=true`: whether to test [plan adjoints](api.md#Base.adjoint).
- `copy_input=false`: whether to copy the input before applying the plan in tests, to accomodate for
[input-mutating behaviour of real FFTW plans](https://github.com/JuliaMath/AbstractFFTs.jl/issues/101).
- `test_wrappers=true`: whether to test any wrapper array inputs such as views.
"""
function test_real_ffts end

# Always copy input before application due to FFTW real plans possibly mutating input (AbstractFFTs.jl#101)
"""
TestUtils.test_plan(P::Plan, x::AbstractArray, x_transformed::AbstractArray;
inplace_plan=false, copy_input=false)
inplace_plan=false, copy_input=false, test_wrappers=true)
Test basic properties of a plan `P` given an input array `x` and expected output `x_transformed`.
Because [real FFTW plans may mutate their input in some cases](https://github.com/JuliaMath/AbstractFFTs.jl/issues/101),
we allow specifying `copy_input=true` to allow for this behaviour in tests by copying the input before applying the plan.
We also allow specifying `test_wrappers=false` to skip testing wrapper array inputs such as views, which may cause ambiguity
issues for some array types currently.
"""
function test_plan end

Expand All @@ -55,6 +59,8 @@ Real-to-complex and complex-to-real plans require a slightly modified dot test,
The plan is assumed out-of-place, as adjoints are not yet supported for in-place plans.
Because [real FFTW plans may mutate their input in some cases](https://github.com/JuliaMath/AbstractFFTs.jl/issues/101),
we allow specifying `copy_input=true` to allow for this behaviour in tests by copying the input before applying the plan.
We also allow specifying `test_wrappers=false` to skip testing wrapper array inputs such as views, which may cause ambiguity
issues for some array types currently.
"""
function test_plan_adjoint end

Expand Down

0 comments on commit f3a843f

Please sign in to comment.