Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
gaurav-arya committed Jul 13, 2023
1 parent b2fe965 commit 347c8ed
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/variable_rate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,25 @@ let
@test_throws ErrorException JumpProblem(dprob_, alg, mass_action_jump_, vrj;
save_positions = (false, false))
end

# https://github.com/SciML/JumpProcesses.jl/issues/330
let
test_rate(u, p, t) = 3.0
test_affect!(integrator) = (integrator.u[1] += 1)
function test_urate(u, p, t)
if t > 1.0
error("test_urate does not handle t > 1.0")
else
return 4.0
end
end

test_jump = VariableRateJump(test_rate, test_affect!; urate=test_urate, rateinterval=(u,p,t)->0.9)

dprob = DiscreteProblem([0], (0.0, 1.0), nothing)
jprob = JumpProblem(dprob, Coevolve(), test_jump; dep_graph=[[1]])

@test_nowarn for i in 1:100
solve(jprob, SSAStepper())
end
end

0 comments on commit 347c8ed

Please sign in to comment.