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
7 changes: 5 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@ DiffEqBase = "6.62, 7"
ExplicitImports = "1.14.0"
GeometricIntegrators = "0.15.5, 0.16"
Reexport = "0.2, 1"
SafeTestsets = "0.0.1, 0.1"
SciMLBase = "2, 3"
SciMLLogging = "1.10.1, 2"
SciMLTesting = "1"
julia = "1.10"

[extras]
ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7"
ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
SafeTestsets = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["ExplicitImports", "ODEProblemLibrary", "Pkg", "Test"]
test = ["ExplicitImports", "ODEProblemLibrary", "SafeTestsets", "SciMLTesting", "Test"]
4 changes: 4 additions & 0 deletions test/nopre/Project.toml → test/NoPre/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
AllocCheck = "9b6a8646-10ed-4001-bbdc-1d2f46dfbb1a"
GeometricIntegratorsDiffEq = "5a33fad7-5ce4-5983-9f5d-5f26ceab5c96"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
SafeTestsets = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
AllocCheck = "0.1, 0.2"
JET = "0.9, 0.10, 0.11"
SafeTestsets = "0.0.1, 0.1"
SciMLTesting = "1"
File renamed without changes.
File renamed without changes.
85 changes: 85 additions & 0 deletions test/core_tests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
using GeometricIntegratorsDiffEq
using GeometricIntegrators
using DiffEqBase: solve, ReturnCode, SecondOrderODEProblem
import ODEProblemLibrary: prob_ode_2Dlinear
using Test

@testset "Standard ODE Problems" begin
prob = prob_ode_2Dlinear

sol = solve(prob, GIEuler(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIMidpoint(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIHeun2(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIHeun3(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIRalston2(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIRalston3(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIRunge(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIKutta(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIRK416(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIRK438(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GISSPRK3(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GICrankNicolson(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIKraaijevangerSpijker(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIQinZhang(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GICrouzeix(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIImplicitEuler(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIImplicitMidpoint(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GISRK3(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIGLRK(2), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIRadauIA(2), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIRadauIIA(2), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GILobattoIIIA(2), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GILobattoIIIB(2), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GILobattoIIIC(2), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GILobattoIIIC̄(2), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GILobattoIIID(2), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GILobattoIIIE(2), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GILobattoIIIF(2), dt = 0.1)
@test sol.retcode == ReturnCode.Success
end

@testset "Second Order ODE Problems" begin
# Second order ODE problem - use the new 5-argument convention with p parameter
u0 = zeros(2)
v0 = ones(2)
f2 = function (dv, v, u, p, t)
dv .= -u
end
prob = SecondOrderODEProblem{true}(f2, v0, u0, (0.0, 5.0))

sol = solve(prob, GISymplecticEulerA(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GISymplecticEulerB(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GILobattoIIIAIIIB(2), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GILobattoIIIBIIIA(2), dt = 0.1)
@test sol.retcode == ReturnCode.Success
end
134 changes: 29 additions & 105 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,109 +1,33 @@
using Pkg
using SafeTestsets
using Test
using SciMLTesting

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

if GROUP == "All" || GROUP == "Core"
using GeometricIntegratorsDiffEq
using GeometricIntegrators
using DiffEqBase: solve, ReturnCode, SecondOrderODEProblem
import ODEProblemLibrary: prob_ode_2Dlinear

@testset "GeometricIntegratorsDiffEq" begin
@testset "Standard ODE Problems" begin
prob = prob_ode_2Dlinear

sol = solve(prob, GIEuler(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIMidpoint(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIHeun2(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIHeun3(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIRalston2(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIRalston3(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIRunge(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIKutta(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIRK416(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIRK438(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GISSPRK3(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GICrankNicolson(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIKraaijevangerSpijker(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIQinZhang(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GICrouzeix(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIImplicitEuler(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIImplicitMidpoint(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GISRK3(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIGLRK(2), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIRadauIA(2), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GIRadauIIA(2), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GILobattoIIIA(2), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GILobattoIIIB(2), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GILobattoIIIC(2), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GILobattoIIIC̄(2), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GILobattoIIID(2), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GILobattoIIIE(2), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GILobattoIIIF(2), dt = 0.1)
@test sol.retcode == ReturnCode.Success
run_tests(;
core = function ()
@safetestset "GeometricIntegratorsDiffEq" begin
include("core_tests.jl")
end

@testset "Second Order ODE Problems" begin
# Second order ODE problem - use the new 5-argument convention with p parameter
u0 = zeros(2)
v0 = ones(2)
f2 = function (dv, v, u, p, t)
dv .= -u
end
prob = SecondOrderODEProblem{true}(f2, v0, u0, (0.0, 5.0))

sol = solve(prob, GISymplecticEulerA(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GISymplecticEulerB(), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GILobattoIIIAIIIB(2), dt = 0.1)
@test sol.retcode == ReturnCode.Success
sol = solve(prob, GILobattoIIIBIIIA(2), dt = 0.1)
@test sol.retcode == ReturnCode.Success
return @safetestset "Explicit Imports" begin
include("explicit_imports_test.jl")
end
end # testset GeometricIntegratorsDiffEq

# Run ExplicitImports tests
include("explicit_imports_test.jl")
end

# Run NoPre tests (JET and AllocCheck) in a separate environment
if GROUP == "NoPre"
Pkg.activate("nopre")
Pkg.develop(PackageSpec(path = dirname(@__DIR__)))
Pkg.instantiate()
@time @testset "JET Tests" begin
include("nopre/jet.jl")
end
@time @testset "AllocCheck Tests" begin
include("nopre/alloc_tests.jl")
end
end
end,
groups = Dict(
# NoPre runs the JET and AllocCheck tests in their own environment. The
# original dispatcher ran these only for GROUP=="NoPre" (never as part of
# "All"), so NoPre is an env-bearing group kept out of the curated `all`.
"NoPre" => (;
env = joinpath(@__DIR__, "NoPre"),
body = function ()
@time @safetestset "JET Tests" begin
include(joinpath(@__DIR__, "NoPre", "jet.jl"))
end
return @time @safetestset "AllocCheck Tests" begin
include(joinpath(@__DIR__, "NoPre", "alloc_tests.jl"))
end
end,
),
),
# The original runtests.jl ran the Core body for GROUP=All and GROUP=Core, and
# ran NoPre only for GROUP=NoPre (never under "All"). Curate "All" to Core only.
all = ["Core"],
)
Loading