Skip to content

Commit

Permalink
test: test eager initialization when tspan == (nothing, nothing)
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSabharwal committed Jan 20, 2025
1 parent d57f33d commit fc6be26
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/initialization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,10 @@ end
@testset "Trivial initialization" begin
initprob = NonlinearProblem(Returns(nothing), nothing, [1.0])
update_initializeprob! = function (iprob, integ)
iprob.p[1] = integ.u[1]
# just to access the current time and use it as a number, so this errors
# if run on a problem with `current_time(prob) === nothing`
iprob.p[1] = current_time(integ) + 1
iprob.p[1] = state_values(integ)[1]
end
initprobmap = function (nlsol)
u1 = parameter_values(nlsol)[1]
Expand All @@ -284,5 +287,10 @@ end
@test u0 [2.0, 2.0]
@test p 0.0
@test success

@testset "Doesn't run in `remake` if `tspan == (nothing, nothing)`" begin
prob = ODEProblem(fn, [2.0, 0.0], (nothing, nothing), 0.0)
@test_nowarn remake(prob)
end
end
end

0 comments on commit fc6be26

Please sign in to comment.