|
1 | | -using DiffEqBase, MATLABDiffEq, ParameterizedFunctions, Test |
2 | | - |
3 | | -# Interface tests - these test type validation without needing MATLAB runtime |
4 | | -include("interface_tests.jl") |
5 | | - |
6 | | -# JET static analysis tests - these also run without MATLAB |
7 | | -include("jet_tests.jl") |
8 | | - |
9 | | -# The following tests require MATLAB runtime to be available |
10 | | -# They test the actual ODE solving functionality |
11 | | - |
12 | | -f = @ode_def_bare LotkaVolterra begin |
13 | | - dx = a * x - b * x * y |
14 | | - dy = -c * y + d * x * y |
15 | | -end a b c d |
16 | | -p = [1.5, 1, 3, 1] |
17 | | -tspan = (0.0, 10.0) |
18 | | -u0 = [1.0, 1.0] |
19 | | -prob = ODEProblem(f, u0, tspan, p) |
20 | | -sol = solve(prob, MATLABDiffEq.ode45()) |
21 | | - |
22 | | -function lorenz(du, u, p, t) |
23 | | - du[1] = 10.0(u[2] - u[1]) |
24 | | - du[2] = u[1] * (28.0 - u[3]) - u[2] |
25 | | - return du[3] = u[1] * u[2] - (8 / 3) * u[3] |
| 1 | +using Pkg |
| 2 | +using Test |
| 3 | +using DiffEqBase, MATLABDiffEq, ParameterizedFunctions |
| 4 | + |
| 5 | +const GROUP = get(ENV, "GROUP", "Core") |
| 6 | + |
| 7 | +# QA (Aqua + JET) runs in an isolated environment (test/qa) so its tooling deps |
| 8 | +# never enter the main test target's resolve. On Julia < 1.11 the [sources] table |
| 9 | +# is ignored, so develop the package by path to test the PR branch code. |
| 10 | +function activate_qa_env() |
| 11 | + Pkg.activate(joinpath(@__DIR__, "qa")) |
| 12 | + Pkg.develop(PackageSpec(path = dirname(@__DIR__))) |
| 13 | + return Pkg.instantiate() |
26 | 14 | end |
27 | | -u0 = [1.0; 0.0; 0.0] |
28 | | -tspan = (0.0, 100.0) |
29 | | -prob = ODEProblem(lorenz, u0, tspan) |
30 | | -sol = solve(prob, MATLABDiffEq.ode45()) |
31 | | - |
32 | | -algs = [ |
33 | | - MATLABDiffEq.ode23 |
34 | | - MATLABDiffEq.ode45 |
35 | | - MATLABDiffEq.ode113 |
36 | | - MATLABDiffEq.ode23s |
37 | | - MATLABDiffEq.ode23t |
38 | | - MATLABDiffEq.ode23tb |
39 | | - MATLABDiffEq.ode15s |
40 | | -] |
41 | | - |
42 | | -for alg in algs |
43 | | - sol = solve(prob, alg()) |
| 15 | + |
| 16 | +if GROUP == "Core" || GROUP == "All" |
| 17 | + # Interface tests - these test type validation without needing MATLAB runtime |
| 18 | + include("interface_tests.jl") |
| 19 | + |
| 20 | + # Static type-stability tests - these also run without MATLAB |
| 21 | + include("jet_tests.jl") |
| 22 | + |
| 23 | + # The following tests require MATLAB runtime to be available |
| 24 | + # They test the actual ODE solving functionality |
| 25 | + |
| 26 | + f = @ode_def_bare LotkaVolterra begin |
| 27 | + dx = a * x - b * x * y |
| 28 | + dy = -c * y + d * x * y |
| 29 | + end a b c d |
| 30 | + p = [1.5, 1, 3, 1] |
| 31 | + tspan = (0.0, 10.0) |
| 32 | + u0 = [1.0, 1.0] |
| 33 | + prob = ODEProblem(f, u0, tspan, p) |
| 34 | + sol = solve(prob, MATLABDiffEq.ode45()) |
| 35 | + |
| 36 | + function lorenz(du, u, p, t) |
| 37 | + du[1] = 10.0(u[2] - u[1]) |
| 38 | + du[2] = u[1] * (28.0 - u[3]) - u[2] |
| 39 | + return du[3] = u[1] * u[2] - (8 / 3) * u[3] |
| 40 | + end |
| 41 | + u0 = [1.0; 0.0; 0.0] |
| 42 | + tspan = (0.0, 100.0) |
| 43 | + prob = ODEProblem(lorenz, u0, tspan) |
| 44 | + sol = solve(prob, MATLABDiffEq.ode45()) |
| 45 | + |
| 46 | + algs = [ |
| 47 | + MATLABDiffEq.ode23 |
| 48 | + MATLABDiffEq.ode45 |
| 49 | + MATLABDiffEq.ode113 |
| 50 | + MATLABDiffEq.ode23s |
| 51 | + MATLABDiffEq.ode23t |
| 52 | + MATLABDiffEq.ode23tb |
| 53 | + MATLABDiffEq.ode15s |
| 54 | + ] |
| 55 | + |
| 56 | + for alg in algs |
| 57 | + sol = solve(prob, alg()) |
| 58 | + end |
| 59 | +end |
| 60 | + |
| 61 | +if GROUP == "QA" |
| 62 | + activate_qa_env() |
| 63 | + include("qa/qa.jl") |
44 | 64 | end |
0 commit comments