Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
YingboMa committed Oct 8, 2023
1 parent aa1839c commit 90177cb
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions test/odesystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -737,28 +737,20 @@ let
u0map = [A => 1.0]
pmap = (k1 => 1.0, k2 => 1)
tspan = (0.0, 1.0)
prob = ODEProblem(sys, u0map, tspan, pmap; tofloat = false)
@test prob.p == ([1], [1.0]) #Tuple([(Dict(pmap))[k] for k in values(parameters(sys))])
prob = ODEProblem(sys, u0map, tspan, pmap; tofloat = true)
@test prob.p == [1.0, 1.0]

prob = ODEProblem(sys, u0map, tspan, pmap)
@test prob.p isa Vector{Float64}
@test prob.p isa Tuple{Vector{Float64}, Vector{Int}}
@test prob.p == ([1.0], [1])

pmap = [k1 => 1, k2 => 1]
tspan = (0.0, 1.0)
prob = ODEProblem(sys, u0map, tspan, pmap)
prob = ODEProblem(sys, u0map, tspan, pmap; tofloat = true)
@test eltype(prob.p) === Float64

prob = ODEProblem(sys, u0map, tspan, pmap; tofloat = false)
@test eltype(prob.p) === Int

prob = ODEProblem(sys, u0map, tspan, pmap)
@test prob.p isa Vector{Float64}

# No longer supported, Tuple used instead
# pmap = Pair{Any, Union{Int, Float64}}[k1 => 1, k2 => 1.0]
# tspan = (0.0, 1.0)
# prob = ODEProblem(sys, u0map, tspan, pmap, use_union = true)
# @test eltype(prob.p) === Union{Float64, Int}
@test eltype(prob.p) === Int
end

let
Expand Down

0 comments on commit 90177cb

Please sign in to comment.