Skip to content

Commit

Permalink
Merge pull request #797 from JuliaReach/schillic/tests
Browse files Browse the repository at this point in the history
Resolve warnings and outputs in tests
  • Loading branch information
schillic authored Mar 10, 2024
2 parents c02cca7 + c71f92f commit 79c2d49
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/Algorithms/FLOWSTAR/post.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function post(alg::FLOWSTAR{ST,OT,PT,IT}, ivp::IVP{<:AbstractContinuousSystem},
ContinuousReachModel(states, params, setting, scheme, eom, dom)
end

# call Flow*; use Val(true) to obtain TaylorModel1 of TaylorN
# call Flow*; use Val(true) to obtain TaylorModel1 of TaylorN
sol = FlowstarContinuousSolution(model, Val(true))
flow = sol.flow

Expand Down
2 changes: 2 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Polyhedra = "67491407-f73d-577b-9b50-8179a7c68029"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
TaylorModels = "314ce334-5f6e-57ae-acf6-00b6e903104a"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand All @@ -24,5 +25,6 @@ IntervalArithmetic = "0.16 - 0.20, =0.20.9" # new versions require updates and
LazySets = "2.3"
Polyhedra = "0.5 - 0.7"
StaticArrays = "0.12, 1"
Suppressor = "0.2"
Symbolics = "4 - 5"
TaylorModels = "0.6"
7 changes: 4 additions & 3 deletions test/algorithms/FLOWSTAR.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import Flowstar
import Flowstar, Symbolics
using Suppressor: @suppress # suppress long output of Flowstar
using ReachabilityAnalysis: ReachSolution

@testset "FLOWSTAR algorithm" begin
# Passing a model file.
model = joinpath(@__DIR__, "..", "models", "LotkaVolterra.model")
ivp = @ivp(BlackBoxContinuousSystem(model, 2), x(0) (4.8 .. 5.2) × (1.8 .. 2.2))
sol = solve(ivp; tspan=(0, 1), alg=FLOWSTAR(; δ=0.02))
sol = @suppress solve(ivp; tspan=(0, 1), alg=FLOWSTAR(; δ=0.02))
RT = TaylorModelReachSet{Float64,IntervalArithmetic.Interval{Float64}}
@test sol isa ReachSolution{Flowpipe{Float64,RT,Vector{RT}},
FLOWSTAR{Float64,Flowstar.FixedTMOrder,
Expand All @@ -18,7 +19,7 @@ using ReachabilityAnalysis: ReachSolution
return dx[2] = -3 * x[2] + x[1] * x[2]
end
ivp = @ivp(x' = f!(x), dim = 2, x(0) (4.8 .. 5.2) × (1.8 .. 2.2))
sol = solve(ivp; tspan=(0, 1), alg=FLOWSTAR(; δ=0.02))
sol = @suppress solve(ivp; tspan=(0, 1), alg=FLOWSTAR(; δ=0.02))
RT = TaylorModelReachSet{Float64,IntervalArithmetic.Interval{Float64}}
@test sol isa ReachSolution{Flowpipe{Float64,RT,Vector{RT}},
FLOWSTAR{Float64,Flowstar.FixedTMOrder,
Expand Down
11 changes: 4 additions & 7 deletions test/hybrid/hybrid.jl
Original file line number Diff line number Diff line change
Expand Up @@ -174,19 +174,16 @@ end
# solve with default options (no simulations)
sol = solve(S; T=T)

# will have many intermediate steps
# handle invariants discretely
solsd = solve(S; T=T, ensemble=true, trajectories=10, use_discrete_callback=true)
@test length(ensemble(solsd)) == 10

# include the X0 vertices (here: singleton X0, so all simulations are the same)
solsd = solve(S; T=T, ensemble=true, trajectories=10, include_vertices=true,
use_discrete_callback=true)
@test length(ensemble(solsd)) == 10 + 1 # singleton initial condition
@test length(ensemble(solsd)) == 10 + 1

# will handle invariants continuously but not have many intermediate steps
solsc = solve(S; T=T, ensemble=true, trajectories=10)
@test length(ensemble(solsc)) == 10

# will handle invariants continuously with additionally many intermediate steps
# handle invariants continuously
solscstep = solve(S; T=T, ensemble=true, trajectories=10, dtmax=0.1)
@test length(ensemble(solscstep)) == 10
end
3 changes: 1 addition & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Test
using ReachabilityAnalysis
using Test, ReachabilityAnalysis

TEST_MODELS = ["models/harmonic_oscillator.jl",
"models/forced_oscillator.jl",
Expand Down

0 comments on commit 79c2d49

Please sign in to comment.