From a9fc317e7e919d6d20da3a5ceb0b72b58b863f84 Mon Sep 17 00:00:00 2001 From: Bart de Koning Date: Sun, 15 Feb 2026 15:38:12 +0100 Subject: [PATCH 01/13] Replace SafeTestSets with TestItemRunner --- Project.toml | 6 +- test/runtests.jl | 17 ++- test/test_datainterpolations_comparison.jl | 101 +++++++-------- test/test_derivatives.jl | 135 +++++++++++---------- test/test_interface.jl | 20 +-- test/test_interpolations.jl | 95 +++------------ test/test_symbolics_ext.jl | 33 ++--- test/utils.jl | 90 ++++++++++++++ 8 files changed, 257 insertions(+), 240 deletions(-) create mode 100644 test/utils.jl diff --git a/Project.toml b/Project.toml index 9090b47..55522db 100644 --- a/Project.toml +++ b/Project.toml @@ -25,10 +25,10 @@ KernelAbstractions = "0.9.34" PrecompileTools = "1.0" Random = "1" RecipesBase = "1.3.4" -SafeTestsets = "0.1" SymbolicUtils = "4" Symbolics = "7" Test = "1" +TestItemRunner = "1" julia = "1" [extras] @@ -36,10 +36,10 @@ DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" -SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" SymbolicUtils = "d1185830-fcd6-423d-90d6-eec64667417b" Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a" [targets] -test = ["DataInterpolations", "ForwardDiff", "Pkg", "Random", "SafeTestsets", "Symbolics", "Test", "SymbolicUtils"] +test = ["DataInterpolations", "ForwardDiff", "Pkg", "Random", "Symbolics", "Test", "TestItemRunner", "SymbolicUtils"] diff --git a/test/runtests.jl b/test/runtests.jl index d58239b..64adf48 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,28 +1,27 @@ -using SafeTestsets, Pkg +using TestItemRunner, Pkg const GROUP = get(ENV, "GROUP", "All") function activate_gpu_env() Pkg.activate("gpu") - Pkg.develop(PackageSpec(path = dirname(@__DIR__))) + Pkg.develop(PackageSpec(path=dirname(@__DIR__))) return Pkg.instantiate() end function activate_qa_env() Pkg.activate("qa") - Pkg.develop(PackageSpec(path = dirname(@__DIR__))) + Pkg.develop(PackageSpec(path=dirname(@__DIR__))) return Pkg.instantiate() end if GROUP == "All" || GROUP == "Core" - @safetestset "Interpolations" include("test_interpolations.jl") - @safetestset "Derivatives" include("test_derivatives.jl") - @safetestset "DataInterpolations" include("test_datainterpolations_comparison.jl") - @safetestset "Interface" include("test_interface.jl") + core_files = ("test_interpolations.jl", "test_derivatives.jl", "test_datainterpolations_comparison.jl", "test_interface.jl") + @run_package_tests filter = ti -> any(endswith(ti.filename, file) for file in core_files) elseif GROUP == "Extensions" - @safetestset "Symbolics Extension" include("test_symbolics_ext.jl") + extension_files = ("test_symbolics_ext.jl",) + @run_package_tests filter = ti -> any(endswith(ti.filename, file) for file in extension_files) elseif GROUP == "QA" activate_qa_env() - include("qa/runtests.jl") + @run_package_tests filter = ti -> endswith(ti.filename, "qa/runtests.jl") elseif GROUP == "GPU" activate_gpu_env() # TODO: Add GPU tests diff --git a/test/test_datainterpolations_comparison.jl b/test/test_datainterpolations_comparison.jl index 5897736..aa5b6e8 100644 --- a/test/test_datainterpolations_comparison.jl +++ b/test/test_datainterpolations_comparison.jl @@ -1,75 +1,76 @@ -using DataInterpolationsND -using DataInterpolations +@testitem "DataInterpolations comparison" begin + using DataInterpolations -isapprox_or_nan(v1, v2) = (v1 ≈ v2) || (all(isnan, v1) && all(isnan, v2)) + isapprox_or_nan(v1, v2) = (v1 ≈ v2) || (all(isnan, v1) && all(isnan, v2)) -function interpolation_comparison( + function interpolation_comparison( itp_dim_type::Type{<:DataInterpolationsND.AbstractInterpolationDimension}, itp_type::Type{<:DataInterpolations.AbstractInterpolation} ) - t = [0.0, 0.2, 0.5, 0.7, 0.9, 1.1] - u = [1.5, -5.3, 0.5, 3.3, 3.6, 1.0] + t = [0.0, 0.2, 0.5, 0.7, 0.9, 1.1] + u = [1.5, -5.3, 0.5, 3.3, 3.6, 1.0] - n = length(t) + n = length(t) - itp_DI = itp_type(u, t) - itp_NDI = NDInterpolation(u, itp_dim_type(t)) + itp_DI = itp_type(u, t) + itp_NDI = NDInterpolation(u, itp_dim_type(t)) - # Interior non data points - for i in 1:(n - 1) - t_eval = range(t[i], t[i + 1]; length = 25)[2:24] - @test itp_DI(t_eval) ≈ itp_NDI.(t_eval) - end + # Interior non data points + for i in 1:(n-1) + t_eval = range(t[i], t[i+1]; length=25)[2:24] + @test itp_DI(t_eval) ≈ itp_NDI.(t_eval) + end - # Interior data points - t_eval = view(t, 2:(n - 1)) - @test itp_DI(t_eval) ≈ itp_NDI.(t_eval) + # Interior data points + t_eval = view(t, 2:(n-1)) + @test itp_DI(t_eval) ≈ itp_NDI.(t_eval) - # Boundary points - t_eval = [first(t), last(t)] - return @test itp_DI(t_eval) ≈ itp_NDI.(t_eval) -end + # Boundary points + t_eval = [first(t), last(t)] + return @test itp_DI(t_eval) ≈ itp_NDI.(t_eval) + end -function interpolation_derivative_comparison( + function interpolation_derivative_comparison( itp_dim_type::Type{<:DataInterpolationsND.AbstractInterpolationDimension}, itp_type::Type{<:DataInterpolations.AbstractInterpolation} ) - t = [0.0, 0.2, 0.5, 0.7, 0.9, 1.1] - u = [1.5, -5.3, 0.5, 3.3, 3.6, 1.0] + t = [0.0, 0.2, 0.5, 0.7, 0.9, 1.1] + u = [1.5, -5.3, 0.5, 3.3, 3.6, 1.0] - n = length(t) + n = length(t) - itp_DI = itp_type(u, t) - itp_NDI = NDInterpolation(u, itp_dim_type(t)) + itp_DI = itp_type(u, t) + itp_NDI = NDInterpolation(u, itp_dim_type(t)) - # Interior non data points - for i in 1:(n - 1) - t_eval = range(t[i], t[i + 1]; length = 25)[2:24] - @test DataInterpolations.derivative.(Ref(itp_DI), t_eval) ≈ - itp_NDI.(t_eval; derivative_orders = (1,)) - end + # Interior non data points + for i in 1:(n-1) + t_eval = range(t[i], t[i+1]; length=25)[2:24] + @test DataInterpolations.derivative.(Ref(itp_DI), t_eval) ≈ + itp_NDI.(t_eval; derivative_orders=(1,)) + end - # Interior data points - t_eval = view(t, 2:(n - 1)) - @test isapprox_or_nan( - DataInterpolations.derivative.(Ref(itp_DI), t_eval), - itp_NDI.(t_eval; derivative_orders = (1,)) - ) + # Interior data points + t_eval = view(t, 2:(n-1)) + @test isapprox_or_nan( + DataInterpolations.derivative.(Ref(itp_DI), t_eval), + itp_NDI.(t_eval; derivative_orders=(1,)) + ) - # Boundary points - t_eval = [first(t), last(t)] - return @test isapprox_or_nan( - DataInterpolations.derivative.(Ref(itp_DI), t_eval), - itp_NDI.(t_eval; derivative_orders = (1,)) - ) -end + # Boundary points + t_eval = [first(t), last(t)] + return @test isapprox_or_nan( + DataInterpolations.derivative.(Ref(itp_DI), t_eval), + itp_NDI.(t_eval; derivative_orders=(1,)) + ) + end -for (itp_dim_type, itp_type) in ( + for (itp_dim_type, itp_type) in ( (LinearInterpolationDimension, LinearInterpolation), (ConstantInterpolationDimension, ConstantInterpolation), ) - @testset "$itp_type" begin - interpolation_comparison(itp_dim_type, itp_type) - interpolation_derivative_comparison(itp_dim_type, itp_type) + @testset "$itp_type" begin + interpolation_comparison(itp_dim_type, itp_type) + interpolation_derivative_comparison(itp_dim_type, itp_type) + end end end diff --git a/test/test_derivatives.jl b/test/test_derivatives.jl index 667ba16..388cf8e 100644 --- a/test/test_derivatives.jl +++ b/test/test_derivatives.jl @@ -1,79 +1,80 @@ -using DataInterpolationsND -using ForwardDiff -using Random +@testitem "derivatives" begin + using Random + using ForwardDiff -function test_deriv_10(itp, t) - return @test itp(t; derivative_orders = (1, 0)) ≈ - ForwardDiff.derivative(t₁ -> itp(t₁, t[2]), t[1]) -end + function test_deriv_10(itp, t) + return @test itp(t; derivative_orders=(1, 0)) ≈ + ForwardDiff.derivative(t₁ -> itp(t₁, t[2]), t[1]) + end -function test_deriv_01(itp, t) - return @test itp(t; derivative_orders = (0, 1)) ≈ - ForwardDiff.derivative(t₂ -> itp(t[1], t₂), t[2]) -end + function test_deriv_01(itp, t) + return @test itp(t; derivative_orders=(0, 1)) ≈ + ForwardDiff.derivative(t₂ -> itp(t[1], t₂), t[2]) + end -function test_deriv_11(itp, t) - return @test itp(t; derivative_orders = (1, 1)) ≈ - ForwardDiff.derivative( - t₂ -> ForwardDiff.derivative( - t₁ -> itp(t₁, t₂), t[1] - ), - t[2] - ) -end + function test_deriv_11(itp, t) + return @test itp(t; derivative_orders=(1, 1)) ≈ + ForwardDiff.derivative( + t₂ -> ForwardDiff.derivative( + t₁ -> itp(t₁, t₂), t[1] + ), + t[2] + ) + end -function test_derivatives(itp::NDInterpolation{2}) - t1 = itp.interp_dims[1].t - t2 = itp.interp_dims[2].t + function test_derivatives(itp::NDInterpolation{2}) + t1 = itp.interp_dims[1].t + t2 = itp.interp_dims[2].t - # Derivatives in data points - for t in Iterators.product(t1, t2) - test_deriv_10(itp, t) - test_deriv_01(itp, t) - test_deriv_11(itp, t) - end + # Derivatives in data points + for t in Iterators.product(t1, t2) + test_deriv_10(itp, t) + test_deriv_01(itp, t) + test_deriv_11(itp, t) + end - # Derivatives between data points - for t in Iterators.product( - t1[1:(end - 1)] + diff(t1) / 2, t2[1:(end - 1)] + diff(t2) / 2 + # Derivatives between data points + for t in Iterators.product( + t1[1:(end-1)] + diff(t1) / 2, t2[1:(end-1)] + diff(t2) / 2 ) - test_deriv_10(itp, t) - test_deriv_01(itp, t) - test_deriv_11(itp, t) + test_deriv_10(itp, t) + test_deriv_01(itp, t) + test_deriv_11(itp, t) + end + return end - return -end -@testset "Linear Interpolation" begin - Random.seed!(1) - t1 = [1.0, 2.0, 3.5, 4.0, 10.0] - t2 = [-1.5, 0.0, 2.5, 7.8, 12.9] - u = rand(5, 5) - itp_dims = ( - LinearInterpolationDimension(t1), - LinearInterpolationDimension(t2), - ) - itp = NDInterpolation(u, itp_dims) - test_derivatives(itp) -end + @testset "Linear Interpolation" begin + Random.seed!(1) + t1 = [1.0, 2.0, 3.5, 4.0, 10.0] + t2 = [-1.5, 0.0, 2.5, 7.8, 12.9] + u = rand(5, 5) + itp_dims = ( + LinearInterpolationDimension(t1), + LinearInterpolationDimension(t2), + ) + itp = NDInterpolation(u, itp_dims) + test_derivatives(itp) + end -@testset "BSpline interpolation" begin - Random.seed!(1) - t1 = [1.0, 2.0, 3.5, 4.0, 10.0] - t2 = [-1.5, 0.0, 2.5, 7.8, 12.9] - u = rand(6, 6) - itp_dims = ( - BSplineInterpolationDimension(t1, 2), - BSplineInterpolationDimension(t2, 2), - ) - itp = NDInterpolation(u, itp_dims) - test_derivatives(itp) + @testset "BSpline interpolation" begin + Random.seed!(1) + t1 = [1.0, 2.0, 3.5, 4.0, 10.0] + t2 = [-1.5, 0.0, 2.5, 7.8, 12.9] + u = rand(6, 6) + itp_dims = ( + BSplineInterpolationDimension(t1, 2), + BSplineInterpolationDimension(t2, 2), + ) + itp = NDInterpolation(u, itp_dims) + test_derivatives(itp) - u = rand(9, 9) - itp_dims = ( - BSplineInterpolationDimension(t1, 5), - BSplineInterpolationDimension(t2, 5), - ) - itp = NDInterpolation(u, itp_dims) - test_derivatives(itp) + u = rand(9, 9) + itp_dims = ( + BSplineInterpolationDimension(t1, 5), + BSplineInterpolationDimension(t2, 5), + ) + itp = NDInterpolation(u, itp_dims) + test_derivatives(itp) + end end diff --git a/test/test_interface.jl b/test/test_interface.jl index 3f8426d..4d1fdb7 100644 --- a/test/test_interface.jl +++ b/test/test_interface.jl @@ -4,7 +4,7 @@ using Test # Interface tests to verify the package properly adheres to Julia's standard interfaces # and SciML's array/number interfaces. Uses BigFloat to test numeric type genericity. -@testset "BigFloat Support" begin +@testitem "BigFloat Support" begin @testset "LinearInterpolationDimension" begin t = BigFloat[1.0, 2.0, 3.0, 4.0] t_eval = BigFloat[1.5, 2.5] @@ -12,7 +12,7 @@ using Test itp_dim = LinearInterpolationDimension(t) @test eltype(itp_dim.t) == BigFloat - itp_dim_eval = LinearInterpolationDimension(t; t_eval = t_eval) + itp_dim_eval = LinearInterpolationDimension(t; t_eval=t_eval) @test eltype(itp_dim_eval.t_eval) == BigFloat end @@ -23,7 +23,7 @@ using Test itp_dim = ConstantInterpolationDimension(t) @test eltype(itp_dim.t) == BigFloat - itp_dim_eval = ConstantInterpolationDimension(t; t_eval = t_eval) + itp_dim_eval = ConstantInterpolationDimension(t; t_eval=t_eval) @test eltype(itp_dim_eval.t_eval) == BigFloat end @@ -36,7 +36,7 @@ using Test @test eltype(itp_dim.knots_all) == BigFloat itp_dim_eval = BSplineInterpolationDimension( - t, 2; t_eval = t_eval, max_derivative_order_eval = 1 + t, 2; t_eval=t_eval, max_derivative_order_eval=1 ) @test eltype(itp_dim_eval.t_eval) == BigFloat @test eltype(itp_dim_eval.basis_function_eval) <: BigFloat @@ -114,8 +114,8 @@ using Test u = rand(BigFloat, 4, 4) itp_dims = ( - LinearInterpolationDimension(t1; t_eval = t1_eval), - LinearInterpolationDimension(t2; t_eval = t2_eval), + LinearInterpolationDimension(t1; t_eval=t1_eval), + LinearInterpolationDimension(t2; t_eval=t2_eval), ) itp = NDInterpolation(u, itp_dims) @@ -141,7 +141,7 @@ using Test end end -@testset "Float32 Support" begin +@testitem "Float32 Support" begin @testset "NDInterpolation with Linear" begin t1 = Float32[1.0, 2.0, 3.0, 4.0] t2 = Float32[1.0, 2.0, 3.0, 4.0] @@ -170,8 +170,8 @@ end u = rand(Float32, 4, 4) itp_dims = ( - LinearInterpolationDimension(t1; t_eval = t1_eval), - LinearInterpolationDimension(t2; t_eval = t2_eval), + LinearInterpolationDimension(t1; t_eval=t1_eval), + LinearInterpolationDimension(t2; t_eval=t2_eval), ) itp = NDInterpolation(u, itp_dims) @@ -180,7 +180,7 @@ end end end -@testset "Type Promotion" begin +@testitem "Type Promotion" begin @testset "Mixed precision t and u" begin t1 = Float32[1.0, 2.0, 3.0, 4.0] t2 = Float32[1.0, 2.0, 3.0, 4.0] diff --git a/test/test_interpolations.jl b/test/test_interpolations.jl index 1a3075e..fa6e1da 100644 --- a/test/test_interpolations.jl +++ b/test/test_interpolations.jl @@ -1,70 +1,6 @@ -using DataInterpolationsND: AbstractInterpolationDimension, EmptyCache -using DataInterpolationsND -using Random -function test_globally_constant( - ID::Type{<:AbstractInterpolationDimension}; args1 = (), args2 = (), kwargs1 = (), - kwargs2 = (), cache = EmptyCache(), test_derivatives = true - ) - t1 = [-3.14, 1.0, 3.0, 7.6, 12.8] - t2 = [-2.71, 1.41, 12.76, 50.2, 120.0] - - u = if ID == BSplineInterpolationDimension - fill(2.0, 4 + args1[1], 4 + args2[1]) - else - fill(2.0, 5, 5) - end - - # Evaluation in data points - itp_dims = ( - ID(t1, args1...; t_eval = t1, kwargs1...), - ID(t2, args2...; t_eval = t2, kwargs2...), - ) - - itp = NDInterpolation(u, itp_dims; cache) - @test all(x -> isapprox(x, 2.0; atol = 1.0e-10), eval_grid(itp)) - if test_derivatives - @test all( - x -> isapprox(x, 0.0; atol = 1.0e-10), eval_grid(itp, derivative_orders = (1, 0)) - ) - @test all( - x -> isapprox(x, 0.0; atol = 1.0e-10), eval_grid(itp, derivative_orders = (0, 1)) - ) - end - - # Evaluation between data points - itp_dims = ( - ID(t1, args1...; t_eval = t1[1:(end - 1)] + diff(t1) / 2, kwargs1...), - ID(t2, args2...; t_eval = t2[1:(end - 1)] + diff(t2) / 2, kwargs2...), - ) - itp = NDInterpolation(u, itp_dims) - @test all(x -> isapprox(x, 2.0; atol = 1.0e-10), eval_grid(itp)) - return if test_derivatives - @test all( - x -> isapprox(x, 0.0; atol = 1.0e-10), eval_grid(itp, derivative_orders = (1, 0)) - ) - @test all( - x -> isapprox(x, 0.0; atol = 1.0e-10), eval_grid(itp, derivative_orders = (0, 1)) - ) - end -end - -function test_analytic(itp::NDInterpolation{N_in}, f) where {N_in} - # Evaluation in data points - ts = ntuple(dim_in -> itp.interp_dims[dim_in].t, N_in) - for t in Iterators.product(ts...) - @test itp(t) ≈ f(t...) - end - - # Evaluation between data points - ts_ = ntuple(dim_in -> ts[dim_in][1:(end - 1)] + diff(ts[dim_in]) / 2, N_in) - for t in Iterators.product(ts_...) - @test itp(t) ≈ f(t...) - end - return -end - -@testset "Linear Interpolation" begin +@testitem "Linear Interpolation" begin + include("utils.jl") test_globally_constant(LinearInterpolationDimension) f(t1, t2) = 3.0 + 2.3t1 - 4.7t2 @@ -82,11 +18,12 @@ end test_analytic(itp, f) end -@testset "BSpline Interpolation" begin +@testitem "BSpline Interpolation" begin + include("utils.jl") test_globally_constant( - BSplineInterpolationDimension, args1 = (2,), args2 = (3,), - kwargs1 = (:max_derivative_order_eval => 1,), - kwargs2 = (:max_derivative_order_eval => 1,) + BSplineInterpolationDimension, args1=(2,), args2=(3,), + kwargs1=(:max_derivative_order_eval => 1,), + kwargs2=(:max_derivative_order_eval => 1,) ) f(t1, t2, t3) = t1^2 + t2^2 + t3^2 @@ -102,22 +39,22 @@ end test_analytic(itp, f) end -@testset "NURBS Interpolation" begin - Random.seed!(10) +@testitem "NURBS Interpolation" begin + include("utils.jl") test_globally_constant( - BSplineInterpolationDimension; args1 = (3,), args2 = (1,), - kwargs1 = (:max_derivative_order_eval => 1,), - kwargs2 = (:max_derivative_order_eval => 1,), - cache = NURBSWeights(rand(7, 5)), - test_derivatives = false + BSplineInterpolationDimension; args1=(3,), args2=(1,), + kwargs1=(:max_derivative_order_eval => 1,), + kwargs2=(:max_derivative_order_eval => 1,), + cache=NURBSWeights(rand(7, 5)), + test_derivatives=false ) ## Circle representation # Knots - t = collect(0:(π / 2):(2π)) + t = collect(0:(π/2):(2π)) - t_eval = collect(range(0, 2π, length = 100)) + t_eval = collect(range(0, 2π, length=100)) # Multiplicities multiplicities = [3, 2, 2, 2, 3] diff --git a/test/test_symbolics_ext.jl b/test/test_symbolics_ext.jl index 1b63629..f87d4da 100644 --- a/test/test_symbolics_ext.jl +++ b/test/test_symbolics_ext.jl @@ -1,23 +1,8 @@ -using DataInterpolationsND -using Symbolics -import SymbolicUtils as SU -using Symbolics: unwrap -using Test +@testitem "Basics" begin + include("utils.jl") + interp = get_interp() + @variables x y -t1 = cumsum(rand(5)) -t2 = cumsum(rand(7)) - -interpolation_dimensions = ( - LinearInterpolationDimension(t1), - LinearInterpolationDimension(t2), -) - -u = rand(5, 7, 2) - -interp = NDInterpolation(u, interpolation_dimensions) -@variables x y - -@testset "Basics" begin ex = interp(x, y) @test ex isa Symbolics.Arr @test size(ex) == (2,) @@ -36,7 +21,11 @@ interp = NDInterpolation(u, interpolation_dimensions) @test ex isa SU.BasicSymbolic{Vector{Real}} end -@testset "Differentiation" begin +@testitem "Differentiation" begin + include("utils.jl") + interp = get_interp() + @variables x y + ex = interp(x, y) der = Symbolics.derivative(ex[1], x) @test size(der) == () @@ -48,7 +37,7 @@ end end end ) - @test res ≈ interp(0.4, 0.8; derivative_orders = (1, 0))[1] + @test res ≈ interp(0.4, 0.8; derivative_orders=(1, 0))[1] der = Symbolics.derivative(ex[1], y) @test size(der) == () @@ -60,5 +49,5 @@ end end end ) - @test res ≈ interp(0.4, 0.8; derivative_orders = (0, 1))[1] + @test res ≈ interp(0.4, 0.8; derivative_orders=(0, 1))[1] end diff --git a/test/utils.jl b/test/utils.jl new file mode 100644 index 0000000..6e275e0 --- /dev/null +++ b/test/utils.jl @@ -0,0 +1,90 @@ +using Random +using ForwardDiff +using DataInterpolationsND: AbstractInterpolationDimension, EmptyCache +using Symbolics +import SymbolicUtils as SU +using Symbolics: unwrap + +### +#### Interpolations +### + +function test_globally_constant( + ID::Type{<:AbstractInterpolationDimension}; args1=(), args2=(), kwargs1=(), + kwargs2=(), cache=EmptyCache(), test_derivatives=true +) + t1 = [-3.14, 1.0, 3.0, 7.6, 12.8] + t2 = [-2.71, 1.41, 12.76, 50.2, 120.0] + + u = if ID == BSplineInterpolationDimension + fill(2.0, 4 + args1[1], 4 + args2[1]) + else + fill(2.0, 5, 5) + end + + # Evaluation in data points + itp_dims = ( + ID(t1, args1...; t_eval=t1, kwargs1...), + ID(t2, args2...; t_eval=t2, kwargs2...), + ) + + itp = NDInterpolation(u, itp_dims; cache) + @test all(x -> isapprox(x, 2.0; atol=1.0e-10), eval_grid(itp)) + if test_derivatives + @test all( + x -> isapprox(x, 0.0; atol=1.0e-10), eval_grid(itp, derivative_orders=(1, 0)) + ) + @test all( + x -> isapprox(x, 0.0; atol=1.0e-10), eval_grid(itp, derivative_orders=(0, 1)) + ) + end + + # Evaluation between data points + itp_dims = ( + ID(t1, args1...; t_eval=t1[1:(end-1)] + diff(t1) / 2, kwargs1...), + ID(t2, args2...; t_eval=t2[1:(end-1)] + diff(t2) / 2, kwargs2...), + ) + itp = NDInterpolation(u, itp_dims) + @test all(x -> isapprox(x, 2.0; atol=1.0e-10), eval_grid(itp)) + return if test_derivatives + @test all( + x -> isapprox(x, 0.0; atol=1.0e-10), eval_grid(itp, derivative_orders=(1, 0)) + ) + @test all( + x -> isapprox(x, 0.0; atol=1.0e-10), eval_grid(itp, derivative_orders=(0, 1)) + ) + end +end + +function test_analytic(itp::NDInterpolation{N_in}, f) where {N_in} + # Evaluation in data points + ts = ntuple(dim_in -> itp.interp_dims[dim_in].t, N_in) + for t in Iterators.product(ts...) + @test itp(t) ≈ f(t...) + end + + # Evaluation between data points + ts_ = ntuple(dim_in -> ts[dim_in][1:(end-1)] + diff(ts[dim_in]) / 2, N_in) + for t in Iterators.product(ts_...) + @test itp(t) ≈ f(t...) + end + return +end + +### +#### Symbolics +### + +function get_interp() + t1 = cumsum(rand(5)) + t2 = cumsum(rand(7)) + + interpolation_dimensions = ( + LinearInterpolationDimension(t1), + LinearInterpolationDimension(t2), + ) + + u = rand(5, 7, 2) + + return NDInterpolation(u, interpolation_dimensions) +end \ No newline at end of file From 0b05284ccd84b50904414eeab04829d56fdbef4e Mon Sep 17 00:00:00 2001 From: Bart de Koning Date: Sun, 15 Feb 2026 15:46:42 +0100 Subject: [PATCH 02/13] Formatting --- test/runtests.jl | 4 +-- test/test_datainterpolations_comparison.jl | 36 +++++++++++----------- test/test_derivatives.jl | 16 +++++----- test/test_interface.jl | 14 ++++----- test/test_interpolations.jl | 21 ++++++------- test/test_symbolics_ext.jl | 4 +-- test/utils.jl | 30 +++++++++--------- 7 files changed, 62 insertions(+), 63 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 64adf48..4953327 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,13 +3,13 @@ const GROUP = get(ENV, "GROUP", "All") function activate_gpu_env() Pkg.activate("gpu") - Pkg.develop(PackageSpec(path=dirname(@__DIR__))) + Pkg.develop(PackageSpec(path = dirname(@__DIR__))) return Pkg.instantiate() end function activate_qa_env() Pkg.activate("qa") - Pkg.develop(PackageSpec(path=dirname(@__DIR__))) + Pkg.develop(PackageSpec(path = dirname(@__DIR__))) return Pkg.instantiate() end diff --git a/test/test_datainterpolations_comparison.jl b/test/test_datainterpolations_comparison.jl index aa5b6e8..ba9bda3 100644 --- a/test/test_datainterpolations_comparison.jl +++ b/test/test_datainterpolations_comparison.jl @@ -4,9 +4,9 @@ isapprox_or_nan(v1, v2) = (v1 ≈ v2) || (all(isnan, v1) && all(isnan, v2)) function interpolation_comparison( - itp_dim_type::Type{<:DataInterpolationsND.AbstractInterpolationDimension}, - itp_type::Type{<:DataInterpolations.AbstractInterpolation} - ) + itp_dim_type::Type{<:DataInterpolationsND.AbstractInterpolationDimension}, + itp_type::Type{<:DataInterpolations.AbstractInterpolation} + ) t = [0.0, 0.2, 0.5, 0.7, 0.9, 1.1] u = [1.5, -5.3, 0.5, 3.3, 3.6, 1.0] @@ -16,13 +16,13 @@ itp_NDI = NDInterpolation(u, itp_dim_type(t)) # Interior non data points - for i in 1:(n-1) - t_eval = range(t[i], t[i+1]; length=25)[2:24] + for i in 1:(n - 1) + t_eval = range(t[i], t[i + 1]; length = 25)[2:24] @test itp_DI(t_eval) ≈ itp_NDI.(t_eval) end # Interior data points - t_eval = view(t, 2:(n-1)) + t_eval = view(t, 2:(n - 1)) @test itp_DI(t_eval) ≈ itp_NDI.(t_eval) # Boundary points @@ -31,9 +31,9 @@ end function interpolation_derivative_comparison( - itp_dim_type::Type{<:DataInterpolationsND.AbstractInterpolationDimension}, - itp_type::Type{<:DataInterpolations.AbstractInterpolation} - ) + itp_dim_type::Type{<:DataInterpolationsND.AbstractInterpolationDimension}, + itp_type::Type{<:DataInterpolations.AbstractInterpolation} + ) t = [0.0, 0.2, 0.5, 0.7, 0.9, 1.1] u = [1.5, -5.3, 0.5, 3.3, 3.6, 1.0] @@ -43,31 +43,31 @@ itp_NDI = NDInterpolation(u, itp_dim_type(t)) # Interior non data points - for i in 1:(n-1) - t_eval = range(t[i], t[i+1]; length=25)[2:24] + for i in 1:(n - 1) + t_eval = range(t[i], t[i + 1]; length = 25)[2:24] @test DataInterpolations.derivative.(Ref(itp_DI), t_eval) ≈ - itp_NDI.(t_eval; derivative_orders=(1,)) + itp_NDI.(t_eval; derivative_orders = (1,)) end # Interior data points - t_eval = view(t, 2:(n-1)) + t_eval = view(t, 2:(n - 1)) @test isapprox_or_nan( DataInterpolations.derivative.(Ref(itp_DI), t_eval), - itp_NDI.(t_eval; derivative_orders=(1,)) + itp_NDI.(t_eval; derivative_orders = (1,)) ) # Boundary points t_eval = [first(t), last(t)] return @test isapprox_or_nan( DataInterpolations.derivative.(Ref(itp_DI), t_eval), - itp_NDI.(t_eval; derivative_orders=(1,)) + itp_NDI.(t_eval; derivative_orders = (1,)) ) end for (itp_dim_type, itp_type) in ( - (LinearInterpolationDimension, LinearInterpolation), - (ConstantInterpolationDimension, ConstantInterpolation), - ) + (LinearInterpolationDimension, LinearInterpolation), + (ConstantInterpolationDimension, ConstantInterpolation), + ) @testset "$itp_type" begin interpolation_comparison(itp_dim_type, itp_type) interpolation_derivative_comparison(itp_dim_type, itp_type) diff --git a/test/test_derivatives.jl b/test/test_derivatives.jl index 388cf8e..e12a4c1 100644 --- a/test/test_derivatives.jl +++ b/test/test_derivatives.jl @@ -3,18 +3,18 @@ using ForwardDiff function test_deriv_10(itp, t) - return @test itp(t; derivative_orders=(1, 0)) ≈ - ForwardDiff.derivative(t₁ -> itp(t₁, t[2]), t[1]) + return @test itp(t; derivative_orders = (1, 0)) ≈ + ForwardDiff.derivative(t₁ -> itp(t₁, t[2]), t[1]) end function test_deriv_01(itp, t) - return @test itp(t; derivative_orders=(0, 1)) ≈ - ForwardDiff.derivative(t₂ -> itp(t[1], t₂), t[2]) + return @test itp(t; derivative_orders = (0, 1)) ≈ + ForwardDiff.derivative(t₂ -> itp(t[1], t₂), t[2]) end function test_deriv_11(itp, t) - return @test itp(t; derivative_orders=(1, 1)) ≈ - ForwardDiff.derivative( + return @test itp(t; derivative_orders = (1, 1)) ≈ + ForwardDiff.derivative( t₂ -> ForwardDiff.derivative( t₁ -> itp(t₁, t₂), t[1] ), @@ -35,8 +35,8 @@ # Derivatives between data points for t in Iterators.product( - t1[1:(end-1)] + diff(t1) / 2, t2[1:(end-1)] + diff(t2) / 2 - ) + t1[1:(end - 1)] + diff(t1) / 2, t2[1:(end - 1)] + diff(t2) / 2 + ) test_deriv_10(itp, t) test_deriv_01(itp, t) test_deriv_11(itp, t) diff --git a/test/test_interface.jl b/test/test_interface.jl index 4d1fdb7..55dd3e2 100644 --- a/test/test_interface.jl +++ b/test/test_interface.jl @@ -12,7 +12,7 @@ using Test itp_dim = LinearInterpolationDimension(t) @test eltype(itp_dim.t) == BigFloat - itp_dim_eval = LinearInterpolationDimension(t; t_eval=t_eval) + itp_dim_eval = LinearInterpolationDimension(t; t_eval = t_eval) @test eltype(itp_dim_eval.t_eval) == BigFloat end @@ -23,7 +23,7 @@ using Test itp_dim = ConstantInterpolationDimension(t) @test eltype(itp_dim.t) == BigFloat - itp_dim_eval = ConstantInterpolationDimension(t; t_eval=t_eval) + itp_dim_eval = ConstantInterpolationDimension(t; t_eval = t_eval) @test eltype(itp_dim_eval.t_eval) == BigFloat end @@ -36,7 +36,7 @@ using Test @test eltype(itp_dim.knots_all) == BigFloat itp_dim_eval = BSplineInterpolationDimension( - t, 2; t_eval=t_eval, max_derivative_order_eval=1 + t, 2; t_eval = t_eval, max_derivative_order_eval = 1 ) @test eltype(itp_dim_eval.t_eval) == BigFloat @test eltype(itp_dim_eval.basis_function_eval) <: BigFloat @@ -114,8 +114,8 @@ using Test u = rand(BigFloat, 4, 4) itp_dims = ( - LinearInterpolationDimension(t1; t_eval=t1_eval), - LinearInterpolationDimension(t2; t_eval=t2_eval), + LinearInterpolationDimension(t1; t_eval = t1_eval), + LinearInterpolationDimension(t2; t_eval = t2_eval), ) itp = NDInterpolation(u, itp_dims) @@ -170,8 +170,8 @@ end u = rand(Float32, 4, 4) itp_dims = ( - LinearInterpolationDimension(t1; t_eval=t1_eval), - LinearInterpolationDimension(t2; t_eval=t2_eval), + LinearInterpolationDimension(t1; t_eval = t1_eval), + LinearInterpolationDimension(t2; t_eval = t2_eval), ) itp = NDInterpolation(u, itp_dims) diff --git a/test/test_interpolations.jl b/test/test_interpolations.jl index fa6e1da..bab2094 100644 --- a/test/test_interpolations.jl +++ b/test/test_interpolations.jl @@ -1,4 +1,3 @@ - @testitem "Linear Interpolation" begin include("utils.jl") test_globally_constant(LinearInterpolationDimension) @@ -21,9 +20,9 @@ end @testitem "BSpline Interpolation" begin include("utils.jl") test_globally_constant( - BSplineInterpolationDimension, args1=(2,), args2=(3,), - kwargs1=(:max_derivative_order_eval => 1,), - kwargs2=(:max_derivative_order_eval => 1,) + BSplineInterpolationDimension, args1 = (2,), args2 = (3,), + kwargs1 = (:max_derivative_order_eval => 1,), + kwargs2 = (:max_derivative_order_eval => 1,) ) f(t1, t2, t3) = t1^2 + t2^2 + t3^2 @@ -43,18 +42,18 @@ end include("utils.jl") test_globally_constant( - BSplineInterpolationDimension; args1=(3,), args2=(1,), - kwargs1=(:max_derivative_order_eval => 1,), - kwargs2=(:max_derivative_order_eval => 1,), - cache=NURBSWeights(rand(7, 5)), - test_derivatives=false + BSplineInterpolationDimension; args1 = (3,), args2 = (1,), + kwargs1 = (:max_derivative_order_eval => 1,), + kwargs2 = (:max_derivative_order_eval => 1,), + cache = NURBSWeights(rand(7, 5)), + test_derivatives = false ) ## Circle representation # Knots - t = collect(0:(π/2):(2π)) + t = collect(0:(π / 2):(2π)) - t_eval = collect(range(0, 2π, length=100)) + t_eval = collect(range(0, 2π, length = 100)) # Multiplicities multiplicities = [3, 2, 2, 2, 3] diff --git a/test/test_symbolics_ext.jl b/test/test_symbolics_ext.jl index f87d4da..129598a 100644 --- a/test/test_symbolics_ext.jl +++ b/test/test_symbolics_ext.jl @@ -37,7 +37,7 @@ end end end ) - @test res ≈ interp(0.4, 0.8; derivative_orders=(1, 0))[1] + @test res ≈ interp(0.4, 0.8; derivative_orders = (1, 0))[1] der = Symbolics.derivative(ex[1], y) @test size(der) == () @@ -49,5 +49,5 @@ end end end ) - @test res ≈ interp(0.4, 0.8; derivative_orders=(0, 1))[1] + @test res ≈ interp(0.4, 0.8; derivative_orders = (0, 1))[1] end diff --git a/test/utils.jl b/test/utils.jl index 6e275e0..8928c87 100644 --- a/test/utils.jl +++ b/test/utils.jl @@ -10,9 +10,9 @@ using Symbolics: unwrap ### function test_globally_constant( - ID::Type{<:AbstractInterpolationDimension}; args1=(), args2=(), kwargs1=(), - kwargs2=(), cache=EmptyCache(), test_derivatives=true -) + ID::Type{<:AbstractInterpolationDimension}; args1 = (), args2 = (), kwargs1 = (), + kwargs2 = (), cache = EmptyCache(), test_derivatives = true + ) t1 = [-3.14, 1.0, 3.0, 7.6, 12.8] t2 = [-2.71, 1.41, 12.76, 50.2, 120.0] @@ -24,34 +24,34 @@ function test_globally_constant( # Evaluation in data points itp_dims = ( - ID(t1, args1...; t_eval=t1, kwargs1...), - ID(t2, args2...; t_eval=t2, kwargs2...), + ID(t1, args1...; t_eval = t1, kwargs1...), + ID(t2, args2...; t_eval = t2, kwargs2...), ) itp = NDInterpolation(u, itp_dims; cache) - @test all(x -> isapprox(x, 2.0; atol=1.0e-10), eval_grid(itp)) + @test all(x -> isapprox(x, 2.0; atol = 1.0e-10), eval_grid(itp)) if test_derivatives @test all( - x -> isapprox(x, 0.0; atol=1.0e-10), eval_grid(itp, derivative_orders=(1, 0)) + x -> isapprox(x, 0.0; atol = 1.0e-10), eval_grid(itp, derivative_orders = (1, 0)) ) @test all( - x -> isapprox(x, 0.0; atol=1.0e-10), eval_grid(itp, derivative_orders=(0, 1)) + x -> isapprox(x, 0.0; atol = 1.0e-10), eval_grid(itp, derivative_orders = (0, 1)) ) end # Evaluation between data points itp_dims = ( - ID(t1, args1...; t_eval=t1[1:(end-1)] + diff(t1) / 2, kwargs1...), - ID(t2, args2...; t_eval=t2[1:(end-1)] + diff(t2) / 2, kwargs2...), + ID(t1, args1...; t_eval = t1[1:(end - 1)] + diff(t1) / 2, kwargs1...), + ID(t2, args2...; t_eval = t2[1:(end - 1)] + diff(t2) / 2, kwargs2...), ) itp = NDInterpolation(u, itp_dims) - @test all(x -> isapprox(x, 2.0; atol=1.0e-10), eval_grid(itp)) + @test all(x -> isapprox(x, 2.0; atol = 1.0e-10), eval_grid(itp)) return if test_derivatives @test all( - x -> isapprox(x, 0.0; atol=1.0e-10), eval_grid(itp, derivative_orders=(1, 0)) + x -> isapprox(x, 0.0; atol = 1.0e-10), eval_grid(itp, derivative_orders = (1, 0)) ) @test all( - x -> isapprox(x, 0.0; atol=1.0e-10), eval_grid(itp, derivative_orders=(0, 1)) + x -> isapprox(x, 0.0; atol = 1.0e-10), eval_grid(itp, derivative_orders = (0, 1)) ) end end @@ -64,7 +64,7 @@ function test_analytic(itp::NDInterpolation{N_in}, f) where {N_in} end # Evaluation between data points - ts_ = ntuple(dim_in -> ts[dim_in][1:(end-1)] + diff(ts[dim_in]) / 2, N_in) + ts_ = ntuple(dim_in -> ts[dim_in][1:(end - 1)] + diff(ts[dim_in]) / 2, N_in) for t in Iterators.product(ts_...) @test itp(t) ≈ f(t...) end @@ -87,4 +87,4 @@ function get_interp() u = rand(5, 7, 2) return NDInterpolation(u, interpolation_dimensions) -end \ No newline at end of file +end From 45d3ad0909b969399b602afd5bff4adce64b7a7e Mon Sep 17 00:00:00 2001 From: Bart de Koning Date: Sun, 15 Feb 2026 15:52:34 +0100 Subject: [PATCH 03/13] qa --- test/qa/aqua.jl | 5 ++--- test/qa/explicit_imports.jl | 8 +++----- test/qa/jet.jl | 12 ++++++------ test/qa/runtests.jl | 6 ++---- 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/test/qa/aqua.jl b/test/qa/aqua.jl index 8728c99..ad2539e 100644 --- a/test/qa/aqua.jl +++ b/test/qa/aqua.jl @@ -1,6 +1,5 @@ -using Aqua -using DataInterpolationsND - @testset "Aqua" begin + using Aqua + using DataInterpolationsND Aqua.test_all(DataInterpolationsND) end diff --git a/test/qa/explicit_imports.jl b/test/qa/explicit_imports.jl index f5de23f..55fbec9 100644 --- a/test/qa/explicit_imports.jl +++ b/test/qa/explicit_imports.jl @@ -1,8 +1,6 @@ -using ExplicitImports -using DataInterpolationsND -using Test - -@testset "ExplicitImports" begin +@testitem "ExplicitImports" begin + using ExplicitImports + using DataInterpolationsND @test check_no_implicit_imports(DataInterpolationsND) === nothing @test check_no_stale_explicit_imports(DataInterpolationsND) === nothing end diff --git a/test/qa/jet.jl b/test/qa/jet.jl index 3e11630..5a8fd16 100644 --- a/test/qa/jet.jl +++ b/test/qa/jet.jl @@ -1,8 +1,6 @@ -using JET -using DataInterpolationsND -using Test - -@testset "JET static analysis" begin +@testitem "JET static analysis" begin + using JET + using DataInterpolationsND # Linear interpolation setup t1 = [-3.14, 1.0, 3.0, 7.6, 12.8] t2 = [-2.71, 1.41, 12.76, 50.2, 120.0] @@ -118,7 +116,9 @@ using Test end end -@testset "JET type optimization" begin +@testitem "JET type optimization" begin + using JET + using DataInterpolationsND # Linear interpolation setup t1 = [-3.14, 1.0, 3.0, 7.6, 12.8] t2 = [-2.71, 1.41, 12.76, 50.2, 120.0] diff --git a/test/qa/runtests.jl b/test/qa/runtests.jl index a0846f9..b9e874d 100644 --- a/test/qa/runtests.jl +++ b/test/qa/runtests.jl @@ -1,5 +1,3 @@ -using SafeTestsets +using TestItemRunner -@safetestset "Aqua" include("aqua.jl") -@safetestset "ExplicitImports" include("explicit_imports.jl") -@safetestset "JET" include("jet.jl") +@run_package_tests From 0829c06f6b4b6aa6c57f0f0fa9d20acb45bebf90 Mon Sep 17 00:00:00 2001 From: Bart de Koning Date: Sun, 15 Feb 2026 15:56:14 +0100 Subject: [PATCH 04/13] Also run Extensions tests --- .github/workflows/Tests.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 39e9d56..b321299 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -5,14 +5,14 @@ on: branches: - main paths-ignore: - - 'docs/**' + - "docs/**" push: branches: - main paths-ignore: - - 'docs/**' + - "docs/**" schedule: - - cron: '59 12 * * 2' + - cron: "59 12 * * 2" concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -26,6 +26,7 @@ jobs: matrix: group: - Core + - Extensions - QA version: - "1" From 5cf4cf645b7d699e70cd8075c20192ef4b8ec185 Mon Sep 17 00:00:00 2001 From: Bart de Koning Date: Sun, 15 Feb 2026 16:06:22 +0100 Subject: [PATCH 05/13] Cleanup --- test/test_interpolations.jl | 1 + test/utils.jl | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/test/test_interpolations.jl b/test/test_interpolations.jl index bab2094..66e1aaf 100644 --- a/test/test_interpolations.jl +++ b/test/test_interpolations.jl @@ -1,4 +1,5 @@ @testitem "Linear Interpolation" begin + using Random include("utils.jl") test_globally_constant(LinearInterpolationDimension) diff --git a/test/utils.jl b/test/utils.jl index 8928c87..54d2ffb 100644 --- a/test/utils.jl +++ b/test/utils.jl @@ -1,9 +1,4 @@ -using Random -using ForwardDiff using DataInterpolationsND: AbstractInterpolationDimension, EmptyCache -using Symbolics -import SymbolicUtils as SU -using Symbolics: unwrap ### #### Interpolations From 2f633fb4c05660bb150bce7574238e9ce3e2f90b Mon Sep 17 00:00:00 2001 From: Bart de Koning Date: Sun, 15 Feb 2026 17:10:43 +0100 Subject: [PATCH 06/13] Test --- test/test_symbolics_ext.jl | 38 ++++++++++++++++++++++++++++++++------ test/utils.jl | 18 ------------------ 2 files changed, 32 insertions(+), 24 deletions(-) diff --git a/test/test_symbolics_ext.jl b/test/test_symbolics_ext.jl index 129598a..187da52 100644 --- a/test/test_symbolics_ext.jl +++ b/test/test_symbolics_ext.jl @@ -1,6 +1,20 @@ @testitem "Basics" begin - include("utils.jl") - interp = get_interp() + println("foo") + using Symbolics + using Symbolics: unwrap + import SymbolicUtils as SU + + t1 = cumsum(rand(5)) + t2 = cumsum(rand(7)) + + interpolation_dimensions = ( + LinearInterpolationDimension(t1), + LinearInterpolationDimension(t2), + ) + + u = rand(5, 7, 2) + interp = NDInterpolation(u, interpolation_dimensions) + @variables x y ex = interp(x, y) @@ -22,8 +36,20 @@ end @testitem "Differentiation" begin - include("utils.jl") - interp = get_interp() + using Symbolics + import SymbolicUtils as SU + + t1 = cumsum(rand(5)) + t2 = cumsum(rand(7)) + + interpolation_dimensions = ( + LinearInterpolationDimension(t1), + LinearInterpolationDimension(t2), + ) + + u = rand(5, 7, 2) + interp = NDInterpolation(u, interpolation_dimensions) + @variables x y ex = interp(x, y) @@ -37,7 +63,7 @@ end end end ) - @test res ≈ interp(0.4, 0.8; derivative_orders = (1, 0))[1] + @test res ≈ interp(0.4, 0.8; derivative_orders=(1, 0))[1] der = Symbolics.derivative(ex[1], y) @test size(der) == () @@ -49,5 +75,5 @@ end end end ) - @test res ≈ interp(0.4, 0.8; derivative_orders = (0, 1))[1] + @test res ≈ interp(0.4, 0.8; derivative_orders=(0, 1))[1] end diff --git a/test/utils.jl b/test/utils.jl index 54d2ffb..37a18a3 100644 --- a/test/utils.jl +++ b/test/utils.jl @@ -65,21 +65,3 @@ function test_analytic(itp::NDInterpolation{N_in}, f) where {N_in} end return end - -### -#### Symbolics -### - -function get_interp() - t1 = cumsum(rand(5)) - t2 = cumsum(rand(7)) - - interpolation_dimensions = ( - LinearInterpolationDimension(t1), - LinearInterpolationDimension(t2), - ) - - u = rand(5, 7, 2) - - return NDInterpolation(u, interpolation_dimensions) -end From 14d9204213746d47c1005b4ba91a3dfe5d19d300 Mon Sep 17 00:00:00 2001 From: Bart de Koning Date: Sun, 15 Feb 2026 18:06:31 +0100 Subject: [PATCH 07/13] Another test --- test/qa/aqua.jl | 2 +- test/runtests.jl | 9 ++++++--- test/test_symbolics_ext.jl | 1 - 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/test/qa/aqua.jl b/test/qa/aqua.jl index ad2539e..fe01f71 100644 --- a/test/qa/aqua.jl +++ b/test/qa/aqua.jl @@ -1,4 +1,4 @@ -@testset "Aqua" begin +@testitem "Aqua" begin using Aqua using DataInterpolationsND Aqua.test_all(DataInterpolationsND) diff --git a/test/runtests.jl b/test/runtests.jl index 4953327..c8d93b6 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,19 +3,22 @@ const GROUP = get(ENV, "GROUP", "All") function activate_gpu_env() Pkg.activate("gpu") - Pkg.develop(PackageSpec(path = dirname(@__DIR__))) + Pkg.develop(PackageSpec(path=dirname(@__DIR__))) return Pkg.instantiate() end function activate_qa_env() Pkg.activate("qa") - Pkg.develop(PackageSpec(path = dirname(@__DIR__))) + Pkg.develop(PackageSpec(path=dirname(@__DIR__))) return Pkg.instantiate() end if GROUP == "All" || GROUP == "Core" core_files = ("test_interpolations.jl", "test_derivatives.jl", "test_datainterpolations_comparison.jl", "test_interface.jl") - @run_package_tests filter = ti -> any(endswith(ti.filename, file) for file in core_files) + @run_package_tests filter = ti -> begin + @show ti.filename + any(endswith(ti.filename, file) for file in core_files) + end elseif GROUP == "Extensions" extension_files = ("test_symbolics_ext.jl",) @run_package_tests filter = ti -> any(endswith(ti.filename, file) for file in extension_files) diff --git a/test/test_symbolics_ext.jl b/test/test_symbolics_ext.jl index 187da52..0a824c5 100644 --- a/test/test_symbolics_ext.jl +++ b/test/test_symbolics_ext.jl @@ -1,5 +1,4 @@ @testitem "Basics" begin - println("foo") using Symbolics using Symbolics: unwrap import SymbolicUtils as SU From 36c50857de80395f87e1a9771dd80a5d10b7b07e Mon Sep 17 00:00:00 2001 From: Bart de Koning Date: Sun, 15 Feb 2026 18:39:57 +0100 Subject: [PATCH 08/13] Yet another CI test --- test/runtests.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/test/runtests.jl b/test/runtests.jl index c8d93b6..6bce181 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,6 @@ using TestItemRunner, Pkg const GROUP = get(ENV, "GROUP", "All") +@show GROUP function activate_gpu_env() Pkg.activate("gpu") From 329a4729644131b2476d7136070db6ffd56421c2 Mon Sep 17 00:00:00 2001 From: Bart de Koning Date: Sun, 15 Feb 2026 18:57:14 +0100 Subject: [PATCH 09/13] Pass group in workflow --- .github/workflows/Tests.yml | 1 + .vscode/settings.json | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index b321299..23c0134 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -41,6 +41,7 @@ jobs: version: "pre" uses: "SciML/.github/.github/workflows/tests.yml@v1" with: + group: "${{ matrix.group }}" julia-version: "${{ matrix.version }}" os: "${{ matrix.os }}" secrets: "inherit" diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..7e4324e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,9 @@ +{ + "julia.format.calls": true, + "[julia]": { + "editor.defaultFormatter": "julialang.language-julia", + "editor.formatOnSave": true, + "editor.formatOnType": false, + "editor.formatOnPaste": true + } +} \ No newline at end of file From 8d7de142afee58110f42c9c86e111d2dcabf29e1 Mon Sep 17 00:00:00 2001 From: Bart de Koning Date: Sun, 15 Feb 2026 18:57:46 +0100 Subject: [PATCH 10/13] Remove settings.json --- .vscode/settings.json | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 7e4324e..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "julia.format.calls": true, - "[julia]": { - "editor.defaultFormatter": "julialang.language-julia", - "editor.formatOnSave": true, - "editor.formatOnType": false, - "editor.formatOnPaste": true - } -} \ No newline at end of file From 533232ba612e4f2c425451debe2e11d321f8d68c Mon Sep 17 00:00:00 2001 From: Bart de Koning Date: Sun, 15 Feb 2026 19:17:34 +0100 Subject: [PATCH 11/13] Cleanup --- test/qa/runtests.jl | 4 +++- test/runtests.jl | 7 ++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/test/qa/runtests.jl b/test/qa/runtests.jl index b9e874d..09d138b 100644 --- a/test/qa/runtests.jl +++ b/test/qa/runtests.jl @@ -1,3 +1,5 @@ using TestItemRunner -@run_package_tests +include("aqua.jl") +include("explicit_imports.jl") +include("jet.jl") diff --git a/test/runtests.jl b/test/runtests.jl index 6bce181..549ac05 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,6 +1,5 @@ using TestItemRunner, Pkg const GROUP = get(ENV, "GROUP", "All") -@show GROUP function activate_gpu_env() Pkg.activate("gpu") @@ -16,10 +15,8 @@ end if GROUP == "All" || GROUP == "Core" core_files = ("test_interpolations.jl", "test_derivatives.jl", "test_datainterpolations_comparison.jl", "test_interface.jl") - @run_package_tests filter = ti -> begin - @show ti.filename - any(endswith(ti.filename, file) for file in core_files) - end + @run_package_tests filter = ti -> any(endswith(ti.filename, file) for file in core_files) + elseif GROUP == "Extensions" extension_files = ("test_symbolics_ext.jl",) @run_package_tests filter = ti -> any(endswith(ti.filename, file) for file in extension_files) From 1ffb9b4afc9634a69456d6610bb975064a9a1ab0 Mon Sep 17 00:00:00 2001 From: Bart de Koning Date: Sun, 15 Feb 2026 20:21:02 +0100 Subject: [PATCH 12/13] QA tests fix --- test/qa/runtests.jl | 6 +++--- test/qa/{aqua.jl => test_qa_aqua.jl} | 0 .../qa/{explicit_imports.jl => test_qa_explicit_imports.jl} | 0 test/qa/{jet.jl => test_qa_jet.jl} | 0 test/runtests.jl | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) rename test/qa/{aqua.jl => test_qa_aqua.jl} (100%) rename test/qa/{explicit_imports.jl => test_qa_explicit_imports.jl} (100%) rename test/qa/{jet.jl => test_qa_jet.jl} (100%) diff --git a/test/qa/runtests.jl b/test/qa/runtests.jl index 09d138b..d95fee9 100644 --- a/test/qa/runtests.jl +++ b/test/qa/runtests.jl @@ -1,5 +1,5 @@ using TestItemRunner -include("aqua.jl") -include("explicit_imports.jl") -include("jet.jl") +include("test_qa_aqua.jl") +include("test_qa_explicit_imports.jl") +include("test_qa_jet.jl") diff --git a/test/qa/aqua.jl b/test/qa/test_qa_aqua.jl similarity index 100% rename from test/qa/aqua.jl rename to test/qa/test_qa_aqua.jl diff --git a/test/qa/explicit_imports.jl b/test/qa/test_qa_explicit_imports.jl similarity index 100% rename from test/qa/explicit_imports.jl rename to test/qa/test_qa_explicit_imports.jl diff --git a/test/qa/jet.jl b/test/qa/test_qa_jet.jl similarity index 100% rename from test/qa/jet.jl rename to test/qa/test_qa_jet.jl diff --git a/test/runtests.jl b/test/runtests.jl index 549ac05..18acd55 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -22,7 +22,7 @@ elseif GROUP == "Extensions" @run_package_tests filter = ti -> any(endswith(ti.filename, file) for file in extension_files) elseif GROUP == "QA" activate_qa_env() - @run_package_tests filter = ti -> endswith(ti.filename, "qa/runtests.jl") + @run_package_tests filter = ti -> contains(ti.filename, r"test_qa_") elseif GROUP == "GPU" activate_gpu_env() # TODO: Add GPU tests From 5c60f2a690769a4c44909d782eb8334704d25497 Mon Sep 17 00:00:00 2001 From: Bart de Koning Date: Sun, 15 Feb 2026 20:54:39 +0100 Subject: [PATCH 13/13] Make Aqua happy --- Project.toml | 1 + src/interpolation_utils.jl | 20 +++++++------------- test/runtests.jl | 4 ++-- test/test_symbolics_ext.jl | 4 ++-- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/Project.toml b/Project.toml index 55522db..eab00fe 100644 --- a/Project.toml +++ b/Project.toml @@ -22,6 +22,7 @@ DataInterpolations = "8" EllipsisNotation = "1.8.0" ForwardDiff = "0" KernelAbstractions = "0.9.34" +Pkg = "1" PrecompileTools = "1.0" Random = "1" RecipesBase = "1.3.4" diff --git a/src/interpolation_utils.jl b/src/interpolation_utils.jl index b0c2db9..b425ac8 100644 --- a/src/interpolation_utils.jl +++ b/src/interpolation_utils.jl @@ -51,24 +51,18 @@ function validate_size_u( return @assert expected_size == size(u)[1:N_in] "Expected the size of the first N_in dimensions of u to be $expected_size based on the BSplineInterpolation properties." end -function validate_cache( - ::EmptyCache, ::NTuple{N_in, ID}, ::AbstractArray - ) where {N_in, ID} - return nothing -end - -function validate_cache( - nurbs_weights::NURBSWeights, - ::NTuple{N_in, BSplineInterpolationDimension}, - u::AbstractArray - ) where {N_in} +function validate_cache(nurbs_weights::NURBSWeights, interp_dims, u::AbstractArray) + N_in = length(interp_dims) size_expected = size(u)[1:N_in] return @assert size(nurbs_weights.weights) == size_expected "The size of the weights array must match the length of the first N_in dimensions of u ($size_expected)." end +validate_cache(cache::AbstractInterpolationCache, interp_dims, u::AbstractArray) = validate_cache(cache, first(interp_dims)) +validate_cache(::EmptyCache, ::AbstractInterpolationDimension) = nothing + function validate_cache( - ::gType, ::NTuple{N_in, ID}, ::AbstractArray - ) where {gType, N_in, ID} + ::gType, ::ID + ) where {gType <: AbstractInterpolationCache, ID <: AbstractInterpolationDimension} return @error("Interpolation dimension type $ID is not compatible with global cache type $gType.") end diff --git a/test/runtests.jl b/test/runtests.jl index 18acd55..9ceca8b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,13 +3,13 @@ const GROUP = get(ENV, "GROUP", "All") function activate_gpu_env() Pkg.activate("gpu") - Pkg.develop(PackageSpec(path=dirname(@__DIR__))) + Pkg.develop(PackageSpec(path = dirname(@__DIR__))) return Pkg.instantiate() end function activate_qa_env() Pkg.activate("qa") - Pkg.develop(PackageSpec(path=dirname(@__DIR__))) + Pkg.develop(PackageSpec(path = dirname(@__DIR__))) return Pkg.instantiate() end diff --git a/test/test_symbolics_ext.jl b/test/test_symbolics_ext.jl index 0a824c5..35ada07 100644 --- a/test/test_symbolics_ext.jl +++ b/test/test_symbolics_ext.jl @@ -62,7 +62,7 @@ end end end ) - @test res ≈ interp(0.4, 0.8; derivative_orders=(1, 0))[1] + @test res ≈ interp(0.4, 0.8; derivative_orders = (1, 0))[1] der = Symbolics.derivative(ex[1], y) @test size(der) == () @@ -74,5 +74,5 @@ end end end ) - @test res ≈ interp(0.4, 0.8; derivative_orders=(0, 1))[1] + @test res ≈ interp(0.4, 0.8; derivative_orders = (0, 1))[1] end