Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
oscardssmith authored Nov 15, 2023
1 parent 7885659 commit 817180c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/events_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,16 @@ tstop = [5.;8.]
condition_dc = (u,t,integrator) -> t in tstop
affect!_dc = (integrator) -> integrator.u .= 1.0
save_positions = (true,true)
callback_dc = DiscreteCallback(condition_dc, affect!_dc, save_positions=save_positions)
times_finalize_called = 0
callback_dc = DiscreteCallback(condition_dc, affect!_dc, save_positions=save_positions, finalize=(args...)->times_finalize_called+=1)
sol = solve(prob, SRIW1(), callback=callback_dc, tstops=tstop, saveat=tstop)
@test count(x->x==tstop[1], sol.t) == 2
@test count(x->x==tstop[2], sol.t) == 2
@test times_finalize_called == 1
sol = solve(prob, SRIW1(), callback=callback_dc, tstops=tstop, saveat=prevfloat.(tstop))
@test count(x->x==tstop[1], sol.t) == 2
@test count(x->x==tstop[2], sol.t) == 2
@test times_finalize_called == 2



Expand Down

0 comments on commit 817180c

Please sign in to comment.