Skip to content

Commit

Permalink
start on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacsas committed Nov 16, 2024
1 parent 1e743a3 commit 784f754
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/reactionsystem_conversions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ function classify_vrjs(rs, physcales)
empty!(rxvars)
(rx.rate isa Symbolic) && get_variables!(rxvars, rx.rate)
@inbounds for rxvar in rxvars
if isequal(rxvar, get_iv(rs))
if isequal(rxvar, get_iv(rs)) || (!MT.isparameter(rxvar) && !isspecies(rxvar))
isvrjvec[i] = true
havevrjs = true
break
Expand Down Expand Up @@ -401,7 +401,7 @@ function assemble_jumps(rs; combinatoric_ratelaws = true, physical_scales = noth
end
end
end
vcat(meqs, ceqs, veqs)
reduce(vcat, (meqs, ceqs, veqs); init = Any[])
end

### Equation Coupling ###
Expand Down
16 changes: 15 additions & 1 deletion test/reactionsystem_core/reactionsystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1021,4 +1021,18 @@ let
jprob = JumpProblem(jinput; rng)
sol = solve(jprob)
@test sol(10.0; idxs = :A) > 0
end

rn = @reaction_network begin
@parameters λ
k*V, 0 --> A
@equations D(V) ~ λ*V
@continuous_events begin
[V ~ 2.0] => [V ~ V/2, A ~ rand()*A]
end
end
jinput = JumpInputs(rn, [:A => 0, :V => 1.0], (0.0, 10.0), [:k => 1.0, => .2])
@test jinput.prob isa ODEProblem
jprob = JumpProblem(jinput; rng)
sol = solve(jprob, Tsit5())

end

0 comments on commit 784f754

Please sign in to comment.