Skip to content
Merged
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
3 changes: 2 additions & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
QuasiMonteCarlo = "8a4e6c94-4038-4cdc-81c3-7e6ffdb2a71b"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

Expand All @@ -18,5 +18,6 @@ Optimization = "4.1, 5.2"
QuasiMonteCarlo = "0.3"
SafeTestsets = "0.1"
SciMLBase = "2.79, 3.0"
SciMLTesting = "1"
StaticArrays = "1.9"
julia = "1.10"
34 changes: 0 additions & 34 deletions test/qa.jl

This file was deleted.

4 changes: 4 additions & 0 deletions test/qa/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[deps]
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
ParallelParticleSwarms = "ab63da0c-63b4-40fa-a3b7-d2cba5be6419"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

Expand All @@ -9,5 +11,7 @@ ParallelParticleSwarms = {path = "../.."}

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

@testset "Utility functions type stability" begin
@test_opt target_modules = (ParallelParticleSwarms,) ParallelParticleSwarms.θ_default(
0.5f0
)
@test_opt target_modules = (ParallelParticleSwarms,) ParallelParticleSwarms.γ_default(
0.5f0
)

@test_opt target_modules = (ParallelParticleSwarms,) ParallelParticleSwarms.uniform(
2, Float32[-5.0, -5.0], Float32[5.0, 5.0]
)
end

@testset "Particle struct construction" begin
T = SVector{2, Float32}
position = @SVector zeros(Float32, 2)
velocity = @SVector zeros(Float32, 2)
cost = 0.0f0

@test_opt target_modules = (ParallelParticleSwarms,) ParallelParticleSwarms.SPSOParticle(
position, velocity, cost, position, cost
)

@test_opt target_modules = (ParallelParticleSwarms,) ParallelParticleSwarms.SPSOGBest(
position, cost
)
end
5 changes: 5 additions & 0 deletions test/qa/qa.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using SafeTestsets

@safetestset "JET static analysis" begin
include("jet_tests.jl")
end
42 changes: 20 additions & 22 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
using Pkg
using SafeTestsets
using Test
using SciMLTesting

const TEST_GROUP = get(ENV, "PPS_TEST_GROUP", "Core")
run_tests(;
env = "PPS_TEST_GROUP",
default = "Core",
core = function ()
global CI_GROUP = get(ENV, "GROUP", "CPU")

if TEST_GROUP == "QA"
Pkg.activate(joinpath(@__DIR__, "qa"))
Pkg.develop(PackageSpec(path = joinpath(@__DIR__, "..")))
Pkg.instantiate()
include("qa.jl")
else
global CI_GROUP = get(ENV, "GROUP", "CPU")
@safetestset "Regression tests" include("./regression.jl")
@safetestset "Reinitialization tests" include("./reinit.jl")

@safetestset "Regression tests" include("./regression.jl")
@safetestset "Reinitialization tests" include("./reinit.jl")

#TODO: Current throws warning for redefinition with the use of @testset multiple times. Migrate to TestItemRunners.jl
@testset for BACKEND in unique(("CPU", CI_GROUP))
global GROUP = BACKEND
@testset "$(BACKEND) optimizers tests" include("./gpu.jl")
GC.gc(true)
@testset "$(BACKEND) optimizers with constraints tests" include("./constraints.jl")
GC.gc(true)
@testset "$(BACKEND) hybrid optimizers" include("./lbfgs.jl")
end
end
#TODO: Current throws warning for redefinition with the use of @testset multiple times. Migrate to TestItemRunners.jl
return @testset for BACKEND in unique(("CPU", CI_GROUP))
global GROUP = BACKEND
@testset "$(BACKEND) optimizers tests" include("./gpu.jl")
GC.gc(true)
@testset "$(BACKEND) optimizers with constraints tests" include("./constraints.jl")
GC.gc(true)
@testset "$(BACKEND) hybrid optimizers" include("./lbfgs.jl")
end
end,
qa = (; env = joinpath(@__DIR__, "qa"), body = joinpath(@__DIR__, "qa", "qa.jl")),
)
Loading