diff --git a/Project.toml b/Project.toml index 4583f72..f69d8c2 100644 --- a/Project.toml +++ b/Project.toml @@ -39,8 +39,10 @@ PenaltyFunctions = "0.3" PreallocationTools = "0.4.34, 1.0" Random = "1" RecursiveArrayTools = "3.50, 4" +SafeTestsets = "0.1, 1" SciMLBase = "2.153, 3" SciMLSensitivity = "7.80" +SciMLTesting = "1" SteadyStateDiffEq = "2" Statistics = "1.10" StatsAPI = "1.8.0" @@ -63,9 +65,10 @@ OptimizationBBO = "3e6eede4-6085-4f62-9a71-46d9bc1eb92b" OptimizationNLopt = "4e6fcdb7-1186-4e1f-a706-475e75c168bb" OptimizationOptimJL = "36348300-93cb-4f02-beb5-3c3902f8871e" OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" -Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" +SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" SciMLSensitivity = "1ed8b502-d754-442c-8d5d-10ac956f44a1" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" SteadyStateDiffEq = "9672c7b4-1e72-59bd-8a11-6ac3964bc41f" StochasticDiffEq = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0" Sundials = "c3572dad-4567-51f8-b174-8c6c989267f4" @@ -73,4 +76,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" [targets] -test = ["Test", "ExplicitImports", "BlackBoxOptim", "DelayDiffEq", "ForwardDiff", "Logging", "NLopt", "Optim", "Optimization", "OptimizationBBO", "OptimizationNLopt", "OptimizationOptimJL", "OrdinaryDiffEq", "Pkg", "Random", "SciMLSensitivity", "StochasticDiffEq", "SteadyStateDiffEq", "Sundials", "Zygote"] +test = ["Test", "ExplicitImports", "BlackBoxOptim", "DelayDiffEq", "ForwardDiff", "Logging", "NLopt", "Optim", "Optimization", "OptimizationBBO", "OptimizationNLopt", "OptimizationOptimJL", "OrdinaryDiffEq", "Random", "SafeTestsets", "SciMLSensitivity", "SciMLTesting", "StochasticDiffEq", "SteadyStateDiffEq", "Sundials", "Zygote"] diff --git a/test/tests_on_odes/blackboxoptim_test.jl b/test/blackboxoptim_test.jl similarity index 94% rename from test/tests_on_odes/blackboxoptim_test.jl rename to test/blackboxoptim_test.jl index 6eefb0c..7feebcf 100644 --- a/test/tests_on_odes/blackboxoptim_test.jl +++ b/test/blackboxoptim_test.jl @@ -1,4 +1,6 @@ +using DiffEqParamEstim, OrdinaryDiffEq using Optimization, OptimizationBBO, Logging +include(joinpath(@__DIR__, "shared", "test_problems.jl")) prob1.u0 .= [1.0, 1.0] prob2.u0 .= [1.0, 1.0] diff --git a/test/tests_on_odes/l2_colloc_grad_test.jl b/test/l2_colloc_grad_test.jl similarity index 86% rename from test/tests_on_odes/l2_colloc_grad_test.jl rename to test/l2_colloc_grad_test.jl index 4994d7c..fd82f16 100644 --- a/test/tests_on_odes/l2_colloc_grad_test.jl +++ b/test/l2_colloc_grad_test.jl @@ -1,3 +1,7 @@ +using DiffEqParamEstim, OrdinaryDiffEq +using Optim +include(joinpath(@__DIR__, "shared", "test_problems.jl")) + weight = 1.0e-6 cost_function = build_loss_objective( diff --git a/test/tests_on_odes/l2loss_test.jl b/test/l2loss_test.jl similarity index 95% rename from test/tests_on_odes/l2loss_test.jl rename to test/l2loss_test.jl index 309b519..2fb6a91 100644 --- a/test/tests_on_odes/l2loss_test.jl +++ b/test/l2loss_test.jl @@ -1,4 +1,6 @@ +using DiffEqParamEstim, OrdinaryDiffEq using Optimization, OptimizationBBO, Optim, Logging +include(joinpath(@__DIR__, "shared", "test_problems.jl")) cost_function = build_loss_objective( prob1, Tsit5(), L2Loss(t, data), diff --git a/test/tests_on_odes/nlopt_test.jl b/test/nlopt_test.jl similarity index 87% rename from test/tests_on_odes/nlopt_test.jl rename to test/nlopt_test.jl index 4ef9c39..06191ed 100644 --- a/test/tests_on_odes/nlopt_test.jl +++ b/test/nlopt_test.jl @@ -1,4 +1,6 @@ -using OptimizationNLopt, Zygote +using DiffEqParamEstim, OrdinaryDiffEq +using Optimization, OptimizationNLopt, Zygote +include(joinpath(@__DIR__, "shared", "test_problems.jl")) println("Use NLOpt to fit the parameter") diff --git a/test/tests_on_odes/optim_test.jl b/test/optim_test.jl similarity index 95% rename from test/tests_on_odes/optim_test.jl rename to test/optim_test.jl index 8775458..7990fb9 100644 --- a/test/tests_on_odes/optim_test.jl +++ b/test/optim_test.jl @@ -1,4 +1,6 @@ +using DiffEqParamEstim, OrdinaryDiffEq using Optim, Random +include(joinpath(@__DIR__, "shared", "test_problems.jl")) obj = build_loss_objective( prob1, Tsit5(), L2Loss(t, data), maxiters = 10000 diff --git a/test/qa/Project.toml b/test/qa/Project.toml index b535fcd..a428c5a 100644 --- a/test/qa/Project.toml +++ b/test/qa/Project.toml @@ -2,6 +2,8 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" DiffEqParamEstim = "1130ab10-4a5a-5621-a13d-e4788d82bd4c" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" +SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [sources] @@ -10,5 +12,7 @@ DiffEqParamEstim = {path = "../.."} [compat] Aqua = "0.8" JET = "0.9,0.10,0.11" +SafeTestsets = "0.1, 1" +SciMLTesting = "1" Test = "1" julia = "1.10" diff --git a/test/tests_on_odes/regularization_test.jl b/test/regularization_test.jl similarity index 86% rename from test/tests_on_odes/regularization_test.jl rename to test/regularization_test.jl index 6fae0e6..c554f42 100644 --- a/test/tests_on_odes/regularization_test.jl +++ b/test/regularization_test.jl @@ -1,4 +1,6 @@ -using PenaltyFunctions, OptimizationOptimJL, LinearAlgebra, SciMLSensitivity +using DiffEqParamEstim, OrdinaryDiffEq +using Optimization, PenaltyFunctions, OptimizationOptimJL, LinearAlgebra, SciMLSensitivity +include(joinpath(@__DIR__, "shared", "test_problems.jl")) cost_function_1 = build_loss_objective( prob1, Tsit5(), L2Loss(t, data), diff --git a/test/runtests.jl b/test/runtests.jl index 2da5008..a18a7cc 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,50 +1,2 @@ -using Pkg -using DiffEqParamEstim, Test - -const GROUP = get(ENV, "GROUP", "All") - -if GROUP == "QA" - Pkg.activate("qa") - Pkg.develop(PackageSpec(path = dirname(@__DIR__))) - Pkg.instantiate() - include("qa/qa.jl") -else - @time @testset "Explicit Imports" begin - include("explicit_imports.jl") - end - - @time @testset "Tests on ODEs" begin - include("tests_on_odes/test_problems.jl") - include("tests_on_odes/l2loss_test.jl") - include("tests_on_odes/optim_test.jl") - include("tests_on_odes/nlopt_test.jl") - include("tests_on_odes/two_stage_method_test.jl") - include("tests_on_odes/blackboxoptim_test.jl") - include("tests_on_odes/regularization_test.jl") - include("tests_on_odes/weighted_loss_test.jl") - include("tests_on_odes/l2_colloc_grad_test.jl") - #include("tests_on_odes/genetic_algorithm_test.jl") # Not updated to v0.6 - end - - @time @testset "Multiple Shooting Objective" begin - include("multiple_shooting_objective_test.jl") - end - @time @testset "Likelihood Loss" begin - include("likelihood.jl") - end - @time @testset "Out-of-place ODE Tests" begin - include("out_of_place_odes.jl") - end - @time @testset "Steady State Tests" begin - include("steady_state_tests.jl") - end - @time @testset "DAE Tests" begin - include("dae_tests.jl") - end - @time @testset "DDE Tests" begin - include("dde_tests.jl") - end - @time @testset "Test on Monte" begin - include("test_on_monte.jl") - end -end +using SciMLTesting +run_tests() diff --git a/test/tests_on_odes/genetic_algorithm_test.jl b/test/shared/genetic_algorithm_test.jl similarity index 100% rename from test/tests_on_odes/genetic_algorithm_test.jl rename to test/shared/genetic_algorithm_test.jl diff --git a/test/lorenz_test.jl b/test/shared/lorenz_test.jl similarity index 100% rename from test/lorenz_test.jl rename to test/shared/lorenz_test.jl diff --git a/test/lorenz_true_test.jl b/test/shared/lorenz_true_test.jl similarity index 100% rename from test/lorenz_true_test.jl rename to test/shared/lorenz_true_test.jl diff --git a/test/tests_on_odes/test_problems.jl b/test/shared/test_problems.jl similarity index 100% rename from test/tests_on_odes/test_problems.jl rename to test/shared/test_problems.jl diff --git a/test/tests_on_odes/two_stage_method_test.jl b/test/two_stage_method_test.jl similarity index 88% rename from test/tests_on_odes/two_stage_method_test.jl rename to test/two_stage_method_test.jl index 02449a0..848d61d 100644 --- a/test/tests_on_odes/two_stage_method_test.jl +++ b/test/two_stage_method_test.jl @@ -1,4 +1,6 @@ -using Optim, NLopt, OptimizationOptimJL +using DiffEqParamEstim, OrdinaryDiffEq +using Optimization, OptimizationNLopt, Optim, NLopt, OptimizationOptimJL +include(joinpath(@__DIR__, "shared", "test_problems.jl")) println("Use Two Stage Method to fit the parameter") diff --git a/test/tests_on_odes/weighted_loss_test.jl b/test/weighted_loss_test.jl similarity index 91% rename from test/tests_on_odes/weighted_loss_test.jl rename to test/weighted_loss_test.jl index 6ffd1d0..b746481 100644 --- a/test/tests_on_odes/weighted_loss_test.jl +++ b/test/weighted_loss_test.jl @@ -1,4 +1,6 @@ +using DiffEqParamEstim, OrdinaryDiffEq using Distributions, RecursiveArrayTools, NLopt, Random +include(joinpath(@__DIR__, "shared", "test_problems.jl")) Random.seed!(123) original_solution = VectorOfArray([(sol(t[i])) for i in 1:length(t)])