From 69abaa00887ef3d22a36d2d80d3ccfbc74ad635d Mon Sep 17 00:00:00 2001 From: Sam Isaacson Date: Tue, 26 Mar 2024 13:11:39 -0400 Subject: [PATCH] finish SII tests --- test/jprob_symbol_indexing.jl | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/jprob_symbol_indexing.jl b/test/jprob_symbol_indexing.jl index 3560b952..efe67bfb 100644 --- a/test/jprob_symbol_indexing.jl +++ b/test/jprob_symbol_indexing.jl @@ -48,6 +48,18 @@ setp(integ, :p2)(integ, 15.0) reset_aggregated_jumps!(integ) @test jprob.massaction_jump.scaled_rates[2] == 15.0 # jump rate now updated +# remake tests +dprob = DiscreteProblem(g, [0, 10], (0.0, 10.0), [1.0, 2.0]) +jprob = JumpProblem(dprob, Direct(), crj1, crj2, maj) +jprob = remake(jprob; u0 = [:a => -10, :b => 100], p = [:p2 => 3.5, :p1 => .5]) +@test jprob.prob.u0 == [-10, 100] +@test jprob.prob.p == [.5, 3.5] +@test jprob.massaction_jump.scaled_rates == [.5, 3.5] +jprob = remake(jprob; u0 = [:b => 10], p = [:p2 => 4.5]) +@test jprob.prob.u0 == [-10, 10] +@test jprob.prob.p == [.5, 4.5] +@test jprob.massaction_jump.scaled_rates == [.5, 4.5] + # test updating problems via regular indexing still updates the mass action jump dprob = DiscreteProblem(g, [0, 10], (0.0, 10.0), [1.0, 2.0]) jprob = JumpProblem(dprob, Direct(), crj1, crj2, maj) @@ -70,3 +82,15 @@ setp(integ, 2)(integ, 15.0) @test getp(integ, 2)(integ) == 15.0 reset_aggregated_jumps!(integ) @test jprob.massaction_jump.scaled_rates[2] == 15.0 # jump rate now updated + +# remake tests for regular indexing +dprob = DiscreteProblem(g, [0, 10], (0.0, 10.0), [1.0, 2.0]) +jprob = JumpProblem(dprob, Direct(), crj1, crj2, maj) +jprob = remake(jprob; u0 = [-10, 100], p = [.5, 3.5]) +@test jprob.prob.u0 == [-10, 100] +@test jprob.prob.p == [.5, 3.5] +@test jprob.massaction_jump.scaled_rates == [.5, 3.5] +jprob = remake(jprob; u0 = [2 => 10], p = [2 => 4.5]) +@test jprob.prob.u0 == [-10, 10] +@test jprob.prob.p == [.5, 4.5] +@test jprob.massaction_jump.scaled_rates == [.5, 4.5]