Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Documenter = "1"
JLArrays = "0.3"
OrdinaryDiffEq = "6, 7"
Plots = "1"
SafeTestsets = "0.1, 1"
Test = "1"
julia = "1.10"

Expand All @@ -31,8 +32,9 @@ JLArrays = "27aeb0d3-9eb9-45fb-866b-73c2ecf80fcb"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
docs = ["Documenter", "DataInterpolations", "OrdinaryDiffEq", "Plots"]
test = ["DataInterpolations", "JET", "JLArrays", "OrdinaryDiffEq", "Pkg", "Test"]
test = ["DataInterpolations", "JET", "JLArrays", "OrdinaryDiffEq", "Pkg", "SafeTestsets", "Test"]
10 changes: 10 additions & 0 deletions test/kernels_setup.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using DataCollocations

bounded_support_kernels = [
EpanechnikovKernel(), UniformKernel(), TriangularKernel(),
QuarticKernel(), TriweightKernel(), TricubeKernel(), CosineKernel(),
]

unbounded_support_kernels = [
GaussianKernel(), LogisticKernel(), SigmoidKernel(), SilvermanKernel(),
]
2 changes: 2 additions & 0 deletions test/qa/Project.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
[deps]
DataCollocations = "9454e98c-75cb-4dbc-9573-481819719962"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[sources]
DataCollocations = {path = "../.."}

[compat]
JET = "0.9, 0.10"
SafeTestsets = "0.1, 1"
Test = "1"
julia = "1.10"
23 changes: 23 additions & 0 deletions test/qa/jet_tests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using DataCollocations
using Test
using JET

# Test kernel functions for type stability
@testset "calckernel optimization" begin
kernels = [
EpanechnikovKernel(), UniformKernel(), TriangularKernel(),
QuarticKernel(), TriweightKernel(), TricubeKernel(),
GaussianKernel(), CosineKernel(), LogisticKernel(),
SigmoidKernel(), SilvermanKernel(),
]
@testset "$kernel" for kernel in kernels
JET.@test_opt target_modules = (DataCollocations,) DataCollocations.calckernel(kernel, 0.5)
end
end

# Test main collocate_data function
@testset "collocate_data optimization" begin
data = rand(2, 20)
tpoints = collect(range(0.0, 1.0, length = 20))
JET.@test_opt target_modules = (DataCollocations,) collocate_data(data, tpoints, TriangularKernel(), 0.1)
end
26 changes: 3 additions & 23 deletions test/qa/qa.jl
Original file line number Diff line number Diff line change
@@ -1,25 +1,5 @@
using DataCollocations
using Test
using JET
using SafeTestsets

@testset "JET Static Analysis" begin
# Test kernel functions for type stability
@testset "calckernel optimization" begin
kernels = [
EpanechnikovKernel(), UniformKernel(), TriangularKernel(),
QuarticKernel(), TriweightKernel(), TricubeKernel(),
GaussianKernel(), CosineKernel(), LogisticKernel(),
SigmoidKernel(), SilvermanKernel(),
]
@testset "$kernel" for kernel in kernels
JET.@test_opt target_modules = (DataCollocations,) DataCollocations.calckernel(kernel, 0.5)
end
end

# Test main collocate_data function
@testset "collocate_data optimization" begin
data = rand(2, 20)
tpoints = collect(range(0.0, 1.0, length = 20))
JET.@test_opt target_modules = (DataCollocations,) collocate_data(data, tpoints, TriangularKernel(), 0.1)
end
@safetestset "JET Static Analysis" begin
include("jet_tests.jl")
end
37 changes: 21 additions & 16 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using Pkg
using DataCollocations
using SafeTestsets
using Test
using OrdinaryDiffEq
using DataInterpolations
using JLArrays

const GROUP = get(ENV, "GROUP", "All")

Expand All @@ -14,16 +11,11 @@ if GROUP == "QA"
include(joinpath(@__DIR__, "qa", "qa.jl"))
else
@testset "DataCollocations.jl" begin
bounded_support_kernels = [
EpanechnikovKernel(), UniformKernel(), TriangularKernel(),
QuarticKernel(), TriweightKernel(), TricubeKernel(), CosineKernel(),
]
@safetestset "Kernel Functions" begin
using DataCollocations
using Test
include("kernels_setup.jl")

unbounded_support_kernels = [
GaussianKernel(), LogisticKernel(), SigmoidKernel(), SilvermanKernel(),
]

@testset "Kernel Functions" begin
ts = collect(-5.0:0.1:5.0)
@testset "Kernels with support from -1 to 1" begin
minus_one_index = findfirst(x -> ==(x, -1.0), ts)
Expand Down Expand Up @@ -54,7 +46,12 @@ else
end
end

@testset "Collocation of data" begin
@safetestset "Collocation of data" begin
using DataCollocations
using OrdinaryDiffEq
using Test
include("kernels_setup.jl")

f(u, p, t) = p .* u
rc = 2
ps = repeat([-0.001], rc)
Expand All @@ -75,7 +72,11 @@ else
end
end

@testset "DataInterpolations Extension" begin
@safetestset "DataInterpolations Extension" begin
using DataCollocations
using DataInterpolations
using Test

# Test with simple data
t = 0.0:0.1:1.0
data = sin.(t)
Expand All @@ -87,7 +88,11 @@ else
@test length(u) == length(tpoints_sample)
end

@testset "Interface Compatibility" begin
@safetestset "Interface Compatibility" begin
using DataCollocations
using JLArrays
using Test

@testset "BigFloat support" begin
# Test that BigFloat inputs are supported and eltype is preserved
tpoints = BigFloat.(collect(range(0.0, stop = 10.0, length = 30)))
Expand Down
Loading